Title: [95404] trunk
Revision
95404
Author
loi...@chromium.org
Date
2011-09-19 00:36:12 -0700 (Mon, 19 Sep 2011)

Log Message

2011-09-18  Ilya Tikhonovsky  <loi...@chromium.org>

        Web Inspector: requestAnimationFrame callbacks don't show up in the timeline panel.
        https://bugs.webkit.org/show_bug.cgi?id=67986

        Reviewed by Pavel Feldman.

        Test: inspector/timeline/timeline-animation-frame.html

	WebCore:

        * English.lproj/localizedStrings.js:
        * bindings/v8/V8Proxy.cpp:
        (WebCore::V8Proxy::callFunction):
        (WebCore::V8Proxy::callFunctionWithoutFrame):
        (WebCore::V8Proxy::instrumentedCallFunction):
        * bindings/v8/V8Proxy.h:
        * bindings/v8/custom/V8CustomVoidCallback.cpp:
        (WebCore::invokeCallback):
        * dom/ScriptedAnimationController.cpp:
        (WebCore::ScriptedAnimationController::registerCallback):
        (WebCore::ScriptedAnimationController::cancelCallback):
        (WebCore::ScriptedAnimationController::serviceScriptedAnimations):
        * inspector/InspectorInstrumentation.cpp:
        (WebCore::InspectorInstrumentation::didRegisterAnimationFrameCallbackImpl):
        (WebCore::InspectorInstrumentation::didCancelAnimationFrameCallbackImpl):
        (WebCore::InspectorInstrumentation::willFireAnimationFrameEventImpl):
        (WebCore::InspectorInstrumentation::didFireAnimationFrameEventImpl):
        * inspector/InspectorInstrumentation.h:
        (WebCore::InspectorInstrumentation::willCallFunction):
        (WebCore::InspectorInstrumentation::didRegisterAnimationFrameCallback):
        (WebCore::InspectorInstrumentation::didCancelAnimationFrameCallback):
        (WebCore::InspectorInstrumentation::willFireAnimationFrameEvent):
        (WebCore::InspectorInstrumentation::didFireAnimationFrameEvent):
        * inspector/InspectorTimelineAgent.cpp:
        (WebCore::InspectorTimelineAgent::didRegisterAnimationFrameCallback):
        (WebCore::InspectorTimelineAgent::didCancelAnimationFrameCallback):
        (WebCore::InspectorTimelineAgent::willFireAnimationFrameEvent):
        (WebCore::InspectorTimelineAgent::didFireAnimationFrameEvent):
        * inspector/InspectorTimelineAgent.h:
        * inspector/TimelineRecordFactory.cpp:
        (WebCore::TimelineRecordFactory::createAnimationFrameCallbackData):
        * inspector/TimelineRecordFactory.h:
        * inspector/front-end/TimelineAgent.js:
        * inspector/front-end/TimelinePanel.js:
        (WebInspector.TimelinePanel):
        (WebInspector.TimelinePanel.prototype.get _recordStyles):
        (WebInspector.TimelinePanel.prototype._innerAddRecordToTimeline):
        (WebInspector.TimelinePanel.prototype._clearPanel):
        (WebInspector.TimelinePanel.FormattedRecord):
        (WebInspector.TimelinePanel.FormattedRecord.prototype._generatePopupContent):
        (WebInspector.TimelinePanel.FormattedRecord.prototype._getRecordDetails):

        LayoutTests:

        * inspector/timeline/timeline-animation-frame-expected.txt: Added.
        * inspector/timeline/timeline-animation-frame.html: Added.
        * inspector/timeline/timeline-enum-stability-expected.txt:
        * platform/chromium/inspector/timeline/timeline-enum-stability-expected.txt:
        * platform/qt/Skipped: inspector/timeline/timeline-animation-frame.html was added to the skip list.
        * inspector/timeline/timeline-test.js:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (95403 => 95404)


--- trunk/LayoutTests/ChangeLog	2011-09-19 07:31:19 UTC (rev 95403)
+++ trunk/LayoutTests/ChangeLog	2011-09-19 07:36:12 UTC (rev 95404)
@@ -1,3 +1,17 @@
+2011-09-18  Ilya Tikhonovsky  <loi...@chromium.org>
+
+        Web Inspector: requestAnimationFrame callbacks don't show up in the timeline panel.
+        https://bugs.webkit.org/show_bug.cgi?id=67986
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/timeline/timeline-animation-frame-expected.txt: Added.
+        * inspector/timeline/timeline-animation-frame.html: Added.
+        * inspector/timeline/timeline-enum-stability-expected.txt:
+        * platform/chromium/inspector/timeline/timeline-enum-stability-expected.txt:
+        * platform/qt/Skipped: inspector/timeline/timeline-animation-frame.html was added to the skip list.
+        * inspector/timeline/timeline-test.js:
+
 2011-09-18  James Kozianski  <k...@chromium.org>
 
         Rebaseline navigator test for chromium-win-vista.

