Web Inspector: Timeline: record root event for the function calls enforced by console...
authorloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Sep 2011 12:12:34 +0000 (12:12 +0000)
committerloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Sep 2011 12:12:34 +0000 (12:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=68695

In a complex web application developer might want to timeline a specific piece of code.

In this case he can do the next steps:
1) start timeline;
2) eval a command in console;
3) stop timeline.

I think it'd be nice to have a root event for the all the events that happened as the result of such eval.

Reviewed by Yury Semikhatsky.

Source/WebCore:

Test: inspector/timeline/timeline-injected-script-eval.html

* bindings/v8/ScriptFunctionCall.cpp:
* inspector/InjectedScript.cpp:
(WebCore::InjectedScript::makeCall):
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::willCallFunctionImpl):

LayoutTests:

* inspector/timeline/timeline-injected-script-eval-expected.txt: Added.
* inspector/timeline/timeline-injected-script-eval.html: Added.
* platform/chromium/inspector/timeline/timeline-injected-script-eval-expected.txt: Added.
* platform/chromium/inspector/timeline/timeline-receive-response-event-expected.txt:

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

LayoutTests/ChangeLog
LayoutTests/inspector/timeline/timeline-injected-script-eval-expected.txt [new file with mode: 0644]
LayoutTests/inspector/timeline/timeline-injected-script-eval.html [new file with mode: 0644]
LayoutTests/platform/chromium/inspector/timeline/timeline-injected-script-eval-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium/inspector/timeline/timeline-receive-response-event-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/inspector/InjectedScript.cpp
Source/WebCore/inspector/InspectorInstrumentation.cpp

index c28e7233d803a85fabc392bc2897a32bf2a926b4..532c201bbe1d953602e3364f33a1abe10fd647a7 100644 (file)
@@ -1,3 +1,24 @@
+2011-09-23  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Web Inspector: Timeline: record root event for the function calls enforced by console eval.
+        https://bugs.webkit.org/show_bug.cgi?id=68695
+
+        In a complex web application developer might want to timeline a specific piece of code.
+
+        In this case he can do the next steps:
+        1) start timeline;
+        2) eval a command in console;
+        3) stop timeline.
+
+        I think it'd be nice to have a root event for the all the events that happened as the result of such eval.
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/timeline/timeline-injected-script-eval-expected.txt: Added.
+        * inspector/timeline/timeline-injected-script-eval.html: Added.
+        * platform/chromium/inspector/timeline/timeline-injected-script-eval-expected.txt: Added.
+        * platform/chromium/inspector/timeline/timeline-receive-response-event-expected.txt:
+
 2011-09-26  James Robinson  <jamesr@chromium.org>
 
         [mac] Timestamp parameter to requestAnimationFrame is busted in USE(REQUEST_ANIMATION_FRAME_TIMER) path
diff --git a/LayoutTests/inspector/timeline/timeline-injected-script-eval-expected.txt b/LayoutTests/inspector/timeline/timeline-injected-script-eval-expected.txt
new file mode 100644 (file)
index 0000000..88159fa
--- /dev/null
@@ -0,0 +1 @@
+Tests the Timeline API function call record for InjectedScript.eval call feature.
diff --git a/LayoutTests/inspector/timeline/timeline-injected-script-eval.html b/LayoutTests/inspector/timeline/timeline-injected-script-eval.html
new file mode 100644 (file)
index 0000000..2d984bd
--- /dev/null
@@ -0,0 +1,25 @@
+<html>
+<head>
+<script src="../../http/tests/inspector/inspector-test.js"></script>
+<script src="timeline-test.js"></script>
+<script>
+
+function performActions()
+{
+}
+
+function test()
+{
+    InspectorTest.performActionsAndPrint("performActions()", "FunctionCall");
+}
+
+</script>
+</head>
+
+<body onload="runTest()">
+<p>
+Tests the Timeline API function call record for InjectedScript.eval call feature.
+</p>
+
+</body>
+</html>
diff --git a/LayoutTests/platform/chromium/inspector/timeline/timeline-injected-script-eval-expected.txt b/LayoutTests/platform/chromium/inspector/timeline/timeline-injected-script-eval-expected.txt
new file mode 100644 (file)
index 0000000..402e40b
--- /dev/null
@@ -0,0 +1,29 @@
+Tests the Timeline API function call record for InjectedScript.eval call feature.
+
+FunctionCall Properties:
+{
+    startTime : <number>
+    data : {
+        scriptName : "InjectedScript"
+        scriptLine : 1
+    }
+    children : <object>
+    endTime : <number>
+    type : "FunctionCall"
+    usedHeapSize : <number>
+    totalHeapSize : <number>
+}
+FunctionCall Properties:
+{
+    startTime : <number>
+    data : {
+        scriptName : "InjectedScript"
+        scriptLine : 1
+    }
+    children : <object>
+    endTime : <number>
+    type : "FunctionCall"
+    usedHeapSize : <number>
+    totalHeapSize : <number>
+}
+
index 969b4934292ada8da3b439ab2b389f3c67431b8a..75fb0436bd7f9f90d9aa22fad225c3b7f5b06de1 100644 (file)
@@ -1,9 +1,11 @@
 Tests the Timeline API instrumentation of a SendRequest, ReceiveResponse etc.
 
