[chromium] Route monotonic clock up from compositor
authornduca@chromium.org <nduca@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Mar 2012 03:15:57 +0000 (03:15 +0000)
committernduca@chromium.org <nduca@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Mar 2012 03:15:57 +0000 (03:15 +0000)
https://bugs.webkit.org/show_bug.cgi?id=82154

Reviewed by James Robinson.

Source/Platform:

* chromium/public/WebLayerTreeViewClient.h:
(WebLayerTreeViewClient):

Source/WebCore:

* platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
(WebCore::CCLayerTreeHost::updateAnimations):
* platform/graphics/chromium/cc/CCLayerTreeHost.h:
(CCLayerTreeHost):
* platform/graphics/chromium/cc/CCThreadProxy.cpp:
(WebCore::CCThreadProxy::scheduledActionBeginFrame):
(WebCore::CCThreadProxy::beginFrame):
* platform/graphics/chromium/cc/CCThreadProxy.h:
(WebCore::CCThreadProxy::BeginFrameAndCommitState::BeginFrameAndCommitState):
(BeginFrameAndCommitState):

Source/WebKit/chromium:

* public/WebWidget.h:
(WebKit::WebWidget::animate):
* src/WebLayerTreeViewImpl.cpp:
(WebKit::WebLayerTreeViewImpl::updateAnimations):
* src/WebLayerTreeViewImpl.h:
(WebLayerTreeViewImpl):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::animate):
(WebKit::WebViewImpl::updateAnimations):
* src/WebViewImpl.h:
(WebViewImpl):
* tests/FakeCCLayerTreeHostClient.h:
(WebCore::FakeCCLayerTreeHostClient::updateAnimations):

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

14 files changed:
Source/Platform/ChangeLog
Source/Platform/chromium/public/WebLayerTreeViewClient.h
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h
Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp
Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/public/WebWidget.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/FakeCCLayerTreeHostClient.h

index 29fddf0d51c09edd12616bae6e28f656af85f93d..78b056cb8a2f81f1cd4b36180e7b5aac10a98d28 100644 (file)
@@ -1,3 +1,13 @@
+2012-03-27  Nat Duca  <nduca@chromium.org>
+
+        [chromium] Route monotonic clock up from compositor
+        https://bugs.webkit.org/show_bug.cgi?id=82154
+
+        Reviewed by James Robinson.
+
+        * chromium/public/WebLayerTreeViewClient.h:
+        (WebLayerTreeViewClient):
+
 2012-03-26  Nat Duca  <nduca@chromium.org>
 
         [chromium] Add isInputThrottled/didBecomeReadyForAdditionalInput to WebWidget
index 1903fffa9e12c9621a8b3ea6f3eb85240b23e36e..fd24487c59a875dbefb46d9b517bc3c426e47187 100644 (file)
@@ -42,7 +42,7 @@ public:
 
     // Updates animation and layout. These are called before the compositing
     // pass so that layers can be updated at the given frame time.
-    virtual void updateAnimations(double frameBeginTime) = 0;
+    virtual void updateAnimations(double monotonicFrameBeginTime) = 0;
     virtual void layout() = 0;
 
     // Applies a scroll delta to the root layer, which is bundled with a page
index 9fa69c437bfdba14ccf3f121db204e91ed553cb3..b0ec54ed5f6ba3542c4182d73b1074243295c1e7 100644 (file)
@@ -1,3 +1,21 @@
+2012-03-27  Nat Duca  <nduca@chromium.org>
+
+        [chromium] Route monotonic clock up from compositor
+        https://bugs.webkit.org/show_bug.cgi?id=82154
+
+        Reviewed by James Robinson.
+
+        * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
+        (WebCore::CCLayerTreeHost::updateAnimations):
+        * platform/graphics/chromium/cc/CCLayerTreeHost.h:
+        (CCLayerTreeHost):
+        * platform/graphics/chromium/cc/CCThreadProxy.cpp:
+        (WebCore::CCThreadProxy::scheduledActionBeginFrame):
+        (WebCore::CCThreadProxy::beginFrame):
+        * platform/graphics/chromium/cc/CCThreadProxy.h:
+        (WebCore::CCThreadProxy::BeginFrameAndCommitState::BeginFrameAndCommitState):
+        (BeginFrameAndCommitState):
+
 2012-03-27  Robin Cao  <robin.cao@torchmobile.com.cn>
 
         [BlackBerry] Upstream LayerAnimation.{cpp, h}