Added: trunk/LayoutTests/inspector/timeline/timeline-animation-frame-expected.txt (0 => 95404)


--- trunk/LayoutTests/inspector/timeline/timeline-animation-frame-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector/timeline/timeline-animation-frame-expected.txt	2011-09-19 07:36:12 UTC (rev 95404)
@@ -0,0 +1,35 @@
+Tests the Timeline events for Animation Frame feature
+
+RegisterAnimationFrameCallback Properties:
+{
+    startTime : <number>
+    data : {
+        id : <number>
+    }
+    type : "RegisterAnimationFrameCallback"
+    usedHeapSize : <number>
+    totalHeapSize : <number>
+}
+FireAnimationFrameEvent Properties:
+{
+    startTime : <number>
+    data : {
+        id : <number>
+    }
+    children : <object>
+    endTime : <number>
+    type : "FireAnimationFrameEvent"
+    usedHeapSize : <number>
+    totalHeapSize : <number>
+}
+CancelAnimationFrameCallback Properties:
+{
+    startTime : <number>
+    data : {
+        id : <number>
+    }
+    type : "CancelAnimationFrameCallback"
+    usedHeapSize : <number>
+    totalHeapSize : <number>
+}
+
Property changes on: trunk/LayoutTests/inspector/timeline/timeline-animation-frame-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/inspector/timeline/timeline-animation-frame.html (0 => 95404)


--- trunk/LayoutTests/inspector/timeline/timeline-animation-frame.html	                        (rev 0)
+++ trunk/LayoutTests/inspector/timeline/timeline-animation-frame.html	2011-09-19 07:36:12 UTC (rev 95404)
@@ -0,0 +1,60 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+
+function performActions()
+{
+    var element = document.getElementById("animation");
+    var requestId = window.webkitRequestAnimationFrame(animationFrameCallback, element);
+    function animationFrameCallback()
+    {
+        window.webkitCancelRequestAnimationFrame(requestId);
+    }
+
+    if (window.layoutTestController)
+        layoutTestController.display();
+}
+
+function test()
+{
+    InspectorTest.startTimeline(function() {
+        InspectorTest.evaluateInPage("performActions()");
+    });
+
+    WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.EventTypes.TimelineEventRecorded, function(event) {
+        addRecord(event.data);
+    });
+
+    function addRecord(record)
+    {
+        if (record.type !== WebInspector.TimelineAgent.RecordType["CancelAnimationFrameCallback"]) {
+            for (var i = 0; record.children && i < record.children.length; ++i)
+                addRecord(record.children[i]);
+            return ;
+        }
+
+        InspectorTest.printTimelineRecords("RegisterAnimationFrameCallback");
+        InspectorTest.printTimelineRecords("FireAnimationFrameEvent");
+        InspectorTest.printTimelineRecords("CancelAnimationFrameCallback");
+        InspectorTest.completeTest();
+    }
+}
+
+if (!window.layoutTestController)
+    setTimeout(performActions, 2000);
+
+</script>
+</head>
+
+<body _onload_="runTest()">
+<p>
+Tests the Timeline events for Animation Frame feature
+</p>
+<div id="animation">
+
+</div>
+
+</body>
+</html>
Property changes on: trunk/LayoutTests/inspector/timeline/timeline-animation-frame.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/LayoutTests/inspector/timeline/timeline-enum-stability-expected.txt (95403 => 95404)


--- trunk/LayoutTests/inspector/timeline/timeline-enum-stability-expected.txt	2011-09-19 07:31:19 UTC (rev 95403)
+++ trunk/LayoutTests/inspector/timeline/timeline-enum-stability-expected.txt	2011-09-19 07:36:12 UTC (rev 95404)
@@ -24,5 +24,8 @@
     ResourceFinish : "ResourceFinish"
     FunctionCall : "FunctionCall"
     GCEvent : "GCEvent"
+    RegisterAnimationFrameCallback : "RegisterAnimationFrameCallback"
+    CancelAnimationFrameCallback : "CancelAnimationFrameCallback"
+    FireAnimationFrameEvent : "FireAnimationFrameEvent"
 }
 

Modified: trunk/LayoutTests/inspector/timeline/timeline-test.js (95403 => 95404)


--- trunk/LayoutTests/inspector/timeline/timeline-test.js	2011-09-19 07:31:19 UTC (rev 95403)
+++ trunk/LayoutTests/inspector/timeline/timeline-test.js	2011-09-19 07:36:12 UTC (rev 95404)
@@ -2,17 +2,18 @@
 
 // Scrub values when printing out these properties in the record or data field.
 InspectorTest.timelineNonDeterministicProps = { 
-    children : 1,
-    endTime : 1, 
-    height : 1,
-    requestId : 1,
-    startTime : 1,
-    width : 1,
+    children: 1,
+    endTime: 1,
+    height: 1,
+    requestId: 1,
+    startTime: 1,
+    width: 1,
     stackTrace: 1,
-    url : 1,
+    url: 1,
     usedHeapSize: 1,
     totalHeapSize: 1,
-    mimeType : 1
+    mimeType: 1,
+    id: 1
 };
 
 InspectorTest.startTimeline = function(callback)

