Title: [88284] trunk
Revision
88284
Author
[email protected]
Date
2011-06-07 16:38:54 -0700 (Tue, 07 Jun 2011)

Log Message

2011-06-07  Sam Weinig  <[email protected]>

        Reviewed by Anders Carlsson.

        Remove repeated IPC traffic from SetRenderTreeSize message
        https://bugs.webkit.org/show_bug.cgi?id=62244

        * WebCore.xcodeproj/project.pbxproj:
        Make RenderArena.h private so it can be called from WebKit2.

        * loader/FrameLoaderClient.h:
        (WebCore::FrameLoaderClient::dispatchDidLayout):
        Added.

        * page/ChromeClient.h:
        Remove setRenderTreeSize.

        * page/FrameView.cpp:
        (WebCore::FrameView::performPostLayoutTasks):
        Call dispatchDidLayout for all frames instead of calling setRenderTreeSize
        for the main frame.
2011-06-07  Sam Weinig  <[email protected]>

        Reviewed by Anders Carlsson.

        Remove repeated IPC traffic from SetRenderTreeSize message
        https://bugs.webkit.org/show_bug.cgi?id=62244

        * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
        Add didLayoutForFrame callback.

        * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
        (WKBundlePageGetRenderTreeSize):
        * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
        Add render tree size getter in WebProcess.

        * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
        (WebKit::InjectedBundlePageLoaderClient::didLayoutForFrame):
        * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
        Added.

        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
        * WebProcess/WebCoreSupport/WebChromeClient.h:
        Removed setRenderTreeSize.

        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
        (WebKit::WebFrameLoaderClient::dispatchDidLayout):
        * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
        Call the new didLayoutForFrame client function.

        * WebProcess/WebPage/WebPage.cpp:
        (WebKit::WebPage::renderTreeSize):
        * WebProcess/WebPage/WebPage.h:
        Add iterative implementation to compute the total size of the render tree
        for a page.
2011-06-07  Sam Weinig  <[email protected]>

        Reviewed by Anders Carlsson.

        Remove repeated IPC traffic from SetRenderTreeSize message
        https://bugs.webkit.org/show_bug.cgi?id=62244

        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
        (WTR::InjectedBundlePage::InjectedBundlePage):
        Add stub for didLayoutForFrame.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (88283 => 88284)


--- trunk/Source/WebCore/ChangeLog	2011-06-07 23:25:46 UTC (rev 88283)
+++ trunk/Source/WebCore/ChangeLog	2011-06-07 23:38:54 UTC (rev 88284)
@@ -1,3 +1,25 @@
+2011-06-07  Sam Weinig  <[email protected]>
+
+        Reviewed by Anders Carlsson.
+
+        Remove repeated IPC traffic from SetRenderTreeSize message
+        https://bugs.webkit.org/show_bug.cgi?id=62244
+
+        * WebCore.xcodeproj/project.pbxproj:
+        Make RenderArena.h private so it can be called from WebKit2.
+
+        * loader/FrameLoaderClient.h:
+        (WebCore::FrameLoaderClient::dispatchDidLayout):
+        Added.
+
+        * page/ChromeClient.h:
+        Remove setRenderTreeSize.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::performPostLayoutTasks):
+        Call dispatchDidLayout for all frames instead of calling setRenderTreeSize
+        for the main frame.
+
 2011-06-07  Emil A Eklund  <[email protected]>
 
         Reviewed by Eric Seidel.

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (88283 => 88284)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2011-06-07 23:25:46 UTC (rev 88283)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2011-06-07 23:38:54 UTC (rev 88284)
@@ -5308,7 +5308,7 @@
 		BCEA485B097D93020094C9E4 /* RenderApplet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA481C097D93020094C9E4 /* RenderApplet.cpp */; };
 		BCEA485C097D93020094C9E4 /* RenderApplet.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA481D097D93020094C9E4 /* RenderApplet.h */; };
 		BCEA485D097D93020094C9E4 /* RenderArena.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA481E097D93020094C9E4 /* RenderArena.cpp */; };
-		BCEA485E097D93020094C9E4 /* RenderArena.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA481F097D93020094C9E4 /* RenderArena.h */; };
+		BCEA485E097D93020094C9E4 /* RenderArena.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA481F097D93020094C9E4 /* RenderArena.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		BCEA485F097D93020094C9E4 /* RenderBlock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA4820097D93020094C9E4 /* RenderBlock.cpp */; };
 		BCEA4860097D93020094C9E4 /* RenderBlock.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEA4821097D93020094C9E4 /* RenderBlock.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		BCEA4861097D93020094C9E4 /* RenderBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEA4822097D93020094C9E4 /* RenderBox.cpp */; };
