Title: [112191] trunk/Source
Revision
112191
Author
[email protected]
Date
2012-03-26 19:01:42 -0700 (Mon, 26 Mar 2012)

Log Message

[chromium] Add isInputThrottled/didBecomeReadyForAdditionalInput to WebWidget
https://bugs.webkit.org/show_bug.cgi?id=82265

Source/Platform:

Reviewed by James Robinson.

* chromium/public/WebLayerTreeView.h:
(WebLayerTreeView):
* chromium/public/WebLayerTreeViewClient.h:
(WebLayerTreeViewClient):
(WebKit::WebLayerTreeViewClient::didCommit):

Source/WebCore:

In threaded compositing mode, the WebWidget is self-scheduled,
receiving damage and processing it without forwarding that damage
up to the embedding WebWidgetClient. In Chromium's case, the
client uses the presence of damage to perform input flow
control. This patch exposes the need for input flow control to the
embedder, while keeping the actual logic about what exactly
warrants input flow control inside the implementation.

Reviewed by James Robinson.

* platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
(WebCore::CCLayerTreeHost::commitComplete):
(WebCore::CCLayerTreeHost::commitRequested):
(WebCore):
* platform/graphics/chromium/cc/CCLayerTreeHost.h:
(CCLayerTreeHostClient):
(CCLayerTreeHost):
* platform/graphics/chromium/cc/CCProxy.h:
(CCProxy):
* platform/graphics/chromium/cc/CCSingleThreadProxy.cpp:
(WebCore::CCSingleThreadProxy::commitRequested):
(WebCore):
* platform/graphics/chromium/cc/CCSingleThreadProxy.h:
(CCSingleThreadProxy):
* platform/graphics/chromium/cc/CCThreadProxy.cpp:
(WebCore::CCThreadProxy::commitRequested):
(WebCore):
* platform/graphics/chromium/cc/CCThreadProxy.h:
(CCThreadProxy):

Source/WebKit/chromium:

In threaded compositing mode, the WebWidget is self-scheduled,
receiving damage and processing it without forwarding that damage
up to the embedding WebWidgetClient. In Chromium's case, the
client uses the presence of damage to perform input flow
control. This patch exposes the need for input flow control to the
embedder, while keeping the actual logic about what exactly
warrants input flow control inside the implementation.

Reviewed by James Robinson.

* public/WebWidget.h:
(WebWidget):
(WebKit::WebWidget::isInputThrottled):
* public/WebWidgetClient.h:
(WebWidgetClient):
(WebKit::WebWidgetClient::didBecomeReadyForAdditionalInput):
* src/WebLayerTreeView.cpp:
(WebKit::WebLayerTreeView::commitRequested):
(WebKit):
* src/WebLayerTreeViewImpl.cpp:
(WebKit::WebLayerTreeViewImpl::didCommit):
(WebKit):
* src/WebLayerTreeViewImpl.h:
(WebLayerTreeViewImpl):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::isInputThrottled):
(WebKit):
(WebKit::WebViewImpl::didCommit):
* src/WebViewImpl.h:
(WebViewImpl):
* tests/CCLayerTreeHostTest.cpp:
(WTF::MockLayerTreeHostClient::didCommit):
(MockLayerTreeHostClient):
* tests/FakeCCLayerTreeHostClient.h:
(FakeCCLayerTreeHostClient):

Modified Paths

Diff

Modified: trunk/Source/Platform/ChangeLog (112190 => 112191)


--- trunk/Source/Platform/ChangeLog	2012-03-27 01:59:06 UTC (rev 112190)
+++ trunk/Source/Platform/ChangeLog	2012-03-27 02:01:42 UTC (rev 112191)
@@ -1,3 +1,16 @@
+2012-03-26  Nat Duca  <[email protected]>
+
+        [chromium] Add isInputThrottled/didBecomeReadyForAdditionalInput to WebWidget
+        https://bugs.webkit.org/show_bug.cgi?id=82265
+
+        Reviewed by James Robinson.
+
+        * chromium/public/WebLayerTreeView.h:
+        (WebLayerTreeView):
+        * chromium/public/WebLayerTreeViewClient.h:
+        (WebLayerTreeViewClient):
+        (WebKit::WebLayerTreeViewClient::didCommit):
+
 2012-03-25  Nat Duca  <[email protected]>
 
         [chromium] Route willBeginFrame from compositor to WebWidget

