Skip to content
Permalink
Browse files
2011-04-11 Anders Carlsson <andersca@apple.com>
        Reviewed by Adam Roben.

        Remove the WebContext member variable from WebPageProxy
        https://bugs.webkit.org/show_bug.cgi?id=58271

        * UIProcess/API/C/WKPage.cpp:
        (WKPageGetContext):
        * UIProcess/WebPageProxy.cpp:
        (WebKit::WebPageProxy::create):
        (WebKit::WebPageProxy::WebPageProxy):
        (WebKit::WebPageProxy::process):
        (WebKit::WebPageProxy::reattachToWebProcess):
        (WebKit::WebPageProxy::canShowMIMEType):
        (WebKit::WebPageProxy::receivedPolicyDecision):
        (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
        (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
        (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
        (WebKit::WebPageProxy::didCommitLoadForFrame):
        (WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
        (WebKit::WebPageProxy::didFinishLoadForFrame):
        (WebKit::WebPageProxy::didFailLoadForFrame):
        (WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
        (WebKit::WebPageProxy::didReceiveTitleForFrame):
        (WebKit::WebPageProxy::didFirstLayoutForFrame):
        (WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame):
        (WebKit::WebPageProxy::didRemoveFrameFromHierarchy):
        (WebKit::WebPageProxy::didDisplayInsecureContentForFrame):
        (WebKit::WebPageProxy::didRunInsecureContentForFrame):
        (WebKit::WebPageProxy::decidePolicyForNavigationAction):
        (WebKit::WebPageProxy::decidePolicyForNewWindowAction):
        (WebKit::WebPageProxy::decidePolicyForResponse):
        (WebKit::WebPageProxy::unableToImplementPolicy):
        (WebKit::WebPageProxy::willSubmitForm):
        (WebKit::WebPageProxy::mouseDidMoveOverElement):
        (WebKit::WebPageProxy::showContextMenu):
        (WebKit::WebPageProxy::contextMenuItemSelected):
        * UIProcess/WebPageProxy.h:
        * UIProcess/WebProcessProxy.cpp:
        (WebKit::WebProcessProxy::createWebPage):
        * UIProcess/mac/WebInspectorProxyMac.mm:
        (WebKit::WebInspectorProxy::platformCreateInspectorPage):


Canonical link: https://commits.webkit.org/73273@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@83509 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Anders Carlsson committed Apr 11, 2011
1 parent 5648ecd commit a97f19fe61c5ca5f485c4c6a99b3451006cd1fec
Showing 6 changed files with 81 additions and 38 deletions.
@@ -1,3 +1,47 @@
2011-04-11 Anders Carlsson <andersca@apple.com>

Reviewed by Adam Roben.

Remove the WebContext member variable from WebPageProxy
https://bugs.webkit.org/show_bug.cgi?id=58271

* UIProcess/API/C/WKPage.cpp:
(WKPageGetContext):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::create):
(WebKit::WebPageProxy::WebPageProxy):
(WebKit::WebPageProxy::process):
(WebKit::WebPageProxy::reattachToWebProcess):
(WebKit::WebPageProxy::canShowMIMEType):
(WebKit::WebPageProxy::receivedPolicyDecision):
(WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
(WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
(WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
(WebKit::WebPageProxy::didCommitLoadForFrame):
(WebKit::WebPageProxy::didFinishDocumentLoadForFrame):
(WebKit::WebPageProxy::didFinishLoadForFrame):
(WebKit::WebPageProxy::didFailLoadForFrame):
(WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
(WebKit::WebPageProxy::didReceiveTitleForFrame):
(WebKit::WebPageProxy::didFirstLayoutForFrame):
(WebKit::WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame):
(WebKit::WebPageProxy::didRemoveFrameFromHierarchy):
(WebKit::WebPageProxy::didDisplayInsecureContentForFrame):
(WebKit::WebPageProxy::didRunInsecureContentForFrame):
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
(WebKit::WebPageProxy::decidePolicyForNewWindowAction):
(WebKit::WebPageProxy::decidePolicyForResponse):
(WebKit::WebPageProxy::unableToImplementPolicy):
(WebKit::WebPageProxy::willSubmitForm):
(WebKit::WebPageProxy::mouseDidMoveOverElement):
(WebKit::WebPageProxy::showContextMenu):
(WebKit::WebPageProxy::contextMenuItemSelected):
* UIProcess/WebPageProxy.h:
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::createWebPage):
* UIProcess/mac/WebInspectorProxyMac.mm:
(WebKit::WebInspectorProxy::platformCreateInspectorPage):

2011-04-11 Eric Carlson <eric.carlson@apple.com>

Reviewed by Adam Roben.
@@ -32,6 +32,7 @@
#include "WebBackForwardList.h"
#include "WebData.h"
#include "WebPageProxy.h"
#include "WebProcessProxy.h"

#ifdef __BLOCKS__
#include <Block.h>
@@ -46,7 +47,7 @@ WKTypeID WKPageGetTypeID()

WKContextRef WKPageGetContext(WKPageRef pageRef)
{
return toAPI(toImpl(pageRef)->context());
return toAPI(toImpl(pageRef)->process()->context());
}

WKPageGroupRef WKPageGetPageGroup(WKPageRef pageRef)
@@ -100,15 +100,14 @@ WKPageDebugPaintFlags WebPageProxy::s_debugPaintFlags = 0;
static WTF::RefCountedLeakCounter webPageProxyCounter("WebPageProxy");
#endif

PassRefPtr<WebPageProxy> WebPageProxy::create(PageClient* pageClient, PassRefPtr<WebProcessProxy> process, WebContext* context, WebPageGroup* pageGroup, uint64_t pageID)
PassRefPtr<WebPageProxy> WebPageProxy::create(PageClient* pageClient, PassRefPtr<WebProcessProxy> process, WebPageGroup* pageGroup, uint64_t pageID)
{
return adoptRef(new WebPageProxy(pageClient, process, context, pageGroup, pageID));
return adoptRef(new WebPageProxy(pageClient, process, pageGroup, pageID));
}

WebPageProxy::WebPageProxy(PageClient* pageClient, PassRefPtr<WebProcessProxy> process, WebContext* context, WebPageGroup* pageGroup, uint64_t pageID)
WebPageProxy::WebPageProxy(PageClient* pageClient, PassRefPtr<WebProcessProxy> process, WebPageGroup* pageGroup, uint64_t pageID)
: m_pageClient(pageClient)
, m_process(process)
, m_context(context)
, m_pageGroup(pageGroup)
, m_mainFrame(0)
, m_userAgent(standardUserAgent())
@@ -180,7 +179,7 @@ WebPageProxy::~WebPageProxy()

WebProcessProxy* WebPageProxy::process() const
{
return m_context->process();
return m_process.get();
}

bool WebPageProxy::isValid()
@@ -247,7 +246,7 @@ void WebPageProxy::reattachToWebProcess()

m_isValid = true;

m_process = context()->relaunchProcessIfNecessary();
m_process = m_process->context()->relaunchProcessIfNecessary();
process()->addExistingWebPage(this, m_pageID);

initializeWebPage();
@@ -530,7 +529,7 @@ bool WebPageProxy::canShowMIMEType(const String& mimeType) const
return !MIMETypeRegistry::isUnsupportedTextMIMEType(mimeType);

String newMimeType = mimeType;
PluginInfoStore::Plugin plugin = context()->pluginInfoStore()->findPlugin(newMimeType, KURL());
PluginInfoStore::Plugin plugin = m_process->context()->pluginInfoStore()->findPlugin(newMimeType, KURL());
if (!plugin.path.isNull())
return true;

@@ -914,7 +913,7 @@ void WebPageProxy::receivedPolicyDecision(PolicyAction action, WebFrameProxy* fr
uint64_t downloadID = 0;
if (action == PolicyDownload) {
// Create a download proxy.
downloadID = context()->createDownloadProxy();
downloadID = m_process->context()->createDownloadProxy();
}

// If we received a policy decision while in decidePolicyForMIMEType the decision will
@@ -1465,7 +1464,7 @@ void WebPageProxy::didStartProvisionalLoadForFrame(uint64_t frameID, const Strin
clearPendingAPIRequestURL();

RefPtr<APIObject> userData;
WebContextUserMessageDecoder messageDecoder(userData, context());
WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
if (!arguments->decode(messageDecoder))
return;

@@ -1481,7 +1480,7 @@ void WebPageProxy::didStartProvisionalLoadForFrame(uint64_t frameID, const Strin
void WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, const String& url, CoreIPC::ArgumentDecoder* arguments)
{
RefPtr<APIObject> userData;
WebContextUserMessageDecoder messageDecoder(userData, context());
WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
if (!arguments->decode(messageDecoder))
return;

@@ -1496,7 +1495,7 @@ void WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t f
void WebPageProxy::didFailProvisionalLoadForFrame(uint64_t frameID, const ResourceError& error, CoreIPC::ArgumentDecoder* arguments)
{
RefPtr<APIObject> userData;
WebContextUserMessageDecoder messageDecoder(userData, context());
WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
if (!arguments->decode(messageDecoder))
return;

@@ -1524,7 +1523,7 @@ void WebPageProxy::clearLoadDependentCallbacks()
void WebPageProxy::didCommitLoadForFrame(uint64_t frameID, const String& mimeType, bool frameHasCustomRepresentation, const PlatformCertificateInfo& certificateInfo, CoreIPC::ArgumentDecoder* arguments)
{
RefPtr<APIObject> userData;
WebContextUserMessageDecoder messageDecoder(userData, context());
WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
if (!arguments->decode(messageDecoder))
return;

@@ -1550,7 +1549,7 @@ void WebPageProxy::didCommitLoadForFrame(uint64_t frameID, const String& mimeTyp
void WebPageProxy::didFinishDocumentLoadForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
{
RefPtr<APIObject> userData;
WebContextUserMessageDecoder messageDecoder(userData, context());
WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
if (!arguments->decode(messageDecoder))
return;

@@ -1563,7 +1562,7 @@ void WebPageProxy::didFinishDocumentLoadForFrame(uint64_t frameID, CoreIPC::Argu
void WebPageProxy::didFinishLoadForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
{
RefPtr<APIObject> userData;
WebContextUserMessageDecoder messageDecoder(userData, context());
WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
if (!arguments->decode(messageDecoder))
return;

@@ -1578,7 +1577,7 @@ void WebPageProxy::didFinishLoadForFrame(uint64_t frameID, CoreIPC::ArgumentDeco
void WebPageProxy::didFailLoadForFrame(uint64_t frameID, const ResourceError& error, CoreIPC::ArgumentDecoder* arguments)
{
RefPtr<APIObject> userData;
WebContextUserMessageDecoder messageDecoder(userData, context());
WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
if (!arguments->decode(messageDecoder))
return;

@@ -1595,7 +1594,7 @@ void WebPageProxy::didFailLoadForFrame(uint64_t frameID, const ResourceError& er
void WebPageProxy::didSameDocumentNavigationForFrame(uint64_t frameID, uint32_t opaqueSameDocumentNavigationType, const String& url, CoreIPC::ArgumentDecoder* arguments)
{
RefPtr<APIObject> userData;
WebContextUserMessageDecoder messageDecoder(userData, context());
WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
if (!arguments->decode(messageDecoder))
return;

@@ -1610,7 +1609,7 @@ void WebPageProxy::didSameDocumentNavigationForFrame(uint64_t frameID, uint32_t
void WebPageProxy::didReceiveTitleForFrame(uint64_t frameID, const String& title, CoreIPC::ArgumentDecoder* arguments)
{
RefPtr<APIObject> userData;
WebContextUserMessageDecoder messageDecoder(userData, context());
WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
if (!arguments->decode(messageDecoder))
return;

@@ -1625,7 +1624,7 @@ void WebPageProxy::didReceiveTitleForFrame(uint64_t frameID, const String& title
void WebPageProxy::didFirstLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
{
RefPtr<APIObject> userData;
WebContextUserMessageDecoder messageDecoder(userData, context());
WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
if (!arguments->decode(messageDecoder))
return;

@@ -1638,7 +1637,7 @@ void WebPageProxy::didFirstLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDec
void WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
{
RefPtr<APIObject> userData;
WebContextUserMessageDecoder messageDecoder(userData, context());
WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
if (!arguments->decode(messageDecoder))
return;

@@ -1651,7 +1650,7 @@ void WebPageProxy::didFirstVisuallyNonEmptyLayoutForFrame(uint64_t frameID, Core
void WebPageProxy::didRemoveFrameFromHierarchy(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
{
RefPtr<APIObject> userData;
WebContextUserMessageDecoder messageDecoder(userData, context());
WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
if (!arguments->decode(messageDecoder))
return;

@@ -1666,7 +1665,7 @@ void WebPageProxy::didRemoveFrameFromHierarchy(uint64_t frameID, CoreIPC::Argume
void WebPageProxy::didDisplayInsecureContentForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
{
RefPtr<APIObject> userData;
WebContextUserMessageDecoder messageDecoder(userData, context());
WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
if (!arguments->decode(messageDecoder))
return;

@@ -1679,7 +1678,7 @@ void WebPageProxy::didDisplayInsecureContentForFrame(uint64_t frameID, CoreIPC::
void WebPageProxy::didRunInsecureContentForFrame(uint64_t frameID, CoreIPC::ArgumentDecoder* arguments)
{
RefPtr<APIObject> userData;
WebContextUserMessageDecoder messageDecoder(userData, context());
WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
if (!arguments->decode(messageDecoder))
return;

@@ -1703,7 +1702,7 @@ void WebPageProxy::frameDidBecomeFrameSet(uint64_t frameID, bool value)
void WebPageProxy::decidePolicyForNavigationAction(uint64_t frameID, uint32_t opaqueNavigationType, uint32_t opaqueModifiers, int32_t opaqueMouseButton, const ResourceRequest& request, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID)
{
RefPtr<APIObject> userData;
WebContextUserMessageDecoder messageDecoder(userData, context());
WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
if (!arguments->decode(messageDecoder))
return;

@@ -1740,7 +1739,7 @@ void WebPageProxy::decidePolicyForNavigationAction(uint64_t frameID, uint32_t op
void WebPageProxy::decidePolicyForNewWindowAction(uint64_t frameID, uint32_t opaqueNavigationType, uint32_t opaqueModifiers, int32_t opaqueMouseButton, const ResourceRequest& request, const String& frameName, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments)
{
RefPtr<APIObject> userData;
WebContextUserMessageDecoder messageDecoder(userData, context());
WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
if (!arguments->decode(messageDecoder))
return;

@@ -1759,7 +1758,7 @@ void WebPageProxy::decidePolicyForNewWindowAction(uint64_t frameID, uint32_t opa
void WebPageProxy::decidePolicyForResponse(uint64_t frameID, const ResourceResponse& response, const ResourceRequest& request, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments, bool& receivedPolicyAction, uint64_t& policyAction, uint64_t& downloadID)
{
RefPtr<APIObject> userData;
WebContextUserMessageDecoder messageDecoder(userData, context());
WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
if (!arguments->decode(messageDecoder))
return;

@@ -1789,7 +1788,7 @@ void WebPageProxy::decidePolicyForResponse(uint64_t frameID, const ResourceRespo
void WebPageProxy::unableToImplementPolicy(uint64_t frameID, const WebCore::ResourceError& error, CoreIPC::ArgumentDecoder* arguments)
{
RefPtr<APIObject> userData;
WebContextUserMessageDecoder messageDecoder(userData, context());
WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
if (!arguments->decode(messageDecoder))
return;

@@ -1804,7 +1803,7 @@ void WebPageProxy::unableToImplementPolicy(uint64_t frameID, const WebCore::Reso
void WebPageProxy::willSubmitForm(uint64_t frameID, uint64_t sourceFrameID, const StringPairVector& textFieldValues, uint64_t listenerID, CoreIPC::ArgumentDecoder* arguments)
{
RefPtr<APIObject> userData;
WebContextUserMessageDecoder messageDecoder(userData, context());
WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
if (!arguments->decode(messageDecoder))
return;

@@ -1932,7 +1931,7 @@ void WebPageProxy::setStatusText(const String& text)
void WebPageProxy::mouseDidMoveOverElement(uint32_t opaqueModifiers, CoreIPC::ArgumentDecoder* arguments)
{
RefPtr<APIObject> userData;
WebContextUserMessageDecoder messageDecoder(userData, context());
WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
if (!arguments->decode(messageDecoder))
return;

@@ -2241,7 +2240,7 @@ void WebPageProxy::hidePopupMenu()
void WebPageProxy::showContextMenu(const IntPoint& menuLocation, const ContextMenuState& contextMenuState, const Vector<WebContextMenuItemData>& proposedItems, CoreIPC::ArgumentDecoder* arguments)
{
RefPtr<APIObject> userData;
WebContextUserMessageDecoder messageDecoder(userData, context());
WebContextUserMessageDecoder messageDecoder(userData, m_process->context());
if (!arguments->decode(messageDecoder))
return;

@@ -2309,11 +2308,11 @@ void WebPageProxy::contextMenuItemSelected(const WebContextMenuItemData& item)
}
#endif
if (item.action() == ContextMenuItemTagDownloadImageToDisk) {
m_context->download(this, KURL(KURL(), m_activeContextMenuState.absoluteImageURLString));
m_process->context()->download(this, KURL(KURL(), m_activeContextMenuState.absoluteImageURLString));
return;
}
if (item.action() == ContextMenuItemTagDownloadLinkToDisk) {
m_context->download(this, KURL(KURL(), m_activeContextMenuState.absoluteLinkURLString));
m_process->context()->download(this, KURL(KURL(), m_activeContextMenuState.absoluteLinkURLString));
return;
}
if (item.action() == ContextMenuItemTagCheckSpellingWhileTyping) {
@@ -158,7 +158,7 @@ class WebPageProxy : public APIObject, public WebPopupMenuProxy::Client {
public:
static const Type APIType = TypePage;

static PassRefPtr<WebPageProxy> create(PageClient*, PassRefPtr<WebProcessProxy>, WebContext*, WebPageGroup*, uint64_t pageID);
static PassRefPtr<WebPageProxy> create(PageClient*, PassRefPtr<WebProcessProxy>, WebPageGroup*, uint64_t pageID);
virtual ~WebPageProxy();

uint64_t pageID() const { return m_pageID; }
@@ -421,7 +421,6 @@ class WebPageProxy : public APIObject, public WebPopupMenuProxy::Client {
void registerEditCommand(PassRefPtr<WebEditCommandProxy>, UndoOrRedo);

WebProcessProxy* process() const;
WebContext* context() const { return m_context.get(); }

WebPageGroup* pageGroup() const { return m_pageGroup.get(); }

@@ -495,7 +494,7 @@ class WebPageProxy : public APIObject, public WebPopupMenuProxy::Client {
void linkClicked(const String&, const WebMouseEvent&);

private:
WebPageProxy(PageClient*, PassRefPtr<WebProcessProxy>, WebContext*, WebPageGroup*, uint64_t pageID);
WebPageProxy(PageClient*, PassRefPtr<WebProcessProxy>, WebPageGroup*, uint64_t pageID);

virtual Type type() const { return APIType; }

@@ -713,7 +712,6 @@ class WebPageProxy : public APIObject, public WebPopupMenuProxy::Client {

OwnPtr<DrawingAreaProxy> m_drawingArea;
RefPtr<WebProcessProxy> m_process;
RefPtr<WebContext> m_context;
RefPtr<WebPageGroup> m_pageGroup;
RefPtr<WebFrameProxy> m_mainFrame;
RefPtr<WebFrameProxy> m_focusedFrame;
@@ -171,7 +171,7 @@ PassRefPtr<WebPageProxy> WebProcessProxy::createWebPage(PageClient* pageClient,
ASSERT(context->process() == this);

unsigned pageID = generatePageID();
RefPtr<WebPageProxy> webPage = WebPageProxy::create(pageClient, this, context, pageGroup, pageID);
RefPtr<WebPageProxy> webPage = WebPageProxy::create(pageClient, this, pageGroup, pageID);
m_pageMap.set(pageID, webPage.get());
return webPage.release();
}
@@ -31,6 +31,7 @@
#import "WKAPICast.h"
#import "WKView.h"
#import "WebPageProxy.h"
#import "WebProcessProxy.h"
#import <WebKitSystemInterface.h>
#import <WebCore/LocalizedStrings.h>
#import <wtf/text/WTFString.h>
@@ -80,7 +81,7 @@ - (void)windowWillClose:(NSNotification *)notification
ASSERT(m_page);
ASSERT(!m_inspectorView);

m_inspectorView.adoptNS([[WKView alloc] initWithFrame:NSZeroRect contextRef:toAPI(page()->context()) pageGroupRef:toAPI(inspectorPageGroup())]);
m_inspectorView.adoptNS([[WKView alloc] initWithFrame:NSZeroRect contextRef:toAPI(page()->process()->context()) pageGroupRef:toAPI(inspectorPageGroup())]);
ASSERT(m_inspectorView);

[m_inspectorView.get() setDrawsBackground:NO];

0 comments on commit a97f19f

Please sign in to comment.