| OLD | NEW |
| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 v8::Local<v8::Value> ScriptController::callFunction(v8::Handle<v8::Function> fun
ction, v8::Handle<v8::Value> receiver, int argc, v8::Handle<v8::Value> info[]) | 108 v8::Local<v8::Value> ScriptController::callFunction(v8::Handle<v8::Function> fun
ction, v8::Handle<v8::Value> receiver, int argc, v8::Handle<v8::Value> info[]) |
| 109 { | 109 { |
| 110 // Keep LocalFrame (and therefore ScriptController) alive. | 110 // Keep LocalFrame (and therefore ScriptController) alive. |
| 111 RefPtr<LocalFrame> protect(m_frame); | 111 RefPtr<LocalFrame> protect(m_frame); |
| 112 return ScriptController::callFunction(m_frame->document(), function, receive
r, argc, info, m_isolate); | 112 return ScriptController::callFunction(m_frame->document(), function, receive
r, argc, info, m_isolate); |
| 113 } | 113 } |
| 114 | 114 |
| 115 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) | 115 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) |
| 116 { | 116 { |
| 117 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "FunctionCall",
"data", devToolsTraceEventData(context, function, isolate)); | 117 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "FunctionCall",
"data", devToolsTraceEventData(context, function, isolate)); |
| 118 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", "stack", InspectorCallStackEvent::currentCallStack()); | 118 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::current
CallStack()); |
| 119 | 119 |
| 120 return V8ScriptRunner::callFunction(function, context, receiver, argc, info,
isolate); | 120 return V8ScriptRunner::callFunction(function, context, receiver, argc, info,
isolate); |
| 121 } | 121 } |
| 122 | 122 |
| 123 v8::Local<v8::Value> ScriptController::executeScriptAndReturnValue(v8::Handle<v8
::Context> context, const ScriptSourceCode& source) | 123 v8::Local<v8::Value> ScriptController::executeScriptAndReturnValue(v8::Handle<v8
::Context> context, const ScriptSourceCode& source) |
| 124 { | 124 { |
| 125 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "EvaluateScript
", "data", InspectorEvaluateScriptEvent::data(m_frame, source.url().string(), so
urce.startLine())); | 125 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "EvaluateScript
", "data", InspectorEvaluateScriptEvent::data(m_frame, source.url().string(), so
urce.startLine())); |
| 126 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", "stack", InspectorCallStackEvent::currentCallStack()); | 126 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::current
CallStack()); |
| 127 | 127 |
| 128 v8::Local<v8::Value> result; | 128 v8::Local<v8::Value> result; |
| 129 { | 129 { |
| 130 V8CacheOptions v8CacheOptions(V8CacheOptionsOff); | 130 V8CacheOptions v8CacheOptions(V8CacheOptionsOff); |
| 131 if (m_frame->settings()) | 131 if (m_frame->settings()) |
| 132 v8CacheOptions = m_frame->settings()->v8CacheOptions(); | 132 v8CacheOptions = m_frame->settings()->v8CacheOptions(); |
| 133 | 133 |
| 134 // Isolate exceptions that occur when compiling and executing | 134 // Isolate exceptions that occur when compiling and executing |
| 135 // the code. These exceptions should not interfere with | 135 // the code. These exceptions should not interfere with |
| 136 // javascript code we might evaluate from C++ when returning | 136 // javascript code we might evaluate from C++ when returning |
| 137 // from here. | 137 // from here. |
| 138 v8::TryCatch tryCatch; | 138 v8::TryCatch tryCatch; |
| 139 tryCatch.SetVerbose(true); | 139 tryCatch.SetVerbose(true); |
| 140 | 140 |
| 141 v8::Handle<v8::Script> script = V8ScriptRunner::compileScript(source, m_
isolate, v8CacheOptions); | 141 v8::Handle<v8::Script> script = V8ScriptRunner::compileScript(source, m_
isolate, v8CacheOptions); |
| 142 | 142 |
| 143 // Keep LocalFrame (and therefore ScriptController) alive. | 143 // Keep LocalFrame (and therefore ScriptController) alive. |
| 144 RefPtr<LocalFrame> protect(m_frame); | 144 RefPtr<LocalFrame> protect(m_frame); |
| 145 result = V8ScriptRunner::runCompiledScript(script, m_frame->document(),
m_isolate); | 145 result = V8ScriptRunner::runCompiledScript(script, m_frame->document(),
m_isolate); |
| 146 ASSERT(!tryCatch.HasCaught() || result.IsEmpty()); | 146 ASSERT(!tryCatch.HasCaught() || result.IsEmpty()); |
| 147 } | 147 } |
| 148 | 148 |
| 149 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", "data", InspectorUpdateCountersEvent::data()); | 149 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorUpdateCountersEvent::data
()); |
| 150 | 150 |
| 151 return result; | 151 return result; |
| 152 } | 152 } |
| 153 | 153 |
| 154 bool ScriptController::initializeMainWorld() | 154 bool ScriptController::initializeMainWorld() |
| 155 { | 155 { |
| 156 if (m_windowProxy->isContextInitialized()) | 156 if (m_windowProxy->isContextInitialized()) |
| 157 return false; | 157 return false; |
| 158 return windowProxy(DOMWrapperWorld::mainWorld())->isContextInitialized(); | 158 return windowProxy(DOMWrapperWorld::mainWorld())->isContextInitialized(); |
| 159 } | 159 } |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 module.resolvedDependencies.append(actual); | 364 module.resolvedDependencies.append(actual); |
| 365 } | 365 } |
| 366 } | 366 } |
| 367 } | 367 } |
| 368 } | 368 } |
| 369 | 369 |
| 370 V8ScriptRunner::runModule(m_isolate, m_frame->document(), module); | 370 V8ScriptRunner::runModule(m_isolate, m_frame->document(), module); |
| 371 } | 371 } |
| 372 | 372 |
| 373 } // namespace blink | 373 } // namespace blink |
| OLD | NEW |