Modified: trunk/Source/Platform/chromium/public/WebLayerTreeView.h (112190 => 112191)


--- trunk/Source/Platform/chromium/public/WebLayerTreeView.h	2012-03-27 01:59:06 UTC (rev 112190)
+++ trunk/Source/Platform/chromium/public/WebLayerTreeView.h	2012-03-27 02:01:42 UTC (rev 112191)
@@ -129,6 +129,9 @@
     // Indicates that the view needs to be redrawn. This is typically used when the frontbuffer is damaged.
     WEBKIT_EXPORT void setNeedsRedraw();
 
+    // Indicates whether a commit is pending.
+    WEBKIT_EXPORT bool commitRequested() const;
+
     // Triggers a compositing pass. If the compositor thread was not
     // enabled via WebCompositor::initialize, the compositing pass happens
     // immediately. If it is enabled, the compositing pass will happen at a

Modified: trunk/Source/Platform/chromium/public/WebLayerTreeViewClient.h (112190 => 112191)


--- trunk/Source/Platform/chromium/public/WebLayerTreeViewClient.h	2012-03-27 01:59:06 UTC (rev 112190)
+++ trunk/Source/Platform/chromium/public/WebLayerTreeViewClient.h	2012-03-27 02:01:42 UTC (rev 112191)
@@ -59,7 +59,18 @@
     // context event).
     virtual void didRebindGraphicsContext(bool success) = 0;
 
+    // Indicates that a frame was committed to the impl side of the compositor
+    // for rendering.
+    //
+    // FIXME: make this non-virtual when ui/compositor DEP is resolved.
+    virtual void didCommit() { }
+
+    // Indicates that a frame was committed to the impl side and drawing
+    // commands for it were issued to the GPU.
     virtual void didCommitAndDrawFrame() = 0;
+
+    // Indicates that a frame previously issued to the GPU has completed
+    // rendering.
     virtual void didCompleteSwapBuffers() = 0;
 
     // Schedules a compositing pass, meaning the client should call

Modified: trunk/Source/WebCore/ChangeLog (112190 => 112191)


--- trunk/Source/WebCore/ChangeLog	2012-03-27 01:59:06 UTC (rev 112190)
+++ trunk/Source/WebCore/ChangeLog	2012-03-27 02:01:42 UTC (rev 112191)
@@ -1,3 +1,38 @@
+2012-03-26  Nat Duca  <[email protected]>
+
+        [chromium] Add isInputThrottled/didBecomeReadyForAdditionalInput to WebWidget
+        https://bugs.webkit.org/show_bug.cgi?id=82265
+
+        In threaded compositing mode, the WebWidget is self-scheduled,
+        receiving damage and processing it without forwarding that damage
+        up to the embedding WebWidgetClient. In Chromium's case, the
+        client uses the presence of damage to perform input flow
+        control. This patch exposes the need for input flow control to the
+        embedder, while keeping the actual logic about what exactly
+        warrants input flow control inside the implementation.
+
+        Reviewed by James Robinson.
+
+        * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
+        (WebCore::CCLayerTreeHost::commitComplete):
+        (WebCore::CCLayerTreeHost::commitRequested):
+        (WebCore):
+        * platform/graphics/chromium/cc/CCLayerTreeHost.h:
+        (CCLayerTreeHostClient):
+        (CCLayerTreeHost):
+        * platform/graphics/chromium/cc/CCProxy.h:
+        (CCProxy):
+        * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp:
+        (WebCore::CCSingleThreadProxy::commitRequested):
+        (WebCore):
+        * platform/graphics/chromium/cc/CCSingleThreadProxy.h:
+        (CCSingleThreadProxy):
+        * platform/graphics/chromium/cc/CCThreadProxy.cpp:
+        (WebCore::CCThreadProxy::commitRequested):
+        (WebCore):
+        * platform/graphics/chromium/cc/CCThreadProxy.h:
+        (CCThreadProxy):
+
 2012-03-26  Adam Barth  <[email protected]>
 
         When <img crossorigin> fails the CORS check, we should fire the error event

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp (112190 => 112191)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp	2012-03-27 01:59:06 UTC (rev 112190)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp	2012-03-27 02:01:42 UTC (rev 112191)
@@ -233,6 +233,7 @@
     m_deleteTextureAfterCommitList.clear();
     clearPendingUpdate();
     m_contentsTextureManager->unprotectAllTextures();