Added: trunk/LayoutTests/platform/chromium/inspector/timeline/timeline-animation-frame-expected.txt (0 => 95404)


--- trunk/LayoutTests/platform/chromium/inspector/timeline/timeline-animation-frame-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium/inspector/timeline/timeline-animation-frame-expected.txt	2011-09-19 07:36:12 UTC (rev 95404)
@@ -0,0 +1,38 @@
+Tests the Timeline events for Animation Frame feature
+
+RegisterAnimationFrameCallback Properties:
+{
+    startTime : <number>
+    stackTrace : <object>
+    data : {
+        id : <number>
+    }
+    type : "RegisterAnimationFrameCallback"
+    usedHeapSize : <number>
+    totalHeapSize : <number>
+}
+FireAnimationFrameEvent Properties:
+{
+    startTime : <number>
+    stackTrace : <object>
+    data : {
+        id : <number>
+    }
+    children : <object>
+    endTime : <number>
+    type : "FireAnimationFrameEvent"
+    usedHeapSize : <number>
+    totalHeapSize : <number>
+}
+CancelAnimationFrameCallback Properties:
+{
+    startTime : <number>
+    stackTrace : <object>
+    data : {
+        id : <number>
+    }
+    type : "CancelAnimationFrameCallback"
+    usedHeapSize : <number>
+    totalHeapSize : <number>
+}
+
Property changes on: trunk/LayoutTests/platform/chromium/inspector/timeline/timeline-animation-frame-expected.txt
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/LayoutTests/platform/qt/Skipped (95403 => 95404)


--- trunk/LayoutTests/platform/qt/Skipped	2011-09-19 07:31:19 UTC (rev 95403)
+++ trunk/LayoutTests/platform/qt/Skipped	2011-09-19 07:36:12 UTC (rev 95404)
@@ -86,6 +86,7 @@
 
 # ENABLE(REQUEST_ANIMATION_FRAME) is disabled.
 fast/animation
+inspector/timeline/timeline-animation-frame.html
 
 # ENABLE(ANIMATION_API) is disabled.
 animations/animation-api-1.html

Modified: trunk/Source/WebCore/ChangeLog (95403 => 95404)


--- trunk/Source/WebCore/ChangeLog	2011-09-19 07:31:19 UTC (rev 95403)
+++ trunk/Source/WebCore/ChangeLog	2011-09-19 07:36:12 UTC (rev 95404)
@@ -1,3 +1,54 @@
+2011-09-18  Ilya Tikhonovsky  <loi...@chromium.org>
+
+        Web Inspector: requestAnimationFrame callbacks don't show up in the timeline panel.
+        https://bugs.webkit.org/show_bug.cgi?id=67986
+
+        Reviewed by Pavel Feldman.
+
+        Test: inspector/timeline/timeline-animation-frame.html
+
+        * English.lproj/localizedStrings.js:
+        * bindings/v8/V8Proxy.cpp:
+        (WebCore::V8Proxy::callFunction):
+        (WebCore::V8Proxy::callFunctionWithoutFrame):
+        (WebCore::V8Proxy::instrumentedCallFunction):
+        * bindings/v8/V8Proxy.h:
+        * bindings/v8/custom/V8CustomVoidCallback.cpp:
+        (WebCore::invokeCallback):
+        * dom/ScriptedAnimationController.cpp:
+        (WebCore::ScriptedAnimationController::registerCallback):
+        (WebCore::ScriptedAnimationController::cancelCallback):
+        (WebCore::ScriptedAnimationController::serviceScriptedAnimations):
+        * inspector/InspectorInstrumentation.cpp:
+        (WebCore::InspectorInstrumentation::didRegisterAnimationFrameCallbackImpl):
+        (WebCore::InspectorInstrumentation::didCancelAnimationFrameCallbackImpl):
+        (WebCore::InspectorInstrumentation::willFireAnimationFrameEventImpl):
+        (WebCore::InspectorInstrumentation::didFireAnimationFrameEventImpl):
+        * inspector/InspectorInstrumentation.h:
+        (WebCore::InspectorInstrumentation::willCallFunction):
+        (WebCore::InspectorInstrumentation::didRegisterAnimationFrameCallback):
+        (WebCore::InspectorInstrumentation::didCancelAnimationFrameCallback):
+        (WebCore::InspectorInstrumentation::willFireAnimationFrameEvent):
+        (WebCore::InspectorInstrumentation::didFireAnimationFrameEvent):
+        * inspector/InspectorTimelineAgent.cpp:
+        (WebCore::InspectorTimelineAgent::didRegisterAnimationFrameCallback):
+        (WebCore::InspectorTimelineAgent::didCancelAnimationFrameCallback):
+        (WebCore::InspectorTimelineAgent::willFireAnimationFrameEvent):
+        (WebCore::InspectorTimelineAgent::didFireAnimationFrameEvent):
+        * inspector/InspectorTimelineAgent.h:
+        * inspector/TimelineRecordFactory.cpp:
+        (WebCore::TimelineRecordFactory::createAnimationFrameCallbackData):
+        * inspector/TimelineRecordFactory.h:
+        * inspector/front-end/TimelineAgent.js:
+        * inspector/front-end/TimelinePanel.js:
+        (WebInspector.TimelinePanel):
+        (WebInspector.TimelinePanel.prototype.get _recordStyles):
+        (WebInspector.TimelinePanel.prototype._innerAddRecordToTimeline):
+        (WebInspector.TimelinePanel.prototype._clearPanel):
+        (WebInspector.TimelinePanel.FormattedRecord):
+        (WebInspector.TimelinePanel.FormattedRecord.prototype._generatePopupContent):
+        (WebInspector.TimelinePanel.FormattedRecord.prototype._getRecordDetails):
+
 2011-09-19  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [GTK] Fix distcheck build

