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

Side by Side Diff: Source/bindings/v8/ScriptController.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/bindings/v8/V8Binding.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2009 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 m_windowShell->updateSecurityOrigin(origin); 137 m_windowShell->updateSecurityOrigin(origin);
138 } 138 }
139 139
140 v8::Local<v8::Value> ScriptController::callFunction(v8::Handle<v8::Function> fun ction, v8::Handle<v8::Value> receiver, int argc, v8::Handle<v8::Value> info[]) 140 v8::Local<v8::Value> ScriptController::callFunction(v8::Handle<v8::Function> fun ction, v8::Handle<v8::Value> receiver, int argc, v8::Handle<v8::Value> info[])
141 { 141 {
142 // Keep LocalFrame (and therefore ScriptController) alive. 142 // Keep LocalFrame (and therefore ScriptController) alive.
143 RefPtr<LocalFrame> protect(m_frame); 143 RefPtr<LocalFrame> protect(m_frame);
144 return ScriptController::callFunction(m_frame->document(), function, receive r, argc, info, m_isolate); 144 return ScriptController::callFunction(m_frame->document(), function, receive r, argc, info, m_isolate);
145 } 145 }
146 146
147 static bool resourceInfo(const v8::Handle<v8::Function> function, String& resour ceName, int& lineNumber)
148 {
149 v8::ScriptOrigin origin = function->GetScriptOrigin();
150 if (origin.ResourceName().IsEmpty()) {
151 resourceName = "undefined";
152 lineNumber = 1;
153 } else {
154 TOSTRING_DEFAULT(V8StringResource<>, stringResourceName, origin.Resource Name(), false);
155 resourceName = stringResourceName;
156 lineNumber = function->GetScriptLineNumber() + 1;
157 }
158 return true;
159 }
160
161 v8::Local<v8::Value> ScriptController::callFunction(ExecutionContext* context, v 8::Handle<v8::Function> function, v8::Handle<v8::Value> receiver, int argc, v8:: Handle<v8::Value> info[], v8::Isolate* isolate) 147 v8::Local<v8::Value> ScriptController::callFunction(ExecutionContext* context, v 8::Handle<v8::Function> function, v8::Handle<v8::Value> receiver, int argc, v8:: Handle<v8::Value> info[], v8::Isolate* isolate)
162 { 148 {
149 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "FunctionCall", "data", devToolsTraceEventData(context, function, isolate));
150 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), " CallStack", "stack", InspectorCallStackEvent::currentCallStack());
151 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli ne migrates to tracing.
163 InspectorInstrumentationCookie cookie; 152 InspectorInstrumentationCookie cookie;
164 if (InspectorInstrumentation::timelineAgentEnabled(context)) { 153 if (InspectorInstrumentation::timelineAgentEnabled(context)) {
154 int scriptId = 0;
165 String resourceName; 155 String resourceName;
166 int lineNumber; 156 int lineNumber = 1;
167 if (!resourceInfo(getBoundFunction(function), resourceName, lineNumber)) 157 GetDevToolsFunctionInfo(function, isolate, scriptId, resourceName, lineN umber);
168 return v8::Local<v8::Value>(); 158 cookie = InspectorInstrumentation::willCallFunction(context, scriptId, r esourceName, lineNumber);
169 cookie = InspectorInstrumentation::willCallFunction(context, function->S criptId(), resourceName, lineNumber);
170 } 159 }
171 160
172 v8::Local<v8::Value> result = V8ScriptRunner::callFunction(function, context , receiver, argc, info, isolate); 161 v8::Local<v8::Value> result = V8ScriptRunner::callFunction(function, context , receiver, argc, info, isolate);
173 162
174 InspectorInstrumentation::didCallFunction(cookie); 163 InspectorInstrumentation::didCallFunction(cookie);
175 return result; 164 return result;
176 } 165 }
177 166
178 v8::Local<v8::Value> ScriptController::executeScriptAndReturnValue(v8::Handle<v8 ::Context> context, const ScriptSourceCode& source, AccessControlStatus corsStat us) 167 v8::Local<v8::Value> ScriptController::executeScriptAndReturnValue(v8::Handle<v8 ::Context> context, const ScriptSourceCode& source, AccessControlStatus corsStat us)
179 { 168 {
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 resultArray->Set(i, evaluationResult); 616 resultArray->Set(i, evaluationResult);
628 } 617 }
629 618
630 if (results) { 619 if (results) {
631 for (size_t i = 0; i < resultArray->Length(); ++i) 620 for (size_t i = 0; i < resultArray->Length(); ++i)
632 results->append(ScriptValue(ScriptState::from(context), resultArray- >Get(i))); 621 results->append(ScriptValue(ScriptState::from(context), resultArray- >Get(i)));
633 } 622 }
634 } 623 }
635 624
636 } // namespace WebCore 625 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/v8/V8Binding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698