@@ -5364,7 +5364,7 @@
 		BCFA930810333193007B25D1 /* RenderOverflow.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFA930710333193007B25D1 /* RenderOverflow.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		BCFB2E5E0979E46400BA703D /* CachedResourceClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFB2E5D0979E46400BA703D /* CachedResourceClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		BCFB2F76097A2E1A00BA703D /* Arena.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCFB2F74097A2E1A00BA703D /* Arena.cpp */; };
-		BCFB2F77097A2E1A00BA703D /* Arena.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFB2F75097A2E1A00BA703D /* Arena.h */; };
+		BCFB2F77097A2E1A00BA703D /* Arena.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFB2F75097A2E1A00BA703D /* Arena.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		BCFE2F110C1B58370020235F /* JSRect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCFE2F0F0C1B58370020235F /* JSRect.cpp */; };
 		BCFE2F120C1B58380020235F /* JSRect.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFE2F100C1B58370020235F /* JSRect.h */; };
 		BCFF64910EAD15C200C1D6F7 /* LengthBox.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFF648F0EAD15C200C1D6F7 /* LengthBox.h */; settings = {ATTRIBUTES = (Private, ); }; };

Modified: trunk/Source/WebCore/loader/FrameLoaderClient.h (88283 => 88284)


--- trunk/Source/WebCore/loader/FrameLoaderClient.h	2011-06-07 23:25:46 UTC (rev 88283)
+++ trunk/Source/WebCore/loader/FrameLoaderClient.h	2011-06-07 23:38:54 UTC (rev 88284)
@@ -148,8 +148,10 @@
         virtual void dispatchDidFailLoad(const ResourceError&) = 0;
         virtual void dispatchDidFinishDocumentLoad() = 0;
         virtual void dispatchDidFinishLoad() = 0;
+
         virtual void dispatchDidFirstLayout() = 0;
         virtual void dispatchDidFirstVisuallyNonEmptyLayout() = 0;
+        virtual void dispatchDidLayout() { }
 
         virtual Frame* dispatchCreatePage(const NavigationAction&) = 0;
         virtual void dispatchShow() = 0;

Modified: trunk/Source/WebCore/page/ChromeClient.h (88283 => 88284)


--- trunk/Source/WebCore/page/ChromeClient.h	2011-06-07 23:25:46 UTC (rev 88283)
+++ trunk/Source/WebCore/page/ChromeClient.h	2011-06-07 23:38:54 UTC (rev 88284)
@@ -328,8 +328,6 @@
         virtual void willRunModalDialogDuringPageDismissal(const DialogType&) const { }
 
         virtual void numWheelEventHandlersChanged(unsigned) = 0;
-
-        virtual void setRenderTreeSize(size_t) { }
         
     protected:
         virtual ~ChromeClient() { }

Modified: trunk/Source/WebCore/page/FrameView.cpp (88283 => 88284)


--- trunk/Source/WebCore/page/FrameView.cpp	2011-06-07 23:25:46 UTC (rev 88283)
+++ trunk/Source/WebCore/page/FrameView.cpp	2011-06-07 23:38:54 UTC (rev 88284)
@@ -2048,6 +2048,8 @@
         }
     }
 
+    m_frame->loader()->client()->dispatchDidLayout();
+
     RenderView* root = m_frame->contentRenderer();
 
     root->updateWidgetPositions();
@@ -2069,11 +2071,6 @@
         m_lastZoomFactor = currentZoomFactor;
         if (resized)
             m_frame->eventHandler()->sendResizeEvent();
-
-        if (Page* page = m_frame->page()) {
-            if (m_frame->page()->mainFrame() == m_frame)
-                page->chrome()->client()->setRenderTreeSize(m_frame->document()->renderArena()->totalRenderArenaSize());
-        }
     }
 }
 

Modified: trunk/Source/WebKit2/ChangeLog (88283 => 88284)