+    m_client->didCommit();
 }
 
 PassRefPtr<GraphicsContext3D> CCLayerTreeHost::createContext()
@@ -310,6 +311,11 @@
         m_client->scheduleComposite();
 }
 
+bool CCLayerTreeHost::commitRequested() const
+{
+    return m_proxy->commitRequested();
+}
+
 void CCLayerTreeHost::setAnimationEvents(PassOwnPtr<CCAnimationEventsVector> events, double wallClockTime)
 {
     ASSERT(CCThreadProxy::isMainThread());

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h (112190 => 112191)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h	2012-03-27 01:59:06 UTC (rev 112190)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h	2012-03-27 02:01:42 UTC (rev 112191)
@@ -58,6 +58,7 @@
     virtual void applyScrollAndScale(const IntSize& scrollDelta, float pageScale) = 0;
     virtual PassRefPtr<GraphicsContext3D> createContext() = 0;
     virtual void didRecreateContext(bool success) = 0;
+    virtual void didCommit() = 0;
     virtual void didCommitAndDrawFrame() = 0;
     virtual void didCompleteSwapBuffers() = 0;
 
@@ -184,6 +185,7 @@
     // virtual for testing
     virtual void setNeedsCommit();
     void setNeedsRedraw();
+    bool commitRequested() const;
 
     void setAnimationEvents(PassOwnPtr<CCAnimationEventsVector>, double wallClockTime);
 

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h (112190 => 112191)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h	2012-03-27 01:59:06 UTC (rev 112190)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h	2012-03-27 02:01:42 UTC (rev 112191)
@@ -86,6 +86,8 @@
     virtual void setNeedsRedraw() = 0;
     virtual void setVisible(bool) = 0;
 
+    virtual bool commitRequested() const = 0;
+
     virtual void start() = 0; // Must be called before using the proxy.
     virtual void stop() = 0; // Must be called before deleting the proxy.
 

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp (112190 => 112191)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp	2012-03-27 01:59:06 UTC (rev 112190)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp	2012-03-27 02:01:42 UTC (rev 112191)
@@ -236,6 +236,11 @@
     setNeedsCommit();
 }
 
+bool CCSingleThreadProxy::commitRequested() const
+{
+    return false;
+}
+
 void CCSingleThreadProxy::setVisible(bool visible)
 {
     m_layerTreeHostImpl->setVisible(visible);

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h (112190 => 112191)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h	2012-03-27 01:59:06 UTC (rev 112190)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h	2012-03-27 02:01:42 UTC (rev 112191)
@@ -56,6 +56,7 @@
     virtual void setNeedsAnimate();
     virtual void setNeedsCommit();
     virtual void setNeedsRedraw();
+    virtual bool commitRequested() const;
     virtual void setVisible(bool);
     virtual void start();
     virtual void stop();

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp (112190 => 112191)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp	2012-03-27 01:59:06 UTC (rev 112190)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp	2012-03-27 02:01:42 UTC (rev 112191)
@@ -314,6 +314,12 @@
     CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::setNeedsRedrawOnImplThread));
 }
 
