[chromium] Fix Renderer4.CompositorThreadImplDrawDelay histogram.
https://bugs.webkit.org/show_bug.cgi?id=93159

Patch by Dave Tu <dtu@chromium.org> on 2012-08-03
Reviewed by Adrienne Walker.

The histogram is using the frame number instead of the frame time by mistake.

* platform/graphics/chromium/cc/CCFrameRateCounter.cpp:
(WebCore::CCFrameRateCounter::markBeginningOfFrame):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@124677 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 491f41c..3bed2f4 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,15 @@
+2012-08-03  Dave Tu  <dtu@chromium.org>
+
+        [chromium] Fix Renderer4.CompositorThreadImplDrawDelay histogram.
+        https://bugs.webkit.org/show_bug.cgi?id=93159
+
+        Reviewed by Adrienne Walker.
+
+        The histogram is using the frame number instead of the frame time by mistake.
+
+        * platform/graphics/chromium/cc/CCFrameRateCounter.cpp:
+        (WebCore::CCFrameRateCounter::markBeginningOfFrame):
+
 2012-08-03  David Grogan  <dgrogan@chromium.org>
 
         IndexedDB: Core upgradeneeded logic
diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateCounter.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateCounter.cpp
index ac2956a..e34225a 100644
--- a/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateCounter.cpp
+++ b/Source/WebCore/platform/graphics/chromium/cc/CCFrameRateCounter.cpp
@@ -66,17 +66,15 @@
 
 void CCFrameRateCounter::markBeginningOfFrame(double timestamp)
 {
-    if (CCProxy::hasImplThread() && m_currentFrameNumber > 0) {
-        double lastFrameTimestamp = frameIndex(m_currentFrameNumber - 1);
-        double drawDelaySeconds = timestamp - lastFrameTimestamp;
-        double drawDelayMs = drawDelaySeconds * 1000.0;
+    m_timeStampHistory[frameIndex(m_currentFrameNumber)] = timestamp;
+    double frameIntervalSeconds = frameInterval(m_currentFrameNumber);
 
+    if (CCProxy::hasImplThread() && m_currentFrameNumber > 0) {
+        double drawDelayMs = frameIntervalSeconds * 1000.0;
         WebKit::Platform::current()->histogramCustomCounts("Renderer4.CompositorThreadImplDrawDelay", static_cast<int>(drawDelayMs), 1, 120, 60);
     }
 
-    m_timeStampHistory[frameIndex(m_currentFrameNumber)] = timestamp;
-    double delta = frameInterval(m_currentFrameNumber);
-    if (!isBadFrameInterval(delta) && delta > kDroppedFrameTime)
+    if (!isBadFrameInterval(frameIntervalSeconds) && frameIntervalSeconds > kDroppedFrameTime)
         ++m_droppedFrameCount;
 }