--- trunk/Source/WebKit2/ChangeLog	2011-06-07 23:25:46 UTC (rev 88283)
+++ trunk/Source/WebKit2/ChangeLog	2011-06-07 23:38:54 UTC (rev 88284)
@@ -1,3 +1,38 @@
+2011-06-07  Sam Weinig  <[email protected]>
+
+        Reviewed by Anders Carlsson.
+
+        Remove repeated IPC traffic from SetRenderTreeSize message
+        https://bugs.webkit.org/show_bug.cgi?id=62244
+
+        * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
+        Add didLayoutForFrame callback.
+
+        * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
+        (WKBundlePageGetRenderTreeSize):
+        * WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h:
+        Add render tree size getter in WebProcess.
+
+        * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
+        (WebKit::InjectedBundlePageLoaderClient::didLayoutForFrame):
+        * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
+        Added.
+
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+        Removed setRenderTreeSize.
+
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::dispatchDidLayout):
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
+        Call the new didLayoutForFrame client function.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::renderTreeSize):
+        * WebProcess/WebPage/WebPage.h:
+        Add iterative implementation to compute the total size of the render tree
+        for a page.
+
 2011-06-07  Zalan Bujtas  <[email protected]>
 
         Reviewed by Andreas Kling.

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (88283 => 88284)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2011-06-07 23:25:46 UTC (rev 88283)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2011-06-07 23:38:54 UTC (rev 88284)
@@ -178,6 +178,7 @@
     , m_mainFrameHasVerticalScrollbar(false)
     , m_mainFrameIsPinnedToLeftSide(false)
     , m_mainFrameIsPinnedToRightSide(false)