index a55dac67d1ac9b26fdf08ed640bc2cbda31602f5..576fc2b3190a2d630957598175c43eef4e788c27 100644 (file)
@@ -181,11 +181,11 @@ void CCLayerTreeHost::deleteContentsTexturesOnImplThread(TextureAllocator* alloc
         m_contentsTextureManager->evictAndDeleteAllTextures(allocator);
 }
 
-void CCLayerTreeHost::updateAnimations(double wallClockTime)
+void CCLayerTreeHost::updateAnimations(double monotonicFrameBeginTime)
 {
     m_animating = true;
-    m_client->updateAnimations(wallClockTime);
-    animateLayers(monotonicallyIncreasingTime());
+    m_client->updateAnimations(monotonicFrameBeginTime);
+    animateLayers(monotonicFrameBeginTime);
     m_animating = false;
 }
 
index dd2689f80959affc801bc82413319c722785d86c..9ca14fc044883ab0c3109a97fb8be1b2ba237161 100644 (file)
@@ -135,7 +135,7 @@ public:
 
     // CCLayerTreeHost interface to CCProxy.
     void willBeginFrame() { m_client->willBeginFrame(); }
-    void updateAnimations(double wallClockTime);
+    void updateAnimations(double monotonicFrameBeginTime);
     void layout();
     void beginCommitOnImplThread(CCLayerTreeHostImpl*);
     void finishCommitOnImplThread(CCLayerTreeHostImpl*);
index 20a50bbad71ba3424e5ca27697b768e19473951f..775fd99569823bf248650cec63a48533d295379e 100644 (file)
@@ -411,7 +411,7 @@ void CCThreadProxy::scheduledActionBeginFrame()
     TRACE_EVENT0("cc", "CCThreadProxy::scheduledActionBeginFrame");
     ASSERT(!m_pendingBeginFrameRequest);
     m_pendingBeginFrameRequest = adoptPtr(new BeginFrameAndCommitState());
-    m_pendingBeginFrameRequest->frameBeginTime = currentTime();
+    m_pendingBeginFrameRequest->monotonicFrameBeginTime = monotonicallyIncreasingTime();
     m_pendingBeginFrameRequest->scrollInfo = m_layerTreeHostImpl->processScrollDeltas();
 
     m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::beginFrame));
@@ -458,7 +458,7 @@ void CCThreadProxy::beginFrame()
     m_layerTreeHost->willBeginFrame();
 
     // FIXME: recreate the context if it was requested by the impl thread.
-    m_layerTreeHost->updateAnimations(request->frameBeginTime);
+    m_layerTreeHost->updateAnimations(request->monotonicFrameBeginTime);
     m_layerTreeHost->layout();
 
     // Clear the commit flag after updating animations and layout here --- objects that only
index 61434a6a9cf63e829cdbc5b7b251705e8af955e6..a5c4b312337a9d1dbc8f00a1b079700a8fed82ed 100644 (file)
@@ -94,8 +94,8 @@ private:
 
     // Set on impl thread, read on main thread.
     struct BeginFrameAndCommitState {
-        BeginFrameAndCommitState() : frameBeginTime() { }
-        double frameBeginTime;
+        BeginFrameAndCommitState() : monotonicFrameBeginTime() { }
+        double monotonicFrameBeginTime;
         OwnPtr<CCScrollAndScaleSet> scrollInfo;
     };
     OwnPtr<BeginFrameAndCommitState> m_pendingBeginFrameRequest;
