[chromium] Expose rendering statistics to WebWidget.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Jun 2012 22:44:46 +0000 (22:44 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Jun 2012 22:44:46 +0000 (22:44 +0000)
https://bugs.webkit.org/show_bug.cgi?id=88268

Patch by Dave Tu <dtu@chromium.org> on 2012-06-22
Reviewed by James Robinson.

The WebKit side of a basic framework for exposing rendering statistics
to Chromium's --enable-benchmarking extension.

Source/Platform:

* chromium/public/WebLayerTreeView.h:
(WebRenderingStatistics):
(WebKit):
(WebLayerTreeView):

Source/WebCore:

* platform/graphics/chromium/cc/CCLayerTreeHost.h:
(WebCore::CCLayerTreeHost::implFrameNumber):
* platform/graphics/chromium/cc/CCProxy.h:
(CCProxy):
* platform/graphics/chromium/cc/CCSingleThreadProxy.h:
* platform/graphics/chromium/cc/CCThreadProxy.cpp:
(WebCore::CCThreadProxy::implFrameNumber):
(WebCore):
(WebCore::CCThreadProxy::implFrameNumberOnImplThread):
* platform/graphics/chromium/cc/CCThreadProxy.h:
(CCThreadProxy):

Source/WebKit/chromium:

* src/WebLayerTreeView.cpp:
(WebKit::WebLayerTreeView::renderingStatistics):
(WebKit):

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

22 files changed:
Source/Platform/ChangeLog
Source/Platform/Platform.gypi
Source/Platform/chromium/public/WebLayerTreeView.h
Source/Platform/chromium/public/WebRenderingStats.h [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/WebCore.gypi
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h
Source/WebCore/platform/graphics/chromium/cc/CCProxy.h
Source/WebCore/platform/graphics/chromium/cc/CCRenderingStats.h [new file with mode: 0644]
Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp
Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.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/WebView.h
Source/WebKit/chromium/src/WebLayerTreeView.cpp
Source/WebKit/chromium/src/WebViewImpl.cpp
Source/WebKit/chromium/src/WebViewImpl.h
Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp

index eae6e75..30527d5 100644 (file)
@@ -1,3 +1,18 @@
+2012-06-22  Dave Tu  <dtu@chromium.org>
+
+        [chromium] Expose rendering statistics to WebWidget.
+        https://bugs.webkit.org/show_bug.cgi?id=88268
+
+        Reviewed by James Robinson.
+
+        The WebKit side of a basic framework for exposing rendering statistics
+        to Chromium's --enable-benchmarking extension.
+
+        * chromium/public/WebLayerTreeView.h:
+        (WebRenderingStatistics):
+        (WebKit):
+        (WebLayerTreeView):
+
 2012-06-22  Jeff Timanus  <twiz@chromium.org>
 
         [Chromium] Change implementing a fast-path for copying GPU-accelerated Canvas2D instances to WebGL textures.
index d79f853..75ad972 100644 (file)
@@ -94,6 +94,7 @@
             'chromium/public/WebPrivatePtr.h',
             'chromium/public/WebRect.h',
             'chromium/public/WebReferrerPolicy.h',
+            'chromium/public/WebRenderingStats.h',
             'chromium/public/WebSessionDescriptionDescriptor.h',
             'chromium/public/WebSize.h',
             'chromium/public/WebSocketStreamError.h',
index d5d99a2..f67930d 100644 (file)
@@ -44,6 +44,7 @@ class WebLayerTreeViewClient;
 class WebLayerTreeViewImpl;
 struct WebPoint;
 struct WebRect;
+struct WebRenderingStats;
 
 class WebLayerTreeView : public WebNonCopyable {
 public:
@@ -173,6 +174,10 @@ public:
 
     // Debugging / dangerous ---------------------------------------------
 
+    // Fills in a WebRenderingStats struct containing information about the state of the compositor.
+    // This call is relatively expensive in threaded mode as it blocks on the compositor thread.
+    WEBKIT_EXPORT void renderingStats(WebRenderingStats&) const;
+
     // Simulates a lost context. For testing only.
     WEBKIT_EXPORT void loseCompositorContext(int numTimes);
 
diff --git a/Source/Platform/chromium/public/WebRenderingStats.h b/Source/Platform/chromium/public/WebRenderingStats.h
new file mode 100644 (file)
index 0000000..f176985
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebRenderingStats_h
+#define WebRenderingStats_h
+
+namespace WebKit {
+
+struct WebRenderingStats {
+    int numAnimationFrames;
+    int numFramesSentToScreen;
+
+    WebRenderingStats()
+        : numAnimationFrames(0)
+        , numFramesSentToScreen(0)
+    {
+    }
+};
+
+} // namespace WebKit
+
+#endif // WebRenderingStats_h
index d024f4a..a455a14 100644 (file)
@@ -1,3 +1,25 @@
+2012-06-22  Dave Tu  <dtu@chromium.org>
+
+        [chromium] Expose rendering statistics to WebWidget.
+        https://bugs.webkit.org/show_bug.cgi?id=88268
+
+        Reviewed by James Robinson.
+
+        The WebKit side of a basic framework for exposing rendering statistics
+        to Chromium's --enable-benchmarking extension.
+
+        * platform/graphics/chromium/cc/CCLayerTreeHost.h:
+        (WebCore::CCLayerTreeHost::implFrameNumber):
+        * platform/graphics/chromium/cc/CCProxy.h:
+        (CCProxy):
+        * platform/graphics/chromium/cc/CCSingleThreadProxy.h:
+        * platform/graphics/chromium/cc/CCThreadProxy.cpp:
+        (WebCore::CCThreadProxy::implFrameNumber):
+        (WebCore):
+        (WebCore::CCThreadProxy::implFrameNumberOnImplThread):
+        * platform/graphics/chromium/cc/CCThreadProxy.h:
+        (CCThreadProxy):
+
 2012-06-22  Shawn Singh  <shawnsingh@chromium.org>
 
         [chromium] Do not accumulate occlusion from 3d layers on the main thread
index b3da70b..db6c94b 100644 (file)
             'platform/graphics/chromium/cc/CCProxy.h',
             'platform/graphics/chromium/cc/CCQuadCuller.cpp',
             'platform/graphics/chromium/cc/CCQuadCuller.h',
+            'platform/graphics/chromium/cc/CCRenderingStats.h',
             'platform/graphics/chromium/cc/CCRenderPass.cpp',
             'platform/graphics/chromium/cc/CCRenderPass.h',
             'platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp',
index bb6c064..2e21d6d 100644 (file)
@@ -39,6 +39,7 @@
 #include "cc/CCLayerTreeHostImpl.h"
 #include "cc/CCOcclusionTracker.h"
 #include "cc/CCOverdrawMetrics.h"
+#include "cc/CCRenderingStats.h"
 #include "cc/CCSettings.h"
 #include "cc/CCSingleThreadProxy.h"
 #include "cc/CCThreadProxy.h"
@@ -72,7 +73,8 @@ CCLayerTreeHost::CCLayerTreeHost(CCLayerTreeHostClient* client, const CCLayerTre
     , m_animating(false)
     , m_needsAnimateLayers(false)
     , m_client(client)
-    , m_frameNumber(0)
+    , m_animationFrameNumber(0)
+    , m_commitNumber(0)
     , m_frameIsForDisplay(false)
     , m_layerRendererInitialized(false)
     , m_contextLost(false)
@@ -219,6 +221,8 @@ void CCLayerTreeHost::updateAnimations(double monotonicFrameBeginTime)
     m_client->updateAnimations(monotonicFrameBeginTime);
     animateLayers(monotonicFrameBeginTime);
     m_animating = false;
+
+    m_animationFrameNumber++;
 }
 
 void CCLayerTreeHost::layout()
@@ -251,7 +255,7 @@ void CCLayerTreeHost::finishCommitOnImplThread(CCLayerTreeHostImpl* hostImpl)
     if (rootLayer() && m_needsAnimateLayers)
         hostImpl->setNeedsAnimateLayers();
 
-    hostImpl->setSourceFrameNumber(frameNumber());
+    hostImpl->setSourceFrameNumber(commitNumber());
     hostImpl->setViewportSize(viewportSize());
     hostImpl->setDeviceScaleFactor(deviceScaleFactor());
     hostImpl->setPageScaleFactorAndLimits(m_pageScaleFactor, m_minPageScaleFactor, m_maxPageScaleFactor);
@@ -260,7 +264,7 @@ void CCLayerTreeHost::finishCommitOnImplThread(CCLayerTreeHostImpl* hostImpl)
     hostImpl->setVisible(m_visible);
     hostImpl->setSourceFrameCanBeDrawn(m_frameIsForDisplay);
 
-    m_frameNumber++;
+    m_commitNumber++;
 }
 
 void CCLayerTreeHost::commitComplete()
@@ -313,6 +317,12 @@ void CCLayerTreeHost::finishAllRendering()
     m_proxy->finishAllRendering();
 }
 
+void CCLayerTreeHost::renderingStats(CCRenderingStats& stats) const
+{
+    m_proxy->implSideRenderingStats(stats);
+    stats.numAnimationFrames = animationFrameNumber();
+}
+
 const LayerRendererCapabilities& CCLayerTreeHost::layerRendererCapabilities() const
 {
     return m_proxy->layerRendererCapabilities();
index 58b7d2b..f96606d 100644 (file)
@@ -46,6 +46,7 @@ class CCGraphicsContext;
 class CCLayerChromium;
 class CCLayerTreeHostImpl;
 class CCLayerTreeHostImplClient;
+class CCRenderingStats;
 struct CCScrollAndScaleSet;
 class CCTextureUpdater;
 class ManagedTexture;
@@ -192,7 +193,11 @@ public:
 
     void finishAllRendering();
 
-    int frameNumber() const { return m_frameNumber; }
+    int animationFrameNumber() const { return m_animationFrameNumber; }
+
+    int commitNumber() const { return m_commitNumber; }
+
+    void renderingStats(CCRenderingStats&) const;
 
     const LayerRendererCapabilities& layerRendererCapabilities() const;
 
@@ -280,7 +285,8 @@ private:
 
     CCLayerTreeHostClient* m_client;
 
-    int m_frameNumber;
+    int m_animationFrameNumber;
+    int m_commitNumber;
     bool m_frameIsForDisplay;
 
     OwnPtr<CCProxy> m_proxy;
index 94141d6..d8cbe1e 100644 (file)
@@ -113,7 +113,7 @@ PassOwnPtr<CCLayerTreeHostImpl> CCLayerTreeHostImpl::create(const CCLayerTreeSet
 CCLayerTreeHostImpl::CCLayerTreeHostImpl(const CCLayerTreeSettings& settings, CCLayerTreeHostImplClient* client)
     : m_client(client)
     , m_sourceFrameNumber(-1)
-    , m_frameNumber(0)
+    , m_sourceAnimationFrameNumber(0)
     , m_rootScrollLayerImpl(0)
     , m_currentlyScrollingLayerImpl(0)
     , m_scrollingLayerIdFromPreviousTree(-1)
@@ -505,7 +505,7 @@ void CCLayerTreeHostImpl::drawLayers(const FrameData& frame)
 
     m_layerRenderer->finishDrawingFrame();
 
-    ++m_frameNumber;
+    ++m_sourceAnimationFrameNumber;
 
     // The next frame should start by assuming nothing has changed, and changes are noted as they occur.
     m_rootLayerImpl->resetAllChangeTrackingForSubtree();
index 8279124..075b5e0 100644 (file)
@@ -119,7 +119,7 @@ public:
     void setFontAtlas(PassOwnPtr<CCFontAtlas>);
 
     void finishAllRendering();
-    int frameNumber() const { return m_frameNumber; }
+    int sourceAnimationFrameNumber() const { return m_sourceAnimationFrameNumber; }
 
     bool initializeLayerRenderer(PassRefPtr<CCGraphicsContext>, TextureUploaderOption);
     bool isContextLost();
@@ -196,7 +196,7 @@ protected:
 
     CCLayerTreeHostImplClient* m_client;
     int m_sourceFrameNumber;
-    int m_frameNumber;
+    int m_sourceAnimationFrameNumber;
 
 private:
     void computeDoubleTapZoomDeltas(CCScrollAndScaleSet* scrollInfo);
index fb2cbba..3dc60b3 100644 (file)
@@ -34,6 +34,7 @@
 namespace WebCore {
 
 class CCFontAtlas;
+class CCRenderingStats;
 class CCThread;
 class CCGraphicsContext;
 struct LayerRendererCapabilities;
@@ -79,6 +80,8 @@ public:
 
     virtual int compositorIdentifier() const = 0;
 
+    virtual void implSideRenderingStats(CCRenderingStats&) = 0;
+
     virtual const LayerRendererCapabilities& layerRendererCapabilities() const = 0;
 
     virtual void setNeedsAnimate() = 0;
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderingStats.h b/Source/WebCore/platform/graphics/chromium/cc/CCRenderingStats.h
new file mode 100644 (file)
index 0000000..f69c8e0
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CCRenderingStats_h
+#define CCRenderingStats_h
+
+namespace WebCore {
+
+struct CCRenderingStats {
+    int numAnimationFrames;
+    int numFramesSentToScreen;
+
+    CCRenderingStats()
+        : numAnimationFrames(0)
+        , numFramesSentToScreen(0)
+    {
+    }
+};
+
+}
+
+#endif
index 14cdf1c..c0f77af 100644 (file)
@@ -31,6 +31,7 @@
 #include "cc/CCFontAtlas.h"
 #include "cc/CCGraphicsContext.h"
 #include "cc/CCLayerTreeHost.h"
+#include "cc/CCRenderingStats.h"
 #include "cc/CCTextureUpdater.h"
 #include "cc/CCTimer.h"
 #include <wtf/CurrentTime.h>
@@ -198,6 +199,11 @@ bool CCSingleThreadProxy::recreateContext()
     return initialized;
 }
 
+void CCSingleThreadProxy::implSideRenderingStats(CCRenderingStats& stats)
+{
+    stats.numFramesSentToScreen = m_layerTreeHostImpl->sourceAnimationFrameNumber();
+}
+
 const LayerRendererCapabilities& CCSingleThreadProxy::layerRendererCapabilities() const
 {
     ASSERT(m_layerRendererInitialized);
index 93c128b..2d7bf76 100644 (file)
@@ -52,6 +52,7 @@ public:
     virtual bool initializeLayerRenderer() OVERRIDE;
     virtual bool recreateContext() OVERRIDE;
     virtual int compositorIdentifier() const OVERRIDE { return m_compositorIdentifier; }
+    virtual void implSideRenderingStats(CCRenderingStats&) OVERRIDE;
     virtual const LayerRendererCapabilities& layerRendererCapabilities() const OVERRIDE;
     virtual void loseContext() OVERRIDE;
     virtual void setNeedsAnimate() OVERRIDE;
index a9bfbc1..4509a7e 100644 (file)
@@ -36,6 +36,7 @@
 #include "cc/CCGraphicsContext.h"
 #include "cc/CCInputHandler.h"
 #include "cc/CCLayerTreeHost.h"
+#include "cc/CCRenderingStats.h"
 #include "cc/CCScheduler.h"
 #include "cc/CCScopedThreadProxy.h"
 #include "cc/CCTextureUpdater.h"
@@ -267,6 +268,17 @@ int CCThreadProxy::compositorIdentifier() const
     return m_compositorIdentifier;
 }
 
+void CCThreadProxy::implSideRenderingStats(CCRenderingStats& stats)
+{
+    ASSERT(isMainThread());
+
+    CCCompletionEvent completion;
+    CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::implSideRenderingStatsOnImplThread,
+                                                       AllowCrossThreadAccess(&completion),
+                                                       AllowCrossThreadAccess(&stats)));
+    completion.wait();
+}
+
 const LayerRendererCapabilities& CCThreadProxy::layerRendererCapabilities() const
 {
     ASSERT(m_layerRendererInitialized);
@@ -880,4 +892,11 @@ void CCThreadProxy::recreateContextOnImplThread(CCCompletionEvent* completion, C
     completion->signal();
 }
 
+void CCThreadProxy::implSideRenderingStatsOnImplThread(CCCompletionEvent* completion, CCRenderingStats* stats)
+{
+    ASSERT(isImplThread());
+    stats->numFramesSentToScreen = m_layerTreeHostImpl->sourceAnimationFrameNumber();
+    completion->signal();
+}
+
 } // namespace WebCore
index 5521f2f..cff6207 100644 (file)
@@ -59,6 +59,7 @@ public:
     virtual bool initializeLayerRenderer() OVERRIDE;
     virtual bool recreateContext() OVERRIDE;
     virtual int compositorIdentifier() const OVERRIDE;
+    virtual void implSideRenderingStats(CCRenderingStats&) OVERRIDE;
     virtual const LayerRendererCapabilities& layerRendererCapabilities() const OVERRIDE;
     virtual void loseContext() OVERRIDE;
     virtual void setNeedsAnimate() OVERRIDE;
@@ -140,6 +141,7 @@ private:
     void setFullRootLayerDamageOnImplThread();
     void acquireLayerTexturesForMainThreadOnImplThread(CCCompletionEvent*);
     void recreateContextOnImplThread(CCCompletionEvent*, CCGraphicsContext*, bool* recreateSucceeded, LayerRendererCapabilities*);
+    void implSideRenderingStatsOnImplThread(CCCompletionEvent*, CCRenderingStats*);
     CCScheduledActionDrawAndSwapResult scheduledActionDrawAndSwapInternal(bool forcedDraw);
     void setFontAtlasOnImplThread(PassOwnPtr<CCFontAtlas>);
     void forceSerializeOnSwapBuffersOnImplThread(CCCompletionEvent*);
index 0d05bbc..db069c8 100644 (file)
@@ -1,3 +1,17 @@
+2012-06-22  Dave Tu  <dtu@chromium.org>
+
+        [chromium] Expose rendering statistics to WebWidget.
+        https://bugs.webkit.org/show_bug.cgi?id=88268
+
+        Reviewed by James Robinson.
+
+        The WebKit side of a basic framework for exposing rendering statistics
+        to Chromium's --enable-benchmarking extension.
+
+        * src/WebLayerTreeView.cpp:
+        (WebKit::WebLayerTreeView::renderingStatistics):
+        (WebKit):
+
 2012-06-22  Shawn Singh  <shawnsingh@chromium.org>
 
         [chromium] Do not accumulate occlusion from 3d layers on the main thread
index c152982..e857262 100644 (file)
@@ -62,6 +62,7 @@ struct WebActiveWheelFlingParameters;
 struct WebMediaPlayerAction;
 struct WebPluginAction;
 struct WebPoint;
+struct WebRenderingStats;
 
 class WebView : public WebWidget {
 public:
@@ -459,6 +460,10 @@ public:
 
     virtual bool setEditableSelectionOffsets(int start, int end) = 0;
 
+    // Fills in a WebRenderingStats struct containing information about the state of the compositor.
+    // This call is relatively expensive in threaded mode as it blocks on the compositor thread.
+    virtual void renderingStats(WebRenderingStats&) const { }
+
     // Visibility -----------------------------------------------------------
 
     // Sets the visibility of the WebView.
index 356af1d..c2d84fe 100644 (file)
 #include "WebLayerTreeViewImpl.h"
 #include "cc/CCGraphicsContext.h"
 #include "cc/CCLayerTreeHost.h"
+#include "cc/CCRenderingStats.h"
 #include "platform/WebLayer.h"
 #include "platform/WebPoint.h"
 #include "platform/WebRect.h"
 #include "platform/WebSize.h"
+#include <public/WebRenderingStats.h>
 
 using namespace WebCore;
 
@@ -178,6 +180,15 @@ WebGraphicsContext3D* WebLayerTreeView::context()
     return GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_private->layerTreeHost()->context()->context3D());
 }
 
