Web Inspector: Timeline: record root event for the function calls enforced by console...
[WebKit-https.git] / Source / WebCore / inspector / InjectedScript.cpp
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) {