Track the frequency of impl-thread scrolling vs. main-thread scrolling by introducing the counters |numImplThreadScrolls| and |numMainThreadScrolls|.  These values will be reported as part of the GPU scrolling benchmarks.

BUG=152249


Review URL: https://chromiumcodereview.appspot.com/10985082

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@159921 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/cc/CCLayerTreeHostImpl.cpp b/cc/CCLayerTreeHostImpl.cpp
index c9255a52..5b1a23d 100644
--- a/cc/CCLayerTreeHostImpl.cpp
+++ b/cc/CCLayerTreeHostImpl.cpp
@@ -131,6 +131,8 @@
     , m_pinchGestureActive(false)
     , m_fpsCounter(CCFrameRateCounter::create())
     , m_debugRectHistory(CCDebugRectHistory::create())
+    , m_numImplThreadScrolls(0)
+    , m_numMainThreadScrolls(0)
 {
     ASSERT(CCProxy::isImplThread());
     didVisibilityChange(this, m_visible);
@@ -925,8 +927,10 @@
     CCLayerImpl* potentiallyScrollingLayerImpl = 0;
     for (; layerImpl; layerImpl = layerImpl->parent()) {
         // The content layer can also block attempts to scroll outside the main thread.
-        if (layerImpl->tryScroll(deviceViewportPoint, type) == ScrollOnMainThread)
+        if (layerImpl->tryScroll(deviceViewportPoint, type) == ScrollOnMainThread) {
+            m_numMainThreadScrolls++;
             return ScrollOnMainThread;
+        }
 
         CCLayerImpl* scrollLayerImpl = findScrollLayerForContentLayer(layerImpl);
         if (!scrollLayerImpl)
@@ -935,8 +939,10 @@
         ScrollStatus status = scrollLayerImpl->tryScroll(viewportPoint, type);
 
         // If any layer wants to divert the scroll event to the main thread, abort.
-        if (status == ScrollOnMainThread)
+        if (status == ScrollOnMainThread) {
+            m_numMainThreadScrolls++;
             return ScrollOnMainThread;
+        }
 
         if (status == ScrollStarted && !potentiallyScrollingLayerImpl)
             potentiallyScrollingLayerImpl = scrollLayerImpl;
@@ -948,6 +954,7 @@
         // so that the scrolling contents exactly follow the user's finger. In contrast, wheel
         // events are already in local layer coordinates so we can just apply them directly.
         m_scrollDeltaIsInScreenSpace = (type == Gesture);
+        m_numImplThreadScrolls++;
         return ScrollStarted;
     }
     return ScrollIgnored;
@@ -1299,6 +1306,8 @@
 {
     stats->numFramesSentToScreen = fpsCounter()->currentFrameNumber();
     stats->droppedFrameCount = fpsCounter()->droppedFrameCount();
+    stats->numImplThreadScrolls = m_numImplThreadScrolls;
+    stats->numMainThreadScrolls = m_numMainThreadScrolls;
 }
 
 void CCLayerTreeHostImpl::animateScrollbars(double monotonicTime)