[chromium] Pipe compositor commit/swap up to WebWidgetClient
authorenne@google.com <enne@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Nov 2011 23:10:16 +0000 (23:10 +0000)
committerenne@google.com <enne@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Nov 2011 23:10:16 +0000 (23:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=72041

Reviewed by Darin Fisher.

Source/WebCore:

* platform/graphics/chromium/cc/CCLayerTreeHost.h:
(WebCore::CCLayerTreeHost::didCommitAndDrawFrame):
(WebCore::CCLayerTreeHost::didCompleteSwapBuffers):
* platform/graphics/chromium/cc/CCSingleThreadProxy.cpp:
(WebCore::CCSingleThreadProxy::doComposite):
* platform/graphics/chromium/cc/CCThreadProxy.cpp:
(WebCore::CCThreadProxy::onSwapBuffersCompleteOnImplThread):
(WebCore::CCThreadProxy::scheduledActionDrawAndSwap):
(WebCore::CCThreadProxy::didCommitAndDrawFrame):
(WebCore::CCThreadProxy::didCompleteSwapBuffers):
* platform/graphics/chromium/cc/CCThreadProxy.h:

Source/WebKit/chromium:

* public/WebWidgetClient.h:
(WebKit::WebWidgetClient::didCommitAndDrawCompositorFrame):
(WebKit::WebWidgetClient::didCompleteSwapBuffers):
* src/WebLayerTreeViewImpl.cpp:
(WebKit::WebLayerTreeViewImpl::didCommitAndDrawFrame):
(WebKit::WebLayerTreeViewImpl::didCompleteSwapBuffers):
* src/WebLayerTreeViewImpl.h:
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::didCommitAndDrawFrame):
(WebKit::WebViewImpl::didCompleteSwapBuffers):
* src/WebViewImpl.h:
* tests/CCLayerTreeHostTest.cpp:
(WTF::MockLayerTreeHostClient::didCommitAndDrawFrame):
(WTF::MockLayerTreeHostClient::didCompleteSwapBuffers):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@100199 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h
Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp
Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp
Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/public/WebWidgetClient.h
Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp
Source/WebKit/chromium/src/WebLayerTreeViewImpl.h
Source/WebKit/chromium/src/WebViewImpl.cpp
Source/WebKit/chromium/src/WebViewImpl.h
Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp

index f1186a4..e7b9dae 100644 (file)
@@ -1,3 +1,22 @@
+2011-11-14  Adrienne Walker  <enne@google.com>
+
+        [chromium] Pipe compositor commit/swap up to WebWidgetClient
+        https://bugs.webkit.org/show_bug.cgi?id=72041
+
+        Reviewed by Darin Fisher.
+
+        * platform/graphics/chromium/cc/CCLayerTreeHost.h:
+        (WebCore::CCLayerTreeHost::didCommitAndDrawFrame):
+        (WebCore::CCLayerTreeHost::didCompleteSwapBuffers):
+        * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp:
+        (WebCore::CCSingleThreadProxy::doComposite):
+        * platform/graphics/chromium/cc/CCThreadProxy.cpp:
+        (WebCore::CCThreadProxy::onSwapBuffersCompleteOnImplThread):
+        (WebCore::CCThreadProxy::scheduledActionDrawAndSwap):
+        (WebCore::CCThreadProxy::didCommitAndDrawFrame):
+        (WebCore::CCThreadProxy::didCompleteSwapBuffers):
+        * platform/graphics/chromium/cc/CCThreadProxy.h:
+
 2011-11-14  Tony Chang  <tony@chromium.org>
 
         Remove the CSS3_FLEXBOX compile time flag and enable on all ports
index 796a20f..d814149 100644 (file)
@@ -57,7 +57,8 @@ public:
     virtual void applyScrollAndScale(const IntSize& scrollDelta, float pageScale) = 0;
     virtual PassRefPtr<GraphicsContext3D> createLayerTreeHostContext3D() = 0;
     virtual void didRecreateGraphicsContext(bool success) = 0;
-    virtual void didCommitAndDrawFrame(int frameNumber) = 0;
+    virtual void didCommitAndDrawFrame() = 0;
+    virtual void didCompleteSwapBuffers() = 0;
 
     // Used only in the single-threaded path.
     virtual void scheduleComposite() = 0;