Modified: trunk/Source/WebCore/English.lproj/localizedStrings.js


(Binary files differ)

Modified: trunk/Source/WebCore/bindings/v8/V8Proxy.cpp (95403 => 95404)


--- trunk/Source/WebCore/bindings/v8/V8Proxy.cpp	2011-09-19 07:31:19 UTC (rev 95403)
+++ trunk/Source/WebCore/bindings/v8/V8Proxy.cpp	2011-09-19 07:36:12 UTC (rev 95404)
@@ -477,23 +477,9 @@
             return result;
         }
 
-        InspectorInstrumentationCookie cookie;
-        if (InspectorInstrumentation::hasFrontends()) {
-            v8::ScriptOrigin origin = function->GetScriptOrigin();
-            String resourceName("undefined");
-            int lineNumber = 1;
-            if (!origin.ResourceName().IsEmpty()) {
-                resourceName = toWebCoreString(origin.ResourceName());
-                lineNumber = function->GetScriptLineNumber() + 1;
-            }
-            cookie = InspectorInstrumentation::willCallFunction(m_frame, resourceName, lineNumber);
-        }
-
         m_recursion++;
-        result = function->Call(receiver, argc, args);
+        result = V8Proxy::instrumentedCallFunction(m_frame->page(), function, receiver, argc, args);
         m_recursion--;
-
-        InspectorInstrumentation::didCallFunction(cookie);
     }
 
     // Release the storage mutex if applicable.
@@ -516,6 +502,24 @@
     return result;
 }
 
+v8::Local<v8::Value> V8Proxy::instrumentedCallFunction(Page* page, v8::Handle<v8::Function> function, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[])
+{
+    InspectorInstrumentationCookie cookie;
+    if (InspectorInstrumentation::hasFrontends()) {
+        String resourceName("undefined");
+        int lineNumber = 1;
+        v8::ScriptOrigin origin = function->GetScriptOrigin();
+        if (!origin.ResourceName().IsEmpty()) {
+            resourceName = toWebCoreString(origin.ResourceName());
+            lineNumber = function->GetScriptLineNumber() + 1;
+        }
+        cookie = InspectorInstrumentation::willCallFunction(page, resourceName, lineNumber);
+    }
+    v8::Local<v8::Value> result = function->Call(receiver, argc, args);
+    InspectorInstrumentation::didCallFunction(cookie);
+    return result;
+}
+
 v8::Local<v8::Value> V8Proxy::newInstance(v8::Handle<v8::Function> constructor, int argc, v8::Handle<v8::Value> args[])
 {
     // No artificial limitations on the depth of recursion, see comment in

Modified: trunk/Source/WebCore/bindings/v8/V8Proxy.h (95403 => 95404)


--- trunk/Source/WebCore/bindings/v8/V8Proxy.h	2011-09-19 07:31:19 UTC (rev 95403)
+++ trunk/Source/WebCore/bindings/v8/V8Proxy.h	2011-09-19 07:36:12 UTC (rev 95404)
@@ -57,6 +57,7 @@
     class DOMWindow;
     class Frame;
     class Node;
+    class Page;
     class ScriptExecutionContext;
     class ScriptSourceCode;
     class SecurityOrigin;
@@ -173,6 +174,9 @@
         // Call the function with the given receiver and arguments.
         static v8::Local<v8::Value> callFunctionWithoutFrame(v8::Handle<v8::Function>, v8::Handle<v8::Object>, int argc, v8::Handle<v8::Value> argv[]);
 
+        // call the function with the given receiver and arguments and report times to DevTools.
+        static v8::Local<v8::Value> instrumentedCallFunction(Page*, v8::Handle<v8::Function>, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[]);
+
         // Call the function as constructor with the given arguments.
         v8::Local<v8::Value> newInstance(v8::Handle<v8::Function>, int argc, v8::Handle<v8::Value> argv[]);
 

Modified: trunk/Source/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp (95403 => 95404)


--- trunk/Source/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp	2011-09-19 07:31:19 UTC (rev 95403)
+++ trunk/Source/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp	2011-09-19 07:36:12 UTC (rev 95404)
@@ -83,7 +83,9 @@
 
     v8::Handle<v8::Object> thisObject = v8::Context::GetCurrent()->Global();
 
-    v8::Handle<v8::Value> result = callbackFunction->Call(thisObject, argc, argv);
+    Page* page = scriptExecutionContext && scriptExecutionContext->isDocument() ? static_cast<Document*>(scriptExecutionContext)->page() : 0;
+    v8::Handle<v8::Value> result = V8Proxy::instrumentedCallFunction(page, callbackFunction, thisObject, argc, argv);
+
     callbackReturnValue = !result.IsEmpty() && result->BooleanValue();
     return exceptionCatcher.HasCaught();
 }