+void WebLayerTreeView::renderingStats(WebRenderingStats& stats) const
+{
+    CCRenderingStats ccStats;
+    m_private->layerTreeHost()->renderingStats(ccStats);
+
+    stats.numAnimationFrames = ccStats.numAnimationFrames;
+    stats.numFramesSentToScreen = ccStats.numFramesSentToScreen;
+}
+
 void WebLayerTreeView::loseCompositorContext(int numTimes)
 {
     m_private->layerTreeHost()->loseContext(numTimes);
index d2393c3..8e939aa 100644 (file)
@@ -728,6 +728,13 @@ void WebViewImpl::transferActiveWheelFlingAnimation(const WebActiveWheelFlingPar
     scheduleAnimation();
 }
 
+void WebViewImpl::renderingStats(WebRenderingStats& stats) const
+{
+    ASSERT(isAcceleratedCompositingActive());
+    if (!m_layerTreeView.isNull())
+        m_layerTreeView.renderingStats(stats);
+}
+
 void WebViewImpl::startPageScaleAnimation(const IntPoint& scroll, bool useAnchor, float newScale, double durationSec)
 {
     if (!m_layerTreeView.isNull())
index d4527da..284b478 100644 (file)
@@ -293,6 +293,7 @@ public:
     virtual void updateBatteryStatus(const WebBatteryStatus&);
 #endif
     virtual void transferActiveWheelFlingAnimation(const WebActiveWheelFlingParameters&);
+    virtual void renderingStats(WebRenderingStats&) const;
 
     // WebLayerTreeViewClient
     virtual void willBeginFrame();
index 4a2fd31..12f3a82 100644 (file)
@@ -832,7 +832,7 @@ public:
     virtual void layout()
     {
         LayerChromium* root = m_layerTreeHost->rootLayer();
-        if (!m_layerTreeHost->frameNumber())
+        if (!m_layerTreeHost->commitNumber())
             EXPECT_EQ(root->scrollPosition(), m_initialScroll);
         else {
             EXPECT_EQ(root->scrollPosition(), m_initialScroll + m_scrollAmount);
@@ -918,7 +918,7 @@ public:
         root->setScrollable(true);
         root->setMaxScrollPosition(IntSize(100, 100));
 
-        if (!impl->sourceFrameNumber() && impl->frameNumber() == 1) {
+        if (!impl->sourceFrameNumber() && impl->sourceAnimationFrameNumber() == 1) {
             // First draw after first commit.
             EXPECT_EQ(root->scrollDelta(), IntSize());
             root->scrollBy(m_scrollAmount);
@@ -926,7 +926,7 @@ public:
 
             EXPECT_EQ(root->scrollPosition(), m_initialScroll);
             postSetNeedsRedrawToMainThread();
-        } else if (!impl->sourceFrameNumber() && impl->frameNumber() == 2) {
+        } else if (!impl->sourceFrameNumber() && impl->sourceAnimationFrameNumber() == 2) {
             // Second draw after first commit.
             EXPECT_EQ(root->scrollDelta(), m_scrollAmount);
             root->scrollBy(m_scrollAmount);
@@ -936,7 +936,7 @@ public:
             postSetNeedsCommitToMainThread();
         } else if (impl->sourceFrameNumber() == 1) {
             // Third or later draw after second commit.
-            EXPECT_GE(impl->frameNumber(), 3);
+            EXPECT_GE(impl->sourceAnimationFrameNumber(), 3);
             EXPECT_EQ(root->scrollDelta(), IntSize());
             EXPECT_EQ(root->scrollPosition(), m_initialScroll + m_scrollAmount + m_scrollAmount);
             endTest();
@@ -1009,7 +1009,7 @@ public:
 
     virtual void didCommitAndDrawFrame()
     {
-        int lastFrame = m_layerTreeHost->frameNumber() - 1;
+        int lastFrame = m_layerTreeHost->commitNumber() - 1;
 
         // These frames should draw.
         switch (lastFrame) {
@@ -1040,7 +1040,7 @@ public:
 
     virtual void didCommit()
     {
-        int lastFrame = m_layerTreeHost->frameNumber() - 1;
+        int lastFrame = m_layerTreeHost->commitNumber() - 1;
 
         // These frames should not draw.
         switch (lastFrame) {
@@ -2308,7 +2308,7 @@ public:
     virtual void beginCommitOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE
     {
         EXPECT_EQ(m_rootScrollLayer->scrollPosition(), IntPoint());
-        if (!m_layerTreeHost->frameNumber())
+        if (!m_layerTreeHost->commitNumber())
             EXPECT_EQ(m_childLayer->scrollPosition(), IntPoint());
         else
             EXPECT_EQ(m_childLayer->scrollPosition(), IntPoint() + m_scrollAmount);
@@ -2316,11 +2316,11 @@ public:
 
     virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) OVERRIDE
     {
-        if (impl->frameNumber() == 1) {
+        if (impl->sourceAnimationFrameNumber() == 1) {
             EXPECT_EQ(impl->scrollBegin(IntPoint(5, 5), CCInputHandlerClient::Wheel), CCInputHandlerClient::ScrollStarted);
             impl->scrollBy(m_scrollAmount);
             impl->scrollEnd();
-        } else if (impl->frameNumber() == 2)
+        } else if (impl->sourceAnimationFrameNumber() == 2)
             endTest();
     }