+bool CCThreadProxy::commitRequested() const
+{
+    ASSERT(isMainThread());
+    return m_commitRequested;
+}
+
 void CCThreadProxy::setVisible(bool visible)
 {
     ASSERT(isMainThread());

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h (112190 => 112191)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h	2012-03-27 01:59:06 UTC (rev 112190)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h	2012-03-27 02:01:42 UTC (rev 112191)
@@ -65,6 +65,7 @@
     virtual void setNeedsAnimate();
     virtual void setNeedsCommit();
     virtual void setNeedsRedraw();
+    virtual bool commitRequested() const;
     virtual void setVisible(bool);
     virtual void start();
     virtual void stop();

Modified: trunk/Source/WebKit/chromium/ChangeLog (112190 => 112191)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-03-27 01:59:06 UTC (rev 112190)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-03-27 02:01:42 UTC (rev 112191)
@@ -1,3 +1,44 @@
+2012-03-26  Nat Duca  <[email protected]>
+
+        [chromium] Add isInputThrottled/didBecomeReadyForAdditionalInput to WebWidget
+        https://bugs.webkit.org/show_bug.cgi?id=82265
+
+        In threaded compositing mode, the WebWidget is self-scheduled,
+        receiving damage and processing it without forwarding that damage
+        up to the embedding WebWidgetClient. In Chromium's case, the
+        client uses the presence of damage to perform input flow
+        control. This patch exposes the need for input flow control to the
+        embedder, while keeping the actual logic about what exactly
+        warrants input flow control inside the implementation.
+
+        Reviewed by James Robinson.
+
+        * public/WebWidget.h:
+        (WebWidget):
+        (WebKit::WebWidget::isInputThrottled):
+        * public/WebWidgetClient.h:
+        (WebWidgetClient):
+        (WebKit::WebWidgetClient::didBecomeReadyForAdditionalInput):
+        * src/WebLayerTreeView.cpp:
+        (WebKit::WebLayerTreeView::commitRequested):
+        (WebKit):
+        * src/WebLayerTreeViewImpl.cpp:
+        (WebKit::WebLayerTreeViewImpl::didCommit):
+        (WebKit):
+        * src/WebLayerTreeViewImpl.h:
+        (WebLayerTreeViewImpl):
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::isInputThrottled):
+        (WebKit):
+        (WebKit::WebViewImpl::didCommit):
+        * src/WebViewImpl.h:
+        (WebViewImpl):
+        * tests/CCLayerTreeHostTest.cpp:
+        (WTF::MockLayerTreeHostClient::didCommit):
+        (MockLayerTreeHostClient):
+        * tests/FakeCCLayerTreeHostClient.h:
+        (FakeCCLayerTreeHostClient):
+
 2012-03-26  Vangelis Kokkevis  <[email protected]>
 
         [chromium] Simplify and fix CCLayerSorter

Modified: trunk/Source/WebKit/chromium/public/WebWidget.h (112190 => 112191)


--- trunk/Source/WebKit/chromium/public/WebWidget.h	2012-03-27 01:59:06 UTC (rev 112190)
+++ trunk/Source/WebKit/chromium/public/WebWidget.h	2012-03-27 02:01:42 UTC (rev 112191)
@@ -112,6 +112,15 @@
     // removed when the WebWidget inversion patch lands --- http://crbug.com/112837
     virtual void setNeedsRedraw() { }
 
+    // Temporary method for the embedder to check for throttled input. When this
+    // is true, the WebWidget is indicating that it would prefer to not receive
+    // additional input events until
+    // WebWidgetClient::didBecomeReadyForAdditionalInput is called.
+    //
+    // This method will be removed when the WebWidget inversion patch lands ---
+    // http://crbug.com/112837
+    virtual bool isInputThrottled() const { return false; }
+
     // Called to inform the WebWidget of a change in theme.
     // Implementors that cache rendered copies of widgets need to re-render
     // on receiving this message

Modified: trunk/Source/WebKit/chromium/public/WebWidgetClient.h (112190 => 112191)


--- trunk/Source/WebKit/chromium/public/WebWidgetClient.h	2012-03-27 01:59:06 UTC (rev 112190)
+++ trunk/Source/WebKit/chromium/public/WebWidgetClient.h	2012-03-27 02:01:42 UTC (rev 112191)
@@ -67,10 +67,12 @@
     // Indicates to the embedder that the compositor is about to begin a
     // frame. This is primarily to signal to flow control mechanisms that a
     // frame is beginning, not to perform actual painting work.
-    //
-    // FIXME: Make pure virtual once upstream deps are satisfied.
     virtual void willBeginCompositorFrame() { }
 
+    // Indicates to the embedder that the WebWidget is ready for additional
+    // input.
+    virtual void didBecomeReadyForAdditionalInput() { }
+
     // Called for compositing mode when the draw commands for a WebKit-side
     // frame have been issued.
     virtual void didCommitAndDrawCompositorFrame() { }

Modified: trunk/Source/WebKit/chromium/src/WebLayerTreeView.cpp (112190 => 112191)


--- trunk/Source/WebKit/chromium/src/WebLayerTreeView.cpp	2012-03-27 01:59:06 UTC (rev 112190)
+++ trunk/Source/WebKit/chromium/src/WebLayerTreeView.cpp	2012-03-27 02:01:42 UTC (rev 112191)
@@ -122,6 +122,11 @@
     m_private->setNeedsRedraw();
 }
 