@@ -115,7 +116,8 @@ public:
     virtual PassOwnPtr<CCLayerTreeHostImpl> createLayerTreeHostImpl(CCLayerTreeHostImplClient*);
     void didBecomeInvisibleOnImplThread(CCLayerTreeHostImpl*);
     void didRecreateGraphicsContext(bool success);
-    void didCommitAndDrawFrame(int frameNumber) { m_client->didCommitAndDrawFrame(frameNumber); }
+    void didCommitAndDrawFrame() { m_client->didCommitAndDrawFrame(); }
+    void didCompleteSwapBuffers() { m_client->didCompleteSwapBuffers(); }
     void deleteContentsTexturesOnImplThread(TextureAllocator*);
 
     // CCLayerTreeHost interface to WebView.
index 6291db5..c160e19 100644 (file)
@@ -303,7 +303,7 @@ bool CCSingleThreadProxy::doComposite()
 
     if (m_nextFrameIsNewlyCommittedFrame) {
         m_nextFrameIsNewlyCommittedFrame = false;
-        m_layerTreeHost->didCommitAndDrawFrame(m_layerTreeHostImpl->sourceFrameNumber());
+        m_layerTreeHost->didCommitAndDrawFrame();
     }
 
     return true;
index 9ca6d51..6f4ed90 100644 (file)
@@ -229,6 +229,7 @@ void CCThreadProxy::onSwapBuffersCompleteOnImplThread()
     ASSERT(isImplThread());
     TRACE_EVENT("CCThreadProxy::onSwapBuffersCompleteOnImplThread", this, 0);
     m_schedulerOnImplThread->didSwapBuffersComplete();
+    m_mainThreadProxy->postTask(createMainThreadTask(this, &CCThreadProxy::didCompleteSwapBuffers));
 }
 
 void CCThreadProxy::setNeedsCommitOnImplThread()
@@ -487,16 +488,24 @@ void CCThreadProxy::scheduledActionDrawAndSwap()
     // Tell the main thread that the the newly-commited frame was drawn.
     if (m_nextFrameIsNewlyCommittedFrameOnImplThread) {
         m_nextFrameIsNewlyCommittedFrameOnImplThread = false;
-        m_mainThreadProxy->postTask(createMainThreadTask(this, &CCThreadProxy::didCommitAndDrawFrame, m_layerTreeHostImpl->sourceFrameNumber()));
+        m_mainThreadProxy->postTask(createMainThreadTask(this, &CCThreadProxy::didCommitAndDrawFrame));
     }
 }
 
-void CCThreadProxy::didCommitAndDrawFrame(int frameNumber)
+void CCThreadProxy::didCommitAndDrawFrame()
 {
     ASSERT(isMainThread());
     if (!m_layerTreeHost)
         return;
-    m_layerTreeHost->didCommitAndDrawFrame(frameNumber);
+    m_layerTreeHost->didCommitAndDrawFrame();
+}
+
+void CCThreadProxy::didCompleteSwapBuffers()
+{
+    ASSERT(isMainThread());
+    if (!m_layerTreeHost)
+        return;
+    m_layerTreeHost->didCompleteSwapBuffers();
 }
 
 void CCThreadProxy::initializeImplOnImplThread(CCCompletionEvent* completion)
index d064c8a..0140a71 100644 (file)
@@ -82,7 +82,8 @@ private:
 
     // Called on CCMainThread
     void beginFrameAndCommit(int sequenceNumber, double frameBeginTime, PassOwnPtr<CCScrollAndScaleSet>);
-    void didCommitAndDrawFrame(int frameNumber);
+    void didCommitAndDrawFrame();
+    void didCompleteSwapBuffers();
 
     // Called on CCThread
     struct ReadbackRequest {
index 9473e56..9e26415 100644 (file)
@@ -1,3 +1,25 @@
+2011-11-14  Adrienne Walker  <enne@google.com>
+
+        [chromium] Pipe compositor commit/swap up to WebWidgetClient
+        https://bugs.webkit.org/show_bug.cgi?id=72041
+
+        Reviewed by Darin Fisher.
+
+        * public/WebWidgetClient.h:
+        (WebKit::WebWidgetClient::didCommitAndDrawCompositorFrame):
+        (WebKit::WebWidgetClient::didCompleteSwapBuffers):
+        * src/WebLayerTreeViewImpl.cpp:
+        (WebKit::WebLayerTreeViewImpl::didCommitAndDrawFrame):
+        (WebKit::WebLayerTreeViewImpl::didCompleteSwapBuffers):
+        * src/WebLayerTreeViewImpl.h:
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::didCommitAndDrawFrame):
+        (WebKit::WebViewImpl::didCompleteSwapBuffers):
+        * src/WebViewImpl.h:
+        * tests/CCLayerTreeHostTest.cpp:
+        (WTF::MockLayerTreeHostClient::didCommitAndDrawFrame):
+        (WTF::MockLayerTreeHostClient::didCompleteSwapBuffers):
+
 2011-11-14  Tony Chang  <tony@chromium.org>
 
         Remove the CSS3_FLEXBOX compile time flag and enable on all ports