+    , m_renderTreeSize(0)
 {
 #ifndef NDEBUG
     webPageProxyCounter.increment();

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp (88283 => 88284)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp	2011-06-07 23:25:46 UTC (rev 88283)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp	2011-06-07 23:38:54 UTC (rev 88284)
@@ -281,3 +281,8 @@
 {
     toImpl(page)->simulateMouseMotion(toIntPoint(position), time);
 }
+
+uint64_t WKBundlePageGetRenderTreeSize(WKBundlePageRef pageRef)
+{
+    return toImpl(pageRef)->renderTreeSize();
+}

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h (88283 => 88284)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h	2011-06-07 23:25:46 UTC (rev 88283)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h	2011-06-07 23:38:54 UTC (rev 88284)
@@ -89,12 +89,12 @@
 typedef void (*WKBundlePageDidFailLoadWithErrorForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKErrorRef error, WKTypeRef* userData, const void *clientInfo);
 typedef void (*WKBundlePageDidSameDocumentNavigationForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKSameDocumentNavigationType type, WKTypeRef* userData, const void *clientInfo);
 typedef void (*WKBundlePageDidReceiveTitleForFrameCallback)(WKBundlePageRef page, WKStringRef title, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
-typedef void (*WKBundlePageDidFirstLayoutForFrame)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
-typedef void (*WKBundlePageDidFirstVisuallyNonEmptyLayoutForFrame)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
 typedef void (*WKBundlePageDidRemoveFrameFromHierarchyCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
 typedef void (*WKBundlePageDidDisplayInsecureContentForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
 typedef void (*WKBundlePageDidRunInsecureContentForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
-// FIXME: There are no WKPage equivilent of these functions yet.
+typedef void (*WKBundlePageDidFirstLayoutForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
+typedef void (*WKBundlePageDidFirstVisuallyNonEmptyLayoutForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKTypeRef* userData, const void *clientInfo);
+typedef void (*WKBundlePageDidLayoutForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, const void* clientInfo);
 typedef void (*WKBundlePageDidClearWindowObjectForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKBundleScriptWorldRef world, const void *clientInfo);
 typedef void (*WKBundlePageDidCancelClientRedirectForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, const void *clientInfo);
 typedef void (*WKBundlePageWillPerformClientRedirectForFrameCallback)(WKBundlePageRef page, WKBundleFrameRef frame, WKURLRef url, double delay, double date, const void *clientInfo);
@@ -112,17 +112,16 @@
     WKBundlePageDidFailLoadWithErrorForFrameCallback                    didFailLoadWithErrorForFrame;
     WKBundlePageDidSameDocumentNavigationForFrameCallback               didSameDocumentNavigationForFrame;
     WKBundlePageDidReceiveTitleForFrameCallback                         didReceiveTitleForFrame;
-    WKBundlePageDidFirstLayoutForFrame                                  didFirstLayoutForFrame;
-    WKBundlePageDidFirstVisuallyNonEmptyLayoutForFrame                  didFirstVisuallyNonEmptyLayoutForFrame;
+    WKBundlePageDidFirstLayoutForFrameCallback                          didFirstLayoutForFrame;
+    WKBundlePageDidFirstVisuallyNonEmptyLayoutForFrameCallback          didFirstVisuallyNonEmptyLayoutForFrame;
     WKBundlePageDidRemoveFrameFromHierarchyCallback                     didRemoveFrameFromHierarchy;
     WKBundlePageDidDisplayInsecureContentForFrameCallback               didDisplayInsecureContentForFrame;
     WKBundlePageDidRunInsecureContentForFrameCallback                   didRunInsecureContentForFrame;
-
-    // FIXME: There are no WKPage equivilent of these functions yet.
     WKBundlePageDidClearWindowObjectForFrameCallback                    didClearWindowObjectForFrame;
     WKBundlePageDidCancelClientRedirectForFrameCallback                 didCancelClientRedirectForFrame;
     WKBundlePageWillPerformClientRedirectForFrameCallback               willPerformClientRedirectForFrame;
     WKBundlePageDidHandleOnloadEventsForFrameCallback                   didHandleOnloadEventsForFrame;
+    WKBundlePageDidLayoutForFrameCallback                               didLayoutForFrame;
 };
 typedef struct WKBundlePageLoaderClient WKBundlePageLoaderClient;
 
@@ -189,10 +188,10 @@
 typedef void (*WKBundlePagePaintCustomOverhangAreaCallback)(WKBundlePageRef page, WKGraphicsContextRef graphicsContext, WKRect horizontalOverhang, WKRect verticalOverhang, WKRect dirtyRect, const void* clientInfo);
 typedef WKStringRef (*WKBundlePageGenerateFileForUploadCallback)(WKBundlePageRef page, WKStringRef originalFilePath, const void* clientInfo);
 typedef bool (*WKBundlePageShouldRubberBandInDirectionCallback)(WKBundlePageRef page, WKScrollDirection scrollDirection, const void* clientInfo);
-typedef WKBundlePageUIElementVisibility (*WKBundlePageStatusBarIsVisible)(WKBundlePageRef page, const void *clientInfo);
-typedef WKBundlePageUIElementVisibility (*WKBundlePageMenuBarIsVisible)(WKBundlePageRef page, const void *clientInfo);
-typedef WKBundlePageUIElementVisibility (*WKBundlePageToolbarsAreVisible)(WKBundlePageRef page, const void *clientInfo);
-    
+typedef WKBundlePageUIElementVisibility (*WKBundlePageStatusBarIsVisibleCallback)(WKBundlePageRef page, const void *clientInfo);
+typedef WKBundlePageUIElementVisibility (*WKBundlePageMenuBarIsVisibleCallback)(WKBundlePageRef page, const void *clientInfo);
+typedef WKBundlePageUIElementVisibility (*WKBundlePageToolbarsAreVisibleCallback)(WKBundlePageRef page, const void *clientInfo);
+
 struct WKBundlePageUIClient {
     int                                                                 version;
     const void *                                                        clientInfo;
@@ -207,9 +206,9 @@
     WKBundlePageGenerateFileForUploadCallback                           shouldGenerateFileForUpload;
     WKBundlePageGenerateFileForUploadCallback                           generateFileForUpload;
     WKBundlePageShouldRubberBandInDirectionCallback                     shouldRubberBandInDirection;
-    WKBundlePageStatusBarIsVisible                                      statusBarIsVisible;
-    WKBundlePageMenuBarIsVisible                                        menuBarIsVisible;
-    WKBundlePageToolbarsAreVisible                                      toolbarsAreVisible;
+    WKBundlePageStatusBarIsVisibleCallback                              statusBarIsVisible;
+    WKBundlePageMenuBarIsVisibleCallback                                menuBarIsVisible;
+    WKBundlePageToolbarsAreVisibleCallback                              toolbarsAreVisible;
 };
 typedef struct WKBundlePageUIClient WKBundlePageUIClient;
 

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h (88283 => 88284)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h	2011-06-07 23:25:46 UTC (rev 88283)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h	2011-06-07 23:38:54 UTC (rev 88284)
@@ -53,6 +53,8 @@
 WK_EXPORT void WKBundlePageSimulateMouseUp(WKBundlePageRef page, int button, WKPoint position, int clickCount, WKEventModifiers modifiers, double time);
 WK_EXPORT void WKBundlePageSimulateMouseMotion(WKBundlePageRef page, WKPoint position, double time);
 
+WK_EXPORT uint64_t WKBundlePageGetRenderTreeSize(WKBundlePageRef page);
+
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp (88283 => 88284)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp	2011-06-07 23:25:46 UTC (rev 88283)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp	2011-06-07 23:38:54 UTC (rev 88284)
@@ -126,56 +126,65 @@
     userData = adoptRef(toImpl(userDataToPass));
 }
 
-void InjectedBundlePageLoaderClient::didFirstLayoutForFrame(WebPage* page, WebFrame* frame, RefPtr<APIObject>& userData)
+void InjectedBundlePageLoaderClient::didRemoveFrameFromHierarchy(WebPage* page , WebFrame* frame, RefPtr<APIObject>& userData)
 {
-    if (!m_client.didFirstLayoutForFrame)
+    if (!m_client.didRemoveFrameFromHierarchy)
         return;
 
     WKTypeRef userDataToPass = 0;
-    m_client.didFirstLayoutForFrame(toAPI(page), toAPI(frame), &userDataToPass, m_client.clientInfo);
+    m_client.didRemoveFrameFromHierarchy(toAPI(page), toAPI(frame), &userDataToPass, m_client.clientInfo);
     userData = adoptRef(toImpl(userDataToPass));
 }
 
-void InjectedBundlePageLoaderClient::didFirstVisuallyNonEmptyLayoutForFrame(WebPage* page, WebFrame* frame, RefPtr<APIObject>& userData)
+void InjectedBundlePageLoaderClient::didDisplayInsecureContentForFrame(WebPage* page, WebFrame* frame, RefPtr<APIObject>& userData)
 {
-    if (!m_client.didFirstVisuallyNonEmptyLayoutForFrame)
+    if (!m_client.didDisplayInsecureContentForFrame)
         return;
 
     WKTypeRef userDataToPass = 0;
-    m_client.didFirstVisuallyNonEmptyLayoutForFrame(toAPI(page), toAPI(frame), &userDataToPass, m_client.clientInfo);
+    m_client.didDisplayInsecureContentForFrame(toAPI(page), toAPI(frame), &userDataToPass, m_client.clientInfo);
     userData = adoptRef(toImpl(userDataToPass));
 }
 
-void InjectedBundlePageLoaderClient::didRemoveFrameFromHierarchy(WebPage* page , WebFrame* frame, RefPtr<APIObject>& userData)
+void InjectedBundlePageLoaderClient::didRunInsecureContentForFrame(WebPage* page, WebFrame* frame, RefPtr<APIObject>& userData)
 {
-    if (!m_client.didRemoveFrameFromHierarchy)
+    if (!m_client.didRunInsecureContentForFrame)
         return;
 
     WKTypeRef userDataToPass = 0;
-    m_client.didRemoveFrameFromHierarchy(toAPI(page), toAPI(frame), &userDataToPass, m_client.clientInfo);
+    m_client.didRunInsecureContentForFrame(toAPI(page), toAPI(frame), &userDataToPass, m_client.clientInfo);
     userData = adoptRef(toImpl(userDataToPass));
 }
 
-void InjectedBundlePageLoaderClient::didDisplayInsecureContentForFrame(WebPage* page, WebFrame* frame, RefPtr<APIObject>& userData)
+void InjectedBundlePageLoaderClient::didFirstLayoutForFrame(WebPage* page, WebFrame* frame, RefPtr<APIObject>& userData)
 {
-    if (!m_client.didDisplayInsecureContentForFrame)
+    if (!m_client.didFirstLayoutForFrame)
         return;
 
     WKTypeRef userDataToPass = 0;
-    m_client.didDisplayInsecureContentForFrame(toAPI(page), toAPI(frame), &userDataToPass, m_client.clientInfo);
+    m_client.didFirstLayoutForFrame(toAPI(page), toAPI(frame), &userDataToPass, m_client.clientInfo);
     userData = adoptRef(toImpl(userDataToPass));
 }
 
-void InjectedBundlePageLoaderClient::didRunInsecureContentForFrame(WebPage* page, WebFrame* frame, RefPtr<APIObject>& userData)
+void InjectedBundlePageLoaderClient::didFirstVisuallyNonEmptyLayoutForFrame(WebPage* page, WebFrame* frame, RefPtr<APIObject>& userData)
 {
-    if (!m_client.didRunInsecureContentForFrame)
+    if (!m_client.didFirstVisuallyNonEmptyLayoutForFrame)
         return;
 
     WKTypeRef userDataToPass = 0;
-    m_client.didRunInsecureContentForFrame(toAPI(page), toAPI(frame), &userDataToPass, m_client.clientInfo);
+    m_client.didFirstVisuallyNonEmptyLayoutForFrame(toAPI(page), toAPI(frame), &userDataToPass, m_client.clientInfo);
     userData = adoptRef(toImpl(userDataToPass));
 }
 
+
+void InjectedBundlePageLoaderClient::didLayoutForFrame(WebPage* page, WebFrame* frame)
+{
+    if (!m_client.didLayoutForFrame)
+        return;
+
+    m_client.didLayoutForFrame(toAPI(page), toAPI(frame), m_client.clientInfo);
+}
+
 void InjectedBundlePageLoaderClient::didClearWindowObjectForFrame(WebPage* page, WebFrame* frame, DOMWrapperWorld* world)
 {
     if (!m_client.didClearWindowObjectForFrame)

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h (88283 => 88284)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h	2011-06-07 23:25:46 UTC (rev 88283)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h	2011-06-07 23:38:54 UTC (rev 88284)
@@ -56,12 +56,14 @@
     void didFailLoadWithErrorForFrame(WebPage*, WebFrame*, const WebCore::ResourceError&, RefPtr<APIObject>& userData);
     void didSameDocumentNavigationForFrame(WebPage*, WebFrame*, SameDocumentNavigationType, RefPtr<APIObject>& userData);
     void didReceiveTitleForFrame(WebPage*, const String&, WebFrame*, RefPtr<APIObject>& userData);
-    void didFirstLayoutForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData);
-    void didFirstVisuallyNonEmptyLayoutForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData);
     void didRemoveFrameFromHierarchy(WebPage*, WebFrame*, RefPtr<APIObject>& userData);
     void didDisplayInsecureContentForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData);
     void didRunInsecureContentForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData);
 
+    void didFirstLayoutForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData);
+    void didFirstVisuallyNonEmptyLayoutForFrame(WebPage*, WebFrame*, RefPtr<APIObject>& userData);
+    void didLayoutForFrame(WebPage*, WebFrame*);
+
     void didClearWindowObjectForFrame(WebPage*, WebFrame*, WebCore::DOMWrapperWorld*);
     void didCancelClientRedirectForFrame(WebPage*, WebFrame*);
     void willPerformClientRedirectForFrame(WebPage*, WebFrame*, const String& url, double delay, double date);

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (88283 => 88284)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2011-06-07 23:25:46 UTC (rev 88283)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2011-06-07 23:38:54 UTC (rev 88284)
@@ -815,9 +815,4 @@
     m_page->send(Messages::WebPageProxy::NumWheelEventHandlersChanged(count));
 }
 