Modified: trunk/Source/WebCore/dom/ScriptedAnimationController.cpp (95403 => 95404)


--- trunk/Source/WebCore/dom/ScriptedAnimationController.cpp	2011-09-19 07:31:19 UTC (rev 95403)
+++ trunk/Source/WebCore/dom/ScriptedAnimationController.cpp	2011-09-19 07:36:12 UTC (rev 95404)
@@ -31,6 +31,7 @@
 #include "Document.h"
 #include "Element.h"
 #include "FrameView.h"
+#include "InspectorInstrumentation.h"
 #include "RequestAnimationFrameCallback.h"
 
 #if USE(REQUEST_ANIMATION_FRAME_TIMER)
@@ -75,6 +76,9 @@
     callback->m_id = id;
     callback->m_element = animationElement;
     m_callbacks.append(callback);
+
+    InspectorInstrumentation::didRegisterAnimationFrameCallback(m_document, id);
+
     if (!m_suspendCount)
         scheduleAnimation();
     return id;
@@ -85,6 +89,7 @@
     for (size_t i = 0; i < m_callbacks.size(); ++i) {
         if (m_callbacks[i]->m_id == id) {
             m_callbacks[i]->m_firedOrCancelled = true;
+            InspectorInstrumentation::didCancelAnimationFrameCallback(m_document, id);
             m_callbacks.remove(i);
             return;
         }
@@ -119,7 +124,9 @@
             RequestAnimationFrameCallback* callback = callbacks[i].get();
             if (!callback->m_firedOrCancelled && (!callback->m_element || callback->m_element->renderer())) {
                 callback->m_firedOrCancelled = true;
+                InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireAnimationFrameEvent(m_document, callback->m_id);
                 callback->handleEvent(time);
+                InspectorInstrumentation::didFireAnimationFrameEvent(cookie);
                 firedCallback = true;
                 callbacks.remove(i);
                 break;

Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp (95403 => 95404)


--- trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp	2011-09-19 07:31:19 UTC (rev 95403)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp	2011-09-19 07:36:12 UTC (rev 95404)
@@ -865,6 +865,34 @@
 #endif
 }
 
+void InspectorInstrumentation::didRegisterAnimationFrameCallbackImpl(InstrumentingAgents* instrumentingAgents, int callbackId)
+{
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
+        timelineAgent->didRegisterAnimationFrameCallback(callbackId);
+}
+
+void InspectorInstrumentation::didCancelAnimationFrameCallbackImpl(InstrumentingAgents* instrumentingAgents, int callbackId)
+{
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
+        timelineAgent->didCancelAnimationFrameCallback(callbackId);
+}
+
+InspectorInstrumentationCookie InspectorInstrumentation::willFireAnimationFrameEventImpl(InstrumentingAgents* instrumentingAgents, int callbackId)
+{
+    int timelineAgentId = 0;
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) {
+        timelineAgent->willFireAnimationFrameEvent(callbackId);
+        timelineAgentId = timelineAgent->id();
+    }
+    return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
+}
+
+void InspectorInstrumentation::didFireAnimationFrameEventImpl(const InspectorInstrumentationCookie& cookie)
+{
+    if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
+        timelineAgent->didFireAnimationFrameEvent();
+}
+
 InspectorTimelineAgent* InspectorInstrumentation::retrieveTimelineAgent(const InspectorInstrumentationCookie& cookie)
 {
     if (!cookie.first)

Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.h (95403 => 95404)


--- trunk/Source/WebCore/inspector/InspectorInstrumentation.h	2011-09-19 07:31:19 UTC (rev 95403)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.h	2011-09-19 07:36:12 UTC (rev 95404)
@@ -95,7 +95,7 @@
     static void didInstallTimer(ScriptExecutionContext*, int timerId, int timeout, bool singleShot);
     static void didRemoveTimer(ScriptExecutionContext*, int timerId);
 
-    static InspectorInstrumentationCookie willCallFunction(Frame*, const String& scriptName, int scriptLine);
+    static InspectorInstrumentationCookie willCallFunction(Page*, const String& scriptName, int scriptLine);
     static void didCallFunction(const InspectorInstrumentationCookie&);
     static InspectorInstrumentationCookie willChangeXHRReadyState(ScriptExecutionContext*, XMLHttpRequest* request);
     static void didChangeXHRReadyState(const InspectorInstrumentationCookie&);
@@ -154,6 +154,11 @@
     static void stopConsoleTiming(Page*, const String& title, PassRefPtr<ScriptCallStack>);
     static void consoleTimeStamp(Page*, PassRefPtr<ScriptArguments>);
 
+    static void didRegisterAnimationFrameCallback(Document*, int callbackId);
+    static void didCancelAnimationFrameCallback(Document*, int callbackId);
+    static InspectorInstrumentationCookie willFireAnimationFrameEvent(Document*, int callbackId);
+    static void didFireAnimationFrameEvent(const InspectorInstrumentationCookie&);
+
 #if ENABLE(_javascript__DEBUGGER)
     static void addStartProfilingMessageToConsole(Page*, const String& title, unsigned lineNumber, const String& sourceURL);
     static void addProfile(Page*, RefPtr<ScriptProfile>, PassRefPtr<ScriptCallStack>);
@@ -283,6 +288,11 @@
     static void stopConsoleTimingImpl(InstrumentingAgents*, const String& title, PassRefPtr<ScriptCallStack>);
     static void consoleTimeStampImpl(InstrumentingAgents*, PassRefPtr<ScriptArguments>);
 
+    static void didRegisterAnimationFrameCallbackImpl(InstrumentingAgents*, int callbackId);
+    static void didCancelAnimationFrameCallbackImpl(InstrumentingAgents*, int callbackId);
+    static InspectorInstrumentationCookie willFireAnimationFrameEventImpl(InstrumentingAgents*, int callbackId);
+    static void didFireAnimationFrameEventImpl(const InspectorInstrumentationCookie&);
+
 #if ENABLE(_javascript__DEBUGGER)
     static void addStartProfilingMessageToConsoleImpl(InstrumentingAgents*, const String& title, unsigned lineNumber, const String& sourceURL);
     static void addProfileImpl(InstrumentingAgents*, RefPtr<ScriptProfile>, PassRefPtr<ScriptCallStack>);
@@ -485,12 +495,11 @@
 #endif
 }
 