index f95097c..bb6b119 100644 (file)
@@ -60,6 +60,14 @@ public:
     virtual void didActivateCompositor(int compositorIdentifier) { }
     virtual void didDeactivateCompositor() { }
 
+    // Called for compositing mode when the draw commands for a WebKit-side
+    // frame have been issued.
+    virtual void didCommitAndDrawCompositorFrame() { }
+
+    // Called for compositing mode when swapbuffers has been posted in the GPU
+    // process.
+    virtual void didCompleteSwapBuffers() { }
+
     // Called when a call to WebWidget::composite is required
     virtual void scheduleComposite() { }
 
index ddbe064..8c8684b 100644 (file)
@@ -96,7 +96,12 @@ PassRefPtr<GraphicsContext3D> WebLayerTreeViewImpl::createLayerTreeHostContext3D
     return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), attributes, 0, style, usage);
 }
 
-void WebLayerTreeViewImpl::didCommitAndDrawFrame(int frameNumber)
+void WebLayerTreeViewImpl::didCommitAndDrawFrame()
+{
+    // FIXME: route this up to the WebLayerTreeView client
+}
+
+void WebLayerTreeViewImpl::didCompleteSwapBuffers()
 {
     // FIXME: route this up to the WebLayerTreeView client
 }
index d6dd6e3..0cfc283 100644 (file)
@@ -44,8 +44,9 @@ private:
     virtual void animateAndLayout(double frameBeginTime);
     virtual void applyScrollAndScale(const WebCore::IntSize& scrollDelta, float pageScale);
     virtual PassRefPtr<WebCore::GraphicsContext3D> createLayerTreeHostContext3D();
-    virtual void didCommitAndDrawFrame(int frameNumber);
     virtual void didRecreateGraphicsContext(bool success);
+    virtual void didCommitAndDrawFrame();
+    virtual void didCompleteSwapBuffers();
 
     // Only used in the single threaded path.
     virtual void scheduleComposite();
index 4c4073e..6aeb723 100644 (file)
@@ -2803,9 +2803,16 @@ void WebViewImpl::applyScrollAndScale(const IntSize& scrollDelta, float scaleFac
     }
 }
 
-void WebViewImpl::didCommitAndDrawFrame(int frameNumber)
+void WebViewImpl::didCommitAndDrawFrame()
 {
-    // FIXME: route this up to RenderWidget's didFlushPaint.
+    if (m_client)
+        m_client->didCommitAndDrawCompositorFrame();
+}
+
+void WebViewImpl::didCompleteSwapBuffers()
+{
+    if (m_client)
+        m_client->didCompleteSwapBuffers();
 }
 
 void WebViewImpl::didRecreateGraphicsContext(bool success)
index 1ea499e..8c09bd8 100644 (file)
@@ -224,7 +224,8 @@ public:
     virtual void animateAndLayout(double frameBeginTime);
     virtual void applyScrollAndScale(const WebCore::IntSize&, float);
     virtual PassRefPtr<WebCore::GraphicsContext3D> createLayerTreeHostContext3D();
-    virtual void didCommitAndDrawFrame(int frameNumber);
+    virtual void didCommitAndDrawFrame();
+    virtual void didCompleteSwapBuffers();
     virtual void didRecreateGraphicsContext(bool success);
     virtual void scheduleComposite();
 
index d5f1ad5..7c12352 100644 (file)
@@ -165,7 +165,11 @@ public:
         return context;
     }
 
-    virtual void didCommitAndDrawFrame(int frameNumber)
+    virtual void didCommitAndDrawFrame()
+    {
+    }
+
+    virtual void didCompleteSwapBuffers()
     {
     }