-void WebChromeClient::setRenderTreeSize(size_t treeSize)
-{
-    m_page->send(Messages::WebPageProxy::SetRenderTreeSize(treeSize));
-}
-
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (88283 => 88284)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h	2011-06-07 23:25:46 UTC (rev 88283)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h	2011-06-07 23:38:54 UTC (rev 88284)
@@ -230,8 +230,6 @@
     
     virtual void numWheelEventHandlersChanged(unsigned);
 
-    virtual void setRenderTreeSize(size_t);
-
     String m_cachedToolTip;
     mutable RefPtr<WebFrame> m_cachedFrameSetLargestFrame;
     mutable bool m_cachedMainFrameHasHorizontalScrollbar;

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (88283 => 88284)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2011-06-07 23:25:46 UTC (rev 88283)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2011-06-07 23:38:54 UTC (rev 88284)
@@ -555,6 +555,23 @@
     webPage->send(Messages::WebPageProxy::DidFirstVisuallyNonEmptyLayoutForFrame(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get())));
 }
 
+void WebFrameLoaderClient::dispatchDidLayout()
+{
+    WebPage* webPage = m_frame->page();
+    if (!webPage)
+        return;
+
+    // Notify the bundle client.
+    webPage->injectedBundleLoaderClient().didLayoutForFrame(webPage, m_frame);
+
+    // NOTE: Unlike the other layout notifications, this does not notify the
+    // the UIProcess for every call.
+
+    // FIXME: Remove at the soonest possible time.
+    if (m_frame == m_frame->page()->mainFrame())
+        webPage->send(Messages::WebPageProxy::SetRenderTreeSize(webPage->renderTreeSize()));
+}
+
 Frame* WebFrameLoaderClient::dispatchCreatePage(const NavigationAction& navigationAction)
 {
     WebPage* webPage = m_frame->page();

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h (88283 => 88284)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h	2011-06-07 23:25:46 UTC (rev 88283)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h	2011-06-07 23:38:54 UTC (rev 88284)
@@ -91,9 +91,11 @@
     virtual void dispatchDidFailLoad(const WebCore::ResourceError&);
     virtual void dispatchDidFinishDocumentLoad();
     virtual void dispatchDidFinishLoad();
+
     virtual void dispatchDidFirstLayout();
     virtual void dispatchDidFirstVisuallyNonEmptyLayout();
-    
+    virtual void dispatchDidLayout();
+
     virtual WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&);
     virtual void dispatchShow();
     

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (88283 => 88284)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2011-06-07 23:25:46 UTC (rev 88283)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2011-06-07 23:38:54 UTC (rev 88284)
@@ -92,6 +92,7 @@
 #include <WebCore/Page.h>
 #include <WebCore/PlatformKeyboardEvent.h>
 #include <WebCore/PrintContext.h>