-
-inline InspectorInstrumentationCookie InspectorInstrumentation::willCallFunction(Frame* frame, const String& scriptName, int scriptLine)
+inline InspectorInstrumentationCookie InspectorInstrumentation::willCallFunction(Page* page, const String& scriptName, int scriptLine)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(InspectorInstrumentationCookie());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
+    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page))
         return willCallFunctionImpl(instrumentingAgents, scriptName, scriptLine);
 #endif
     return InspectorInstrumentationCookie();
@@ -1025,7 +1034,41 @@
 }
 #endif
 
+inline void InspectorInstrumentation::didRegisterAnimationFrameCallback(Document* document, int callbackId)
+{
 #if ENABLE(INSPECTOR)
+    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
+        didRegisterAnimationFrameCallbackImpl(instrumentingAgents, callbackId);
+#endif
+}
+
+inline void InspectorInstrumentation::didCancelAnimationFrameCallback(Document* document, int callbackId)
+{
+#if ENABLE(INSPECTOR)
+    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
+        didCancelAnimationFrameCallbackImpl(instrumentingAgents, callbackId);
+#endif
+}
+
+inline InspectorInstrumentationCookie InspectorInstrumentation::willFireAnimationFrameEvent(Document* document, int callbackId)
+{
+#if ENABLE(INSPECTOR)
+    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document))
+        return willFireAnimationFrameEventImpl(instrumentingAgents, callbackId);
+#endif
+    return InspectorInstrumentationCookie();
+}
+
+inline void InspectorInstrumentation::didFireAnimationFrameEvent(const InspectorInstrumentationCookie& cookie)
+{
+#if ENABLE(INSPECTOR)
+    FAST_RETURN_IF_NO_FRONTENDS(void());
+    if (cookie.first)
+        didFireAnimationFrameEventImpl(cookie);
+#endif
+}
+
+#if ENABLE(INSPECTOR)
 inline bool InspectorInstrumentation::collectingHTMLParseErrors(Page* page)
 {
     FAST_RETURN_IF_NO_FRONTENDS(false);

Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp (95403 => 95404)


--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp	2011-09-19 07:31:19 UTC (rev 95403)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp	2011-09-19 07:36:12 UTC (rev 95404)
@@ -52,6 +52,7 @@
 static const char timelineMaxCallStackDepth[] = "timelineMaxCallStackDepth";
 }
 
+// Must be kept in sync with TimelineAgent.js
 namespace TimelineRecordType {
 static const char EventDispatch[] = "EventDispatch";
 static const char Layout[] = "Layout";
@@ -81,6 +82,10 @@
 
 static const char FunctionCall[] = "FunctionCall";
 static const char GCEvent[] = "GCEvent";
+
+static const char RegisterAnimationFrameCallback[] = "RegisterAnimationFrameCallback";
+static const char CancelAnimationFrameCallback[] = "CancelAnimationFrameCallback";
+static const char FireAnimationFrameEvent[] = "FireAnimationFrameEvent";
 }
 
 void InspectorTimelineAgent::pushGCEventRecords()
