Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(405)

Unified Diff: Source/bindings/v8/V8Binding.cpp

Issue 271883002: Add more FunctionCall trace events (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/v8/V8Binding.h ('k') | Source/bindings/v8/V8WorkerGlobalScopeEventListener.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/V8Binding.cpp
diff --git a/Source/bindings/v8/V8Binding.cpp b/Source/bindings/v8/V8Binding.cpp
index 812da6ab86fa4072c8dbae8179eb08f5b04163c2..242bea56a91122a031038a8e17c6b97473f93576 100644
--- a/Source/bindings/v8/V8Binding.cpp
+++ b/Source/bindings/v8/V8Binding.cpp
@@ -50,10 +50,12 @@
#include "core/frame/LocalFrame.h"
#include "core/frame/Settings.h"
#include "core/inspector/BindingVisitors.h"
+#include "core/inspector/InspectorTraceEvents.h"
#include "core/loader/FrameLoader.h"
#include "core/loader/FrameLoaderClient.h"
#include "core/workers/WorkerGlobalScope.h"
#include "core/xml/XPathNSResolver.h"
+#include "platform/EventTracer.h"
#include "platform/JSONValues.h"
#include "wtf/ArrayBufferContents.h"
#include "wtf/MainThread.h"
@@ -745,4 +747,28 @@ V8ExecutionScope::~V8ExecutionScope()
m_scriptState->disposePerContextData();
}
+void GetDevToolsFunctionInfo(v8::Handle<v8::Function> function, v8::Isolate* isolate, int& scriptId, String& resourceName, int& lineNumber)
+{
+ v8::Handle<v8::Function> originalFunction = getBoundFunction(function);
+ scriptId = originalFunction->ScriptId();
+ v8::ScriptOrigin origin = originalFunction->GetScriptOrigin();
+ if (!origin.ResourceName().IsEmpty()) {
+ resourceName = NativeValueTraits<String>::nativeValue(origin.ResourceName(), isolate);
+ lineNumber = originalFunction->GetScriptLineNumber() + 1;
+ }
+ if (resourceName.isEmpty()) {
+ resourceName = "undefined";
+ lineNumber = 1;
+ }
+}
+
+PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(ExecutionContext* context, v8::Handle<v8::Function> function, v8::Isolate* isolate)
+{
+ int scriptId = 0;
+ String resourceName;
+ int lineNumber = 1;
+ GetDevToolsFunctionInfo(function, isolate, scriptId, resourceName, lineNumber);
+ return InspectorFunctionCallEvent::data(context, scriptId, resourceName, lineNumber);
+}
+
} // namespace WebCore
« no previous file with comments | « Source/bindings/v8/V8Binding.h ('k') | Source/bindings/v8/V8WorkerGlobalScopeEventListener.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698