+#include <WebCore/RenderArena.h>
 #include <WebCore/RenderLayer.h>
 #include <WebCore/RenderTreeAsText.h>
 #include <WebCore/RenderView.h>
@@ -362,6 +363,22 @@
     return externalRepresentation(m_mainFrame->coreFrame(), RenderAsTextBehaviorNormal);
 }
 
+uint64_t WebPage::renderTreeSize() const
+{
+    if (!m_page)
+        return 0;
+
+    Frame* mainFrame = m_page->mainFrame();
+    if (!mainFrame)
+        return 0;
+
+    uint64_t size = 0;
+    for (Frame* coreFrame = mainFrame; coreFrame; coreFrame = coreFrame->tree()->traverseNext())
+        size += coreFrame->document()->renderArena()->totalRenderArenaSize();
+
+    return size;
+}
+
 void WebPage::executeEditingCommand(const String& commandName, const String& argument)
 {
     Frame* frame = m_page->focusController()->focusedOrMainFrame();

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (88283 => 88284)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2011-06-07 23:25:46 UTC (rev 88283)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2011-06-07 23:38:54 UTC (rev 88284)
@@ -222,6 +222,8 @@
     EditorState editorState() const;
 
     String renderTreeExternalRepresentation() const;
+    uint64_t renderTreeSize() const;
+
     void executeEditingCommand(const String& commandName, const String& argument);
     bool isEditingCommandEnabled(const String& commandName);
     void clearMainFrameName();

Modified: trunk/Tools/ChangeLog (88283 => 88284)


--- trunk/Tools/ChangeLog	2011-06-07 23:25:46 UTC (rev 88283)
+++ trunk/Tools/ChangeLog	2011-06-07 23:38:54 UTC (rev 88284)
@@ -1,3 +1,14 @@
+2011-06-07  Sam Weinig  <[email protected]>
+
+        Reviewed by Anders Carlsson.
+
+        Remove repeated IPC traffic from SetRenderTreeSize message
+        https://bugs.webkit.org/show_bug.cgi?id=62244
+
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+        (WTR::InjectedBundlePage::InjectedBundlePage):
+        Add stub for didLayoutForFrame.
+
 2011-06-07  Dirk Pranke  <[email protected]>
 
         Reviewed by Tony Chang.

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp (88283 => 88284)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2011-06-07 23:25:46 UTC (rev 88283)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2011-06-07 23:38:54 UTC (rev 88284)
@@ -178,15 +178,16 @@
         didFailLoadWithErrorForFrame,
         didSameDocumentNavigationForFrame,
         didReceiveTitleForFrame,
-        0,
-        0,
-        0,
+        0, // didFirstLayoutForFrame
+        0, // didFirstVisuallyNonEmptyLayoutForFrame
+        0, // didRemoveFrameFromHierarchy
         didDisplayInsecureContentForFrame,
         didRunInsecureContentForFrame,
         didClearWindowForFrame,
         didCancelClientRedirectForFrame,
         willPerformClientRedirectForFrame,
         didHandleOnloadEventsForFrame,
+        0, // didLayoutForFrame
     };
     WKBundlePageSetPageLoaderClient(m_page, &loaderClient);
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to