+FunctionCall
 ResourceSendRequest
     ResourceReceiveResponse
     ResourceReceivedData
     ResourceFinish
+FunctionCall
 ResourceSendRequest
     ResourceReceiveResponse
     ResourceReceivedData
index 259ba33fa110882a4a359ebaab711410aeee55aa..647428d23c3e6aa4c078067f2f41c9041f8bee44 100644 (file)
@@ -1,3 +1,27 @@
+2011-09-23  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Web Inspector: Timeline: record root event for the function calls enforced by console eval.
+        https://bugs.webkit.org/show_bug.cgi?id=68695
+
+        In a complex web application developer might want to timeline a specific piece of code.
+
+        In this case he can do the next steps:
+        1) start timeline;
+        2) eval a command in console;
+        3) stop timeline.
+
+        I think it'd be nice to have a root event for the all the events that happened as the result of such eval.
+
+        Reviewed by Yury Semikhatsky.
+
+        Test: inspector/timeline/timeline-injected-script-eval.html
+
+        * bindings/v8/ScriptFunctionCall.cpp:
+        * inspector/InjectedScript.cpp:
+        (WebCore::InjectedScript::makeCall):
+        * inspector/InspectorInstrumentation.cpp:
+        (WebCore::InspectorInstrumentation::willCallFunctionImpl):
+
 2011-09-26  No'am Rosenthal  <noam.rosenthal@nokia.com>
 
         [Texmap][Qt] Enable TextureMapperGL in platforms where BGRA is not present
index 0f87c4e5e088ce208feb64345ce1bbd833dcf103..95b12bb02c306c695e690e8aa07cf093b4f0b549 100644 (file)
 
 #if ENABLE(INSPECTOR)
 
+#include "DOMWindow.h"
 #include "Frame.h"
 #include "InjectedScriptHost.h"
 #include "InjectedScriptManager.h"
+#include "InspectorInstrumentation.h"
 #include "InspectorValues.h"
 #include "Node.h"
 #include "PlatformString.h"
@@ -189,8 +191,11 @@ void InjectedScript::makeCall(ScriptFunctionCall& function, RefPtr<InspectorValu
         return;
     }
 
+    DOMWindow* domWindow = domWindowFromScriptState(m_injectedScriptObject.scriptState());
+    InspectorInstrumentationCookie cookie = domWindow && domWindow->frame() ? InspectorInstrumentation::willCallFunction(domWindow->frame()->page(), "InjectedScript", 1) : InspectorInstrumentationCookie();
     bool hadException = false;
     ScriptValue resultValue = function.call(hadException);
+    InspectorInstrumentation::didCallFunction(cookie);
 
     ASSERT(!hadException);
     if (!hadException) {
index 7b97f6ce900d1585679c7c7f8b5e474e712a3a95..ecc57a2a97bf6b85acee206597343c255c8a5778 100644 (file)
@@ -224,12 +224,16 @@ void InspectorInstrumentation::didRemoveTimerImpl(InstrumentingAgents* instrumen
 
 InspectorInstrumentationCookie InspectorInstrumentation::willCallFunctionImpl(InstrumentingAgents* instrumentingAgents, const String& scriptName, int scriptLine)
 {
+#if USE(JSC) // It is disabled for JSC see WK-BUG 40119
+    return InspectorInstrumentationCookie();
+#else
     int timelineAgentId = 0;
     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent()) {
         timelineAgent->willCallFunction(scriptName, scriptLine);
         timelineAgentId = timelineAgent->id();
     }
     return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
+#endif
 }
 
 void InspectorInstrumentation::didCallFunctionImpl(const InspectorInstrumentationCookie& cookie)