index 47b6740d873a20ff6836564242b85b5b37aa2544..2805c6c9e6129cb2fdb556964b6783171b561fae 100644 (file)
@@ -1,3 +1,24 @@
+2012-03-27  Nat Duca  <nduca@chromium.org>
+
+        [chromium] Route monotonic clock up from compositor
+        https://bugs.webkit.org/show_bug.cgi?id=82154
+
+        Reviewed by James Robinson.
+
+        * public/WebWidget.h:
+        (WebKit::WebWidget::animate):
+        * src/WebLayerTreeViewImpl.cpp:
+        (WebKit::WebLayerTreeViewImpl::updateAnimations):
+        * src/WebLayerTreeViewImpl.h:
+        (WebLayerTreeViewImpl):
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::animate):
+        (WebKit::WebViewImpl::updateAnimations):
+        * src/WebViewImpl.h:
+        (WebViewImpl):
+        * tests/FakeCCLayerTreeHostClient.h:
+        (WebCore::FakeCCLayerTreeHostClient::updateAnimations):
+
 2012-03-27  James Robinson  <jamesr@chromium.org>
 
         webkit_unit_tests crashing on chromium lion in CCLayerTreeHostTestCompositeAndReadbackWhileInvisible
index fc011cb8f860cdf44bf761dc99534b67a8b2fffa..cbcf74641ac912f2f3c811d9202823dfee961df1 100644 (file)
@@ -79,10 +79,10 @@ public:
     virtual void didExitFullScreen() { }
 
     // Called to update imperative animation state. This should be called before
-    // paint, although the client can rate-limit these calls. When
-    // frameBeginTime is 0.0, the WebWidget will determine the frame begin time
-    // itself.
-    virtual void animate(double frameBeginTime) { }
+    // paint, although the client can rate-limit these calls.
+    //
+    // FIXME: remove this function entirely when inversion patches land.
+    virtual void animate(double ignored) { }
 
     // Called to layout the WebWidget. This MUST be called before Paint,
     // and it may result in calls to WebWidgetClient::didInvalidateRect.
index b8ef5a920840c6780a1be8bff620f7902c3fa14b..68cfdbe1ddda829682cb533c88c728c6a734d689 100644 (file)
@@ -66,10 +66,10 @@ void WebLayerTreeViewImpl::willBeginFrame()
         m_client->willBeginFrame();
 }
 
-void WebLayerTreeViewImpl::updateAnimations(double frameBeginTime)
+void WebLayerTreeViewImpl::updateAnimations(double monotonicFrameBeginTime)
 {
     if (m_client)
-        m_client->updateAnimations(frameBeginTime);
+        m_client->updateAnimations(monotonicFrameBeginTime);
 }
 
 void WebLayerTreeViewImpl::layout()
index 43d4cc1ebdc0f03eddc5f255590c3da6d8ed3d6b..af04a35bdc05ea5ea5fac03bb316ba2627645ecb 100644 (file)
@@ -42,7 +42,7 @@ private:
     WebLayerTreeViewImpl(WebLayerTreeViewClient*, const WebLayerTreeView::Settings&);
     virtual ~WebLayerTreeViewImpl();
     virtual void willBeginFrame();
-    virtual void updateAnimations(double frameBeginTime);
+    virtual void updateAnimations(double monotonicFrameBeginTime);
     virtual void layout();
     virtual void applyScrollAndScale(const WebCore::IntSize& scrollDelta, float pageScale);
     virtual PassRefPtr<WebCore::GraphicsContext3D> createContext();
index c0621a806104102d902e765f4bd4edb18b40ce79..63a421b0bb7ee1377e04aa5593bf484b7e6dff18 100644 (file)
@@ -1330,22 +1330,19 @@ void WebViewImpl::instrumentCancelFrame()
     InspectorInstrumentation::didCancelFrame(m_page.get());
 }
 