@@ -344,6 +349,26 @@
     clearRecordStack();
 }
 
+void InspectorTimelineAgent::didRegisterAnimationFrameCallback(int callbackId)
+{
+    appendRecord(TimelineRecordFactory::createAnimationFrameCallbackData(callbackId), TimelineRecordType::RegisterAnimationFrameCallback);
+}
+
+void InspectorTimelineAgent::didCancelAnimationFrameCallback(int callbackId)
+{
+    appendRecord(TimelineRecordFactory::createAnimationFrameCallbackData(callbackId), TimelineRecordType::CancelAnimationFrameCallback);
+}
+
+void InspectorTimelineAgent::willFireAnimationFrameEvent(int callbackId)
+{
+    pushCurrentRecord(TimelineRecordFactory::createAnimationFrameCallbackData(callbackId), TimelineRecordType::FireAnimationFrameEvent);
+}
+
+void InspectorTimelineAgent::didFireAnimationFrameEvent()
+{
+    didCompleteCurrentRecord(TimelineRecordType::FireAnimationFrameEvent);
+}
+
 void InspectorTimelineAgent::addRecordToTimeline(PassRefPtr<InspectorObject> prpRecord, const String& type)
 {
     RefPtr<InspectorObject> record(prpRecord);

Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.h (95403 => 95404)


--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.h	2011-09-19 07:31:19 UTC (rev 95403)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.h	2011-09-19 07:36:12 UTC (rev 95404)
@@ -119,7 +119,12 @@
     void didFinishLoadingResource(unsigned long, bool didFail, double finishTime);
     void willReceiveResourceData(unsigned long identifier);
     void didReceiveResourceData();
-        
+
+    void didRegisterAnimationFrameCallback(int callbackId);
+    void didCancelAnimationFrameCallback(int callbackId);
+    void willFireAnimationFrameEvent(int callbackId);
+    void didFireAnimationFrameEvent();
+
     virtual void didGC(double, double, size_t);
 
 private:

Modified: trunk/Source/WebCore/inspector/TimelineRecordFactory.cpp (95403 => 95404)


--- trunk/Source/WebCore/inspector/TimelineRecordFactory.cpp	2011-09-19 07:31:19 UTC (rev 95403)
+++ trunk/Source/WebCore/inspector/TimelineRecordFactory.cpp	2011-09-19 07:36:12 UTC (rev 95404)
@@ -182,6 +182,13 @@
     return data.release();
 }
 
+PassRefPtr<InspectorObject> TimelineRecordFactory::createAnimationFrameCallbackData(int callbackId)
+{
+    RefPtr<InspectorObject> data = ""
+    data->setNumber("id", callbackId);
+    return data.release();
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(INSPECTOR)

Modified: trunk/Source/WebCore/inspector/TimelineRecordFactory.h (95403 => 95404)


--- trunk/Source/WebCore/inspector/TimelineRecordFactory.h	2011-09-19 07:31:19 UTC (rev 95403)
+++ trunk/Source/WebCore/inspector/TimelineRecordFactory.h	2011-09-19 07:36:12 UTC (rev 95404)
@@ -79,6 +79,8 @@
 
         static PassRefPtr<InspectorObject> createParseHTMLData(unsigned int length, unsigned int startLine);
 
+        static PassRefPtr<InspectorObject> createAnimationFrameCallbackData(int callbackId);
+
     private:
         TimelineRecordFactory() { }
     };

Modified: trunk/Source/WebCore/inspector/front-end/TimelineAgent.js (95403 => 95404)


--- trunk/Source/WebCore/inspector/front-end/TimelineAgent.js	2011-09-19 07:31:19 UTC (rev 95403)
+++ trunk/Source/WebCore/inspector/front-end/TimelineAgent.js	2011-09-19 07:36:12 UTC (rev 95404)
@@ -61,5 +61,9 @@
     ResourceFinish: "ResourceFinish",
 
     FunctionCall: "FunctionCall",
-    GCEvent: "GCEvent"
+    GCEvent: "GCEvent",
+
+    RegisterAnimationFrameCallback: "RegisterAnimationFrameCallback",
+    CancelAnimationFrameCallback: "CancelAnimationFrameCallback",
+    FireAnimationFrameEvent: "FireAnimationFrameEvent"
 };

Modified: trunk/Source/WebCore/inspector/front-end/TimelinePanel.js (95403 => 95404)


--- trunk/Source/WebCore/inspector/front-end/TimelinePanel.js	2011-09-19 07:31:19 UTC (rev 95403)
+++ trunk/Source/WebCore/inspector/front-end/TimelinePanel.js	2011-09-19 07:36:12 UTC (rev 95404)
@@ -82,6 +82,7 @@
     this._sendRequestRecords = {};
     this._scheduledResourceRequests = {};
     this._timerRecords = {};
