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

Side by Side Diff: sky/engine/bindings/core/v8/ScriptController.cpp

Issue 889823002: Remove TRACE_EVENT indirection through blink::Platform (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « no previous file | sky/engine/bindings/core/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 * Copyright (C) 2014 Opera Software ASA. All rights reserved. 4 * Copyright (C) 2014 Opera Software ASA. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are 7 * modification, are permitted provided that the following conditions are
8 * met: 8 * met:
9 * 9 *
10 * * Redistributions of source code must retain the above copyright 10 * * Redistributions of source code must retain the above copyright
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #include "sky/engine/core/dom/Document.h" 49 #include "sky/engine/core/dom/Document.h"
50 #include "sky/engine/core/dom/Node.h" 50 #include "sky/engine/core/dom/Node.h"
51 #include "sky/engine/core/events/Event.h" 51 #include "sky/engine/core/events/Event.h"
52 #include "sky/engine/core/events/EventListener.h" 52 #include "sky/engine/core/events/EventListener.h"
53 #include "sky/engine/core/frame/LocalDOMWindow.h" 53 #include "sky/engine/core/frame/LocalDOMWindow.h"
54 #include "sky/engine/core/frame/LocalFrame.h" 54 #include "sky/engine/core/frame/LocalFrame.h"
55 #include "sky/engine/core/frame/Settings.h" 55 #include "sky/engine/core/frame/Settings.h"
56 #include "sky/engine/core/html/imports/HTMLImportChild.h" 56 #include "sky/engine/core/html/imports/HTMLImportChild.h"
57 #include "sky/engine/core/html/imports/HTMLImportLoader.h" 57 #include "sky/engine/core/html/imports/HTMLImportLoader.h"
58 #include "sky/engine/core/html/parser/HTMLDocumentParser.h" 58 #include "sky/engine/core/html/parser/HTMLDocumentParser.h"
59 #include "sky/engine/core/inspector/InspectorTraceEvents.h"
60 #include "sky/engine/core/loader/FrameLoaderClient.h" 59 #include "sky/engine/core/loader/FrameLoaderClient.h"
61 #include "sky/engine/platform/NotImplemented.h" 60 #include "sky/engine/platform/NotImplemented.h"
62 #include "sky/engine/platform/TraceEvent.h" 61 #include "sky/engine/platform/TraceEvent.h"
63 #include "sky/engine/platform/Widget.h" 62 #include "sky/engine/platform/Widget.h"
64 #include "sky/engine/public/platform/Platform.h" 63 #include "sky/engine/public/platform/Platform.h"
65 #include "sky/engine/core/inspector/ScriptCallStack.h" 64 #include "sky/engine/core/inspector/ScriptCallStack.h"
66 #include "sky/engine/wtf/CurrentTime.h" 65 #include "sky/engine/wtf/CurrentTime.h"
67 #include "sky/engine/wtf/StdLibExtras.h" 66 #include "sky/engine/wtf/StdLibExtras.h"
68 #include "sky/engine/wtf/StringExtras.h" 67 #include "sky/engine/wtf/StringExtras.h"
69 #include "sky/engine/wtf/text/CString.h" 68 #include "sky/engine/wtf/text/CString.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 104
106 v8::Local<v8::Value> ScriptController::callFunction(v8::Handle<v8::Function> fun ction, v8::Handle<v8::Value> receiver, int argc, v8::Handle<v8::Value> info[]) 105 v8::Local<v8::Value> ScriptController::callFunction(v8::Handle<v8::Function> fun ction, v8::Handle<v8::Value> receiver, int argc, v8::Handle<v8::Value> info[])
107 { 106 {
108 // Keep LocalFrame (and therefore ScriptController) alive. 107 // Keep LocalFrame (and therefore ScriptController) alive.
109 RefPtr<LocalFrame> protect(m_frame); 108 RefPtr<LocalFrame> protect(m_frame);
110 return ScriptController::callFunction(m_frame->document(), function, receive r, argc, info, m_isolate); 109 return ScriptController::callFunction(m_frame->document(), function, receive r, argc, info, m_isolate);
111 } 110 }
112 111
113 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) 112 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)
114 { 113 {
115 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "FunctionCall", "data", devToolsTraceEventData(context, function, isolate));
116 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), " CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::current CallStack());
117
118 return V8ScriptRunner::callFunction(function, context, receiver, argc, info, isolate); 114 return V8ScriptRunner::callFunction(function, context, receiver, argc, info, isolate);
119 } 115 }
120 116
121 v8::Local<v8::Value> ScriptController::executeScriptAndReturnValue(v8::Handle<v8 ::Context> context, const ScriptSourceCode& source) 117 v8::Local<v8::Value> ScriptController::executeScriptAndReturnValue(v8::Handle<v8 ::Context> context, const ScriptSourceCode& source)
122 { 118 {
123 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "EvaluateScript ", "data", InspectorEvaluateScriptEvent::data(source.url().string(), source.star tLine()));
124 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), " CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::current CallStack());
125
126 v8::Local<v8::Value> result; 119 v8::Local<v8::Value> result;
127 { 120 {
128 V8CacheOptions v8CacheOptions(V8CacheOptionsOff); 121 V8CacheOptions v8CacheOptions(V8CacheOptionsOff);
129 if (m_frame->settings()) 122 if (m_frame->settings())
130 v8CacheOptions = m_frame->settings()->v8CacheOptions(); 123 v8CacheOptions = m_frame->settings()->v8CacheOptions();
131 124
132 // Isolate exceptions that occur when compiling and executing 125 // Isolate exceptions that occur when compiling and executing
133 // the code. These exceptions should not interfere with 126 // the code. These exceptions should not interfere with
134 // javascript code we might evaluate from C++ when returning 127 // javascript code we might evaluate from C++ when returning
135 // from here. 128 // from here.
136 v8::TryCatch tryCatch; 129 v8::TryCatch tryCatch;
137 tryCatch.SetVerbose(true); 130 tryCatch.SetVerbose(true);
138 131
139 v8::Handle<v8::Script> script = V8ScriptRunner::compileScript(source, m_ isolate, v8CacheOptions); 132 v8::Handle<v8::Script> script = V8ScriptRunner::compileScript(source, m_ isolate, v8CacheOptions);
140 133
141 // Keep LocalFrame (and therefore ScriptController) alive. 134 // Keep LocalFrame (and therefore ScriptController) alive.
142 RefPtr<LocalFrame> protect(m_frame); 135 RefPtr<LocalFrame> protect(m_frame);
143 result = V8ScriptRunner::runCompiledScript(script, m_frame->document(), m_isolate); 136 result = V8ScriptRunner::runCompiledScript(script, m_frame->document(), m_isolate);
144 ASSERT(!tryCatch.HasCaught() || result.IsEmpty()); 137 ASSERT(!tryCatch.HasCaught() || result.IsEmpty());
145 } 138 }
146 139
147 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update Counters", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorUpdateCountersEvent::data ());
148
149 return result; 140 return result;
150 } 141 }
151 142
152 bool ScriptController::initializeMainWorld() 143 bool ScriptController::initializeMainWorld()
153 { 144 {
154 if (m_windowProxy->isContextInitialized()) 145 if (m_windowProxy->isContextInitialized())
155 return false; 146 return false;
156 return windowProxy(DOMWrapperWorld::mainWorld())->isContextInitialized(); 147 return windowProxy(DOMWrapperWorld::mainWorld())->isContextInitialized();
157 } 148 }
158 149
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 scriptModule.resolvedDependencies.append(actual); 292 scriptModule.resolvedDependencies.append(actual);
302 } 293 }
303 } 294 }
304 } 295 }
305 } 296 }
306 297
307 V8ScriptRunner::runModule(m_isolate, m_frame->document(), scriptModule); 298 V8ScriptRunner::runModule(m_isolate, m_frame->document(), scriptModule);
308 } 299 }
309 300
310 } // namespace blink 301 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | sky/engine/bindings/core/v8/V8Binding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698