-void WebViewImpl::animate(double frameBeginTime)
+void WebViewImpl::animate(double)
 {
 #if ENABLE(REQUEST_ANIMATION_FRAME)
-    // FIXME: remove this zero-check once render_widget has been modified to
-    // pass in a frameBeginTime.
-    if (!frameBeginTime)
-        frameBeginTime = currentTime();
+    double monotonicFrameBeginTime = monotonicallyIncreasingTime();
 
 #if USE(ACCELERATED_COMPOSITING)
     // In composited mode, we always go through the compositor so it can apply
     // appropriate flow-control mechanisms.
     if (isAcceleratedCompositingActive())
-        m_layerTreeView.updateAnimations(frameBeginTime);
+        m_layerTreeView.updateAnimations(monotonicFrameBeginTime);
     else
 #endif
-        updateAnimations(frameBeginTime);
+        updateAnimations(monotonicFrameBeginTime);
 #endif
 }
 
@@ -1354,7 +1351,7 @@ void WebViewImpl::willBeginFrame()
     m_client->willBeginCompositorFrame();
 }
 
-void WebViewImpl::updateAnimations(double frameBeginTime)
+void WebViewImpl::updateAnimations(double monotonicFrameBeginTime)
 {
 #if ENABLE(REQUEST_ANIMATION_FRAME)
     TRACE_EVENT("WebViewImpl::updateAnimations", this, 0);
@@ -1368,13 +1365,14 @@ void WebViewImpl::updateAnimations(double frameBeginTime)
 
     // Create synthetic wheel events as necessary for fling.
     if (m_gestureAnimation) {
-        if (m_gestureAnimation->animate(frameBeginTime))
+        if (m_gestureAnimation->animate(monotonicFrameBeginTime))
             scheduleAnimation();
         else
             m_gestureAnimation.clear();
     }
 
-    view->serviceScriptedAnimations(convertSecondsToDOMTimeStamp(frameBeginTime));
+    double timeShift = currentTime() - monotonicallyIncreasingTime();
+    view->serviceScriptedAnimations(convertSecondsToDOMTimeStamp(monotonicFrameBeginTime + timeShift));
 #endif
 }
 
index 38be6adc335dd25773f683fe49abe5ff4e0ec666..b25ddde0628be31eeb4f3c8747bdfce7190255cf 100644 (file)
@@ -116,7 +116,7 @@ public:
     virtual void didEnterFullScreen();
     virtual void willExitFullScreen();
     virtual void didExitFullScreen();
-    virtual void animate(double frameBeginTime);
+    virtual void animate(double);
     virtual void layout(); // Also implements CCLayerTreeHostClient::layout()
     virtual void paint(WebCanvas*, const WebRect&);
     virtual void themeChanged();
@@ -256,7 +256,7 @@ public:
 
     // WebLayerTreeViewClient
     virtual void willBeginFrame();
-    virtual void updateAnimations(double frameBeginTime);
+    virtual void updateAnimations(double monotonicFrameBeginTime);
     virtual void applyScrollAndScale(const WebSize&, float);
     virtual WebGraphicsContext3D* createContext3D();
     virtual void didRebindGraphicsContext(bool);
index 6502f82a3ad0b91b9d067cb3ed58fc0a84e0c31e..6d2f5d33c37d368dce722ecfbd930bd7b41154b4 100755 (executable)
@@ -35,7 +35,7 @@ namespace WebCore {
 class FakeCCLayerTreeHostClient : public CCLayerTreeHostClient {
 public:
     virtual void willBeginFrame() { }
-    virtual void updateAnimations(double frameBeginTime) { }
+    virtual void updateAnimations(double monotonicFrameBeginTime) { }
     virtual void layout() { }
     virtual void applyScrollAndScale(const IntSize& scrollDelta, float pageScale) { }
     virtual PassRefPtr<GraphicsContext3D> createContext()