+bool WebLayerTreeView::commitRequested() const
+{
+    return m_private->commitRequested();
+}
+
 void WebLayerTreeView::composite()
 {
     if (CCProxy::hasImplThread())

Modified: trunk/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp (112190 => 112191)


--- trunk/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp	2012-03-27 01:59:06 UTC (rev 112190)
+++ trunk/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp	2012-03-27 02:01:42 UTC (rev 112191)
@@ -101,6 +101,12 @@
         m_client->didRebindGraphicsContext(success);
 }
 
+void WebLayerTreeViewImpl::didCommit()
+{
+    if (m_client)
+        m_client->didCommit();
+}
+
 void WebLayerTreeViewImpl::didCommitAndDrawFrame()
 {
     if (m_client)

Modified: trunk/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h (112190 => 112191)


--- trunk/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h	2012-03-27 01:59:06 UTC (rev 112190)
+++ trunk/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h	2012-03-27 02:01:42 UTC (rev 112191)
@@ -47,6 +47,7 @@
     virtual void applyScrollAndScale(const WebCore::IntSize& scrollDelta, float pageScale);
     virtual PassRefPtr<WebCore::GraphicsContext3D> createContext();
     virtual void didRecreateContext(bool success);
+    virtual void didCommit();
     virtual void didCommitAndDrawFrame();
     virtual void didCompleteSwapBuffers();
 

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (112190 => 112191)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2012-03-27 01:59:06 UTC (rev 112190)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2012-03-27 02:01:42 UTC (rev 112191)
@@ -1497,6 +1497,15 @@
 #endif
 }
 
+bool WebViewImpl::isInputThrottled() const
+{
+#if USE(ACCELERATED_COMPOSITING)
+    if (!m_layerTreeView.isNull() && isAcceleratedCompositingActive())
+        return m_layerTreeView.commitRequested();
+#endif
+    return false;
+}
+
 void WebViewImpl::loseCompositorContext(int numTimes)
 {
 #if USE(ACCELERATED_COMPOSITING)
@@ -3349,6 +3358,12 @@
     }
 }
 
+void WebViewImpl::didCommit()
+{
+    if (m_client)
+        m_client->didBecomeReadyForAdditionalInput();
+}
+
 void WebViewImpl::didCommitAndDrawFrame()
 {
     if (m_client)

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.h (112190 => 112191)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.h	2012-03-27 01:59:06 UTC (rev 112190)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.h	2012-03-27 02:01:42 UTC (rev 112191)
@@ -122,6 +122,7 @@
     virtual void themeChanged();
     virtual void composite(bool finish);
     virtual void setNeedsRedraw();
+    virtual bool isInputThrottled() const;
     virtual bool handleInputEvent(const WebInputEvent&);
     virtual void mouseCaptureLost();
     virtual void setFocus(bool enable);
@@ -259,6 +260,7 @@
     virtual void applyScrollAndScale(const WebSize&, float);
     virtual WebGraphicsContext3D* createContext3D();
     virtual void didRebindGraphicsContext(bool);
+    virtual void didCommit();
     virtual void didCommitAndDrawFrame();
     virtual void didCompleteSwapBuffers();
     virtual void scheduleComposite();

Modified: trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp (112190 => 112191)


--- trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp	2012-03-27 01:59:06 UTC (rev 112190)
+++ trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp	2012-03-27 02:01:42 UTC (rev 112191)
@@ -249,6 +249,10 @@
         return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), GraphicsContext3D::RenderDirectlyToHostWindow);
     }
 
+    virtual void didCommit()
+    {
+    }
+
     virtual void didCommitAndDrawFrame()
     {
         m_testHooks->didCommitAndDrawFrame();

Modified: trunk/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h (112190 => 112191)


--- trunk/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h	2012-03-27 01:59:06 UTC (rev 112190)
+++ trunk/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h	2012-03-27 02:01:42 UTC (rev 112191)
@@ -44,6 +44,7 @@
         return createCompositorMockGraphicsContext3D(attrs);
     }
     virtual void didRecreateContext(bool success) { }
+    virtual void didCommit() { }
     virtual void didCommitAndDrawFrame() { }
     virtual void didCompleteSwapBuffers() { }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to