+    this._registeredAnimationCallbackRecords = {};
 
     this._calculator = new WebInspector.TimelineCalculator();
     this._calculator._showShortEvents = false;
@@ -201,6 +202,9 @@
             recordStyles[recordTypes.MarkDOMContent] = { title: WebInspector.UIString("DOMContent event"), category: this.categories.scripting };
             recordStyles[recordTypes.MarkLoad] = { title: WebInspector.UIString("Load event"), category: this.categories.scripting };
             recordStyles[recordTypes.ScheduleResourceRequest] = { title: WebInspector.UIString("Schedule Request"), category: this.categories.loading };
+            recordStyles[recordTypes.RegisterAnimationFrameCallback] = { title: WebInspector.UIString("Register Animation Callback"), category: this.categories.scripting };
+            recordStyles[recordTypes.CancelAnimationFrameCallback] = { title: WebInspector.UIString("Cancel Animation Callback"), category: this.categories.scripting };
+            recordStyles[recordTypes.FireAnimationFrameEvent] = { title: WebInspector.UIString("Animation Frame Event"), category: this.categories.scripting };
             this._recordStylesArray = recordStyles;
         }
         return this._recordStylesArray;
@@ -404,6 +408,12 @@
     {
         var connectedToOldRecord = false;
         var recordTypes = WebInspector.TimelineAgent.RecordType;
+
+        if (record.type === recordTypes.RegisterAnimationFrameCallback) {
+            this._registeredAnimationCallbackRecords[record.data.id] = record;
+            return;
+        }
+
         if (record.type === recordTypes.MarkDOMContent || record.type === recordTypes.MarkLoad)
             parentRecord = null; // No bar entry for load events.
         else if (parentRecord === this._rootRecord ||
@@ -425,7 +435,8 @@
                 scriptLine: record.data.scriptLine
             }
         };
-        if (record.type === recordTypes.TimerFire && children && children.length) {
+
+        if ((record.type === recordTypes.TimerFire || record.type === recordTypes.FireAnimationFrameEvent) && children && children.length) {
             var childRecord = children[0];
             if (childRecord.type === recordTypes.FunctionCall) {
                 scriptDetails = {
@@ -508,6 +519,7 @@
         this._sendRequestRecords = {};
         this._scheduledResourceRequests = {};
         this._timerRecords = {};
+        this._registeredAnimationCallbackRecords = {};
         this._rootRecord = this._createRootRecord();
         this._boundariesAreValid = false;
         this._overviewPane.reset();
@@ -1000,6 +1012,10 @@
             this.timeout = timerInstalledRecord.timeout;
             this.singleShot = timerInstalledRecord.singleShot;
         }
+    } else if (record.type === recordTypes.FireAnimationFrameEvent) {
+        var registerCallbackRecord = panel._registeredAnimationCallbackRecords[record.data.id];
+        if (registerCallbackRecord)
+            this.callSiteStackTrace = registerCallbackRecord.stackTrace;
     }
     this._refreshDetails();
 }
@@ -1059,6 +1075,9 @@
                     contentHelper._appendTextRow(WebInspector.UIString("Repeats"), !this.singleShot);
                 }
                 break;
+            case recordTypes.FireAnimationFrameEvent:
+                contentHelper._appendTextRow(WebInspector.UIString("Callback ID"), this.data.id);
+                break;
             case recordTypes.FunctionCall:
                 contentHelper._appendLinkRow(WebInspector.UIString("Location"), this.scriptName, this.scriptLine);
                 break;
@@ -1119,6 +1138,8 @@
                 return this.scriptName ? this._linkifyLocation(this.scriptName, this.scriptLine, 0) : this.data.timerId;
             case WebInspector.TimelineAgent.RecordType.FunctionCall:
                 return this.scriptName ? this._linkifyLocation(this.scriptName, this.scriptLine, 0) : null;
+            case WebInspector.TimelineAgent.RecordType.FireAnimationFrameEvent:
+                return this.scriptName ? this._linkifyLocation(this.scriptName, this.scriptLine, 0) : this.data.id;
             case WebInspector.TimelineAgent.RecordType.EventDispatch:
                 return this.data ? this.data.type : null;
             case WebInspector.TimelineAgent.RecordType.Paint:
@@ -1126,6 +1147,9 @@
             case WebInspector.TimelineAgent.RecordType.TimerInstall:
             case WebInspector.TimelineAgent.RecordType.TimerRemove:
                 return this.stackTrace ? this._linkifyCallFrame(this.stackTrace[0]) : this.data.timerId;
+            case WebInspector.TimelineAgent.RecordType.RegisterAnimationFrameCallback:
+            case WebInspector.TimelineAgent.RecordType.CancelAnimationFrameCallback:
+                return this.stackTrace ? this._linkifyCallFrame(this.stackTrace[0]) : this.data.id;
             case WebInspector.TimelineAgent.RecordType.ParseHTML:
             case WebInspector.TimelineAgent.RecordType.RecalculateStyles:
                 return this.stackTrace ? this._linkifyCallFrame(this.stackTrace[0]) : null;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to