2011-04-11 Anders Carlsson <andersca@apple.com>
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Apr 2011 21:26:28 +0000 (21:26 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Apr 2011 21:26:28 +0000 (21:26 +0000)
commit8b192ac68758b420d328f5ade1b6ab8f5462b170
tree3267d492fadddf3bb2bed78e3b0c045721c90f97
parentd582780be2b429f41ba419a3e3c97ba4cc934945
2011-04-11  Anders Carlsson  <andersca@apple.com>

        Reviewed by Sam Weinig.

        First step towards simplifying WebPageProxy/WebProcessProxy/WebContext ownership
        https://bugs.webkit.org/show_bug.cgi?id=58266

        With this patch, the WKView holds a strong reference to a WebPageProxy. The
        WebPageProxy in turn holds a strong reference to its WebProcessProxy. Finally,
        The WebProcessProxy holds a strong reference to its WebContext.

        The WebContext holds a strong reference to the running WebProcessProxy which results
        in a reference cycle that's broken when the web process exits.

        The reason for is to avoid crashes where WebPageProxy::process() returns null if the web process
        has crashed but has not yet been relaunched.

        * UIProcess/WebContext.cpp:
        (WebKit::WebContext::disconnectProcess):
        Add comment.

        (WebKit::WebContext::createWebPage):
        Return a PassRefPtr.

        (WebKit::WebContext::relaunchProcessIfNecessary):
        Change this to return a WebPageProxy.

        * UIProcess/WebPageProxy.cpp:
        (WebKit::WebPageProxy::create):
        This now takes a PassRefPtr<WebProcessProxy>.

        (WebKit::WebPageProxy::WebPageProxy):
        Ditto.

        (WebKit::WebPageProxy::~WebPageProxy):
        Call close() if necessary.

        (WebKit::WebPageProxy::reattachToWebProcess):
        Replace the current process with the new process.

        * UIProcess/WebProcessProxy.cpp:
        (WebKit::WebProcessProxy::create):
        Take a PassRefPtr<WebContext>.

        (WebKit::WebProcessProxy::WebProcessProxy):
        Ditto.

        (WebKit::WebProcessProxy::webPage):
        Remove .get() now that the page map uses weak references.

        (WebKit::WebProcessProxy::createWebPage):
        This now returns the created web page proxy.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@83499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/WebContext.cpp
Source/WebKit2/UIProcess/WebContext.h
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/WebProcessProxy.cpp
Source/WebKit2/UIProcess/WebProcessProxy.h