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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/ScriptController.cpp

Issue 2145863003: Cleanup: remove unused compilationFinishTime + fix a comment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 104
105 void ScriptController::updateSecurityOrigin(SecurityOrigin* origin) 105 void ScriptController::updateSecurityOrigin(SecurityOrigin* origin)
106 { 106 {
107 m_windowProxyManager->mainWorldProxy()->updateSecurityOrigin(origin); 107 m_windowProxyManager->mainWorldProxy()->updateSecurityOrigin(origin);
108 Vector<std::pair<ScriptState*, SecurityOrigin*>> isolatedContexts; 108 Vector<std::pair<ScriptState*, SecurityOrigin*>> isolatedContexts;
109 m_windowProxyManager->collectIsolatedContexts(isolatedContexts); 109 m_windowProxyManager->collectIsolatedContexts(isolatedContexts);
110 for (auto isolatedContext : isolatedContexts) 110 for (auto isolatedContext : isolatedContexts)
111 m_windowProxyManager->windowProxy(isolatedContext.first->world())->updat eSecurityOrigin(isolatedContext.second); 111 m_windowProxyManager->windowProxy(isolatedContext.first->world())->updat eSecurityOrigin(isolatedContext.second);
112 } 112 }
113 113
114 v8::Local<v8::Value> ScriptController::executeScriptAndReturnValue(v8::Local<v8: :Context> context, const ScriptSourceCode& source, AccessControlStatus accessCon trolStatus, double* compilationFinishTime) 114 v8::Local<v8::Value> ScriptController::executeScriptAndReturnValue(v8::Local<v8: :Context> context, const ScriptSourceCode& source, AccessControlStatus accessCon trolStatus)
115 { 115 {
116 TRACE_EVENT1("devtools.timeline", "EvaluateScript", "data", InspectorEvaluat eScriptEvent::data(frame(), source.url().getString(), source.startPosition())); 116 TRACE_EVENT1("devtools.timeline", "EvaluateScript", "data", InspectorEvaluat eScriptEvent::data(frame(), source.url().getString(), source.startPosition()));
117 InspectorInstrumentation::NativeBreakpoint nativeBreakpoint(frame()->documen t(), "scriptFirstStatement", false); 117 InspectorInstrumentation::NativeBreakpoint nativeBreakpoint(frame()->documen t(), "scriptFirstStatement", false);
118 118
119 v8::Local<v8::Value> result; 119 v8::Local<v8::Value> result;
120 { 120 {
121 V8CacheOptions v8CacheOptions(V8CacheOptionsDefault); 121 V8CacheOptions v8CacheOptions(V8CacheOptionsDefault);
122 if (frame()->settings()) 122 if (frame()->settings())
123 v8CacheOptions = frame()->settings()->v8CacheOptions(); 123 v8CacheOptions = frame()->settings()->v8CacheOptions();
124 if (source.resource() && !source.resource()->response().cacheStorageCach eName().isNull()) { 124 if (source.resource() && !source.resource()->response().cacheStorageCach eName().isNull()) {
(...skipping 15 matching lines...) Expand all
140 // the code. These exceptions should not interfere with 140 // the code. These exceptions should not interfere with
141 // javascript code we might evaluate from C++ when returning 141 // javascript code we might evaluate from C++ when returning
142 // from here. 142 // from here.
143 v8::TryCatch tryCatch(isolate()); 143 v8::TryCatch tryCatch(isolate());
144 tryCatch.SetVerbose(true); 144 tryCatch.SetVerbose(true);
145 145
146 v8::Local<v8::Script> script; 146 v8::Local<v8::Script> script;
147 if (!v8Call(V8ScriptRunner::compileScript(source, isolate(), accessContr olStatus, v8CacheOptions), script, tryCatch)) 147 if (!v8Call(V8ScriptRunner::compileScript(source, isolate(), accessContr olStatus, v8CacheOptions), script, tryCatch))
148 return result; 148 return result;
149 149
150 if (compilationFinishTime) {
151 *compilationFinishTime = WTF::monotonicallyIncreasingTime();
152 }
153 if (!v8Call(V8ScriptRunner::runCompiledScript(isolate(), script, frame() ->document()), result, tryCatch)) 150 if (!v8Call(V8ScriptRunner::runCompiledScript(isolate(), script, frame() ->document()), result, tryCatch))
154 return result; 151 return result;
155 } 152 }
156 153
157 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update Counters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data( )); 154 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update Counters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data( ));
158 155
159 return result; 156 return result;
160 } 157 }
161 158
162 bool ScriptController::initializeMainWorld() 159 bool ScriptController::initializeMainWorld()
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 frame()->loader().replaceDocumentWhileExecutingJavaScriptURL(scriptResult, o wnerDocument); 367 frame()->loader().replaceDocumentWhileExecutingJavaScriptURL(scriptResult, o wnerDocument);
371 return true; 368 return true;
372 } 369 }
373 370
374 void ScriptController::executeScriptInMainWorld(const String& script, ExecuteScr iptPolicy policy) 371 void ScriptController::executeScriptInMainWorld(const String& script, ExecuteScr iptPolicy policy)
375 { 372 {
376 v8::HandleScope handleScope(isolate()); 373 v8::HandleScope handleScope(isolate());
377 evaluateScriptInMainWorld(ScriptSourceCode(script), NotSharableCrossOrigin, policy); 374 evaluateScriptInMainWorld(ScriptSourceCode(script), NotSharableCrossOrigin, policy);
378 } 375 }
379 376
380 void ScriptController::executeScriptInMainWorld(const ScriptSourceCode& sourceCo de, AccessControlStatus accessControlStatus, double* compilationFinishTime) 377 void ScriptController::executeScriptInMainWorld(const ScriptSourceCode& sourceCo de, AccessControlStatus accessControlStatus)
381 { 378 {
382 v8::HandleScope handleScope(isolate()); 379 v8::HandleScope handleScope(isolate());
383 evaluateScriptInMainWorld(sourceCode, accessControlStatus, DoNotExecuteScrip tWhenScriptsDisabled, compilationFinishTime); 380 evaluateScriptInMainWorld(sourceCode, accessControlStatus, DoNotExecuteScrip tWhenScriptsDisabled);
384 } 381 }
385 382
386 v8::Local<v8::Value> ScriptController::executeScriptInMainWorldAndReturnValue(co nst ScriptSourceCode& sourceCode, ExecuteScriptPolicy policy) 383 v8::Local<v8::Value> ScriptController::executeScriptInMainWorldAndReturnValue(co nst ScriptSourceCode& sourceCode, ExecuteScriptPolicy policy)
387 { 384 {
388 return evaluateScriptInMainWorld(sourceCode, NotSharableCrossOrigin, policy) ; 385 return evaluateScriptInMainWorld(sourceCode, NotSharableCrossOrigin, policy) ;
389 } 386 }
390 387
391 v8::Local<v8::Value> ScriptController::evaluateScriptInMainWorld(const ScriptSou rceCode& sourceCode, AccessControlStatus accessControlStatus, ExecuteScriptPolic y policy, double* compilationFinishTime) 388 v8::Local<v8::Value> ScriptController::evaluateScriptInMainWorld(const ScriptSou rceCode& sourceCode, AccessControlStatus accessControlStatus, ExecuteScriptPolic y policy)
392 { 389 {
393 if (policy == DoNotExecuteScriptWhenScriptsDisabled && !canExecuteScripts(Ab outToExecuteScript)) 390 if (policy == DoNotExecuteScriptWhenScriptsDisabled && !canExecuteScripts(Ab outToExecuteScript))
394 return v8::Local<v8::Value>(); 391 return v8::Local<v8::Value>();
395 392
396 ScriptState* scriptState = ScriptState::forMainWorld(frame()); 393 ScriptState* scriptState = ScriptState::forMainWorld(frame());
397 if (!scriptState) 394 if (!scriptState)
398 return v8::Local<v8::Value>(); 395 return v8::Local<v8::Value>();
399 v8::EscapableHandleScope handleScope(isolate()); 396 v8::EscapableHandleScope handleScope(isolate());
400 ScriptState::Scope scope(scriptState); 397 ScriptState::Scope scope(scriptState);
401 398
402 if (frame()->loader().stateMachine()->isDisplayingInitialEmptyDocument()) 399 if (frame()->loader().stateMachine()->isDisplayingInitialEmptyDocument())
403 frame()->loader().didAccessInitialDocument(); 400 frame()->loader().didAccessInitialDocument();
404 401
405 v8::Local<v8::Value> object = executeScriptAndReturnValue(scriptState->conte xt(), sourceCode, accessControlStatus, compilationFinishTime); 402 v8::Local<v8::Value> object = executeScriptAndReturnValue(scriptState->conte xt(), sourceCode, accessControlStatus);
406 403
407 if (object.IsEmpty()) 404 if (object.IsEmpty())
408 return v8::Local<v8::Value>(); 405 return v8::Local<v8::Value>();
409 406
410 return handleScope.Escape(object); 407 return handleScope.Escape(object);
411 } 408 }
412 409
413 void ScriptController::executeScriptInIsolatedWorld(int worldID, const HeapVecto r<ScriptSourceCode>& sources, int extensionGroup, Vector<v8::Local<v8::Value>>* results) 410 void ScriptController::executeScriptInIsolatedWorld(int worldID, const HeapVecto r<ScriptSourceCode>& sources, int extensionGroup, Vector<v8::Local<v8::Value>>* results)
414 { 411 {
415 ASSERT(worldID > 0); 412 ASSERT(worldID > 0);
(...skipping 19 matching lines...) Expand all
435 for (size_t i = 0; i < resultArray->Length(); ++i) { 432 for (size_t i = 0; i < resultArray->Length(); ++i) {
436 v8::Local<v8::Value> value; 433 v8::Local<v8::Value> value;
437 if (!resultArray->Get(scriptState->context(), i).ToLocal(&value)) 434 if (!resultArray->Get(scriptState->context(), i).ToLocal(&value))
438 return; 435 return;
439 results->append(value); 436 results->append(value);
440 } 437 }
441 } 438 }
442 } 439 }
443 440
444 } // namespace blink 441 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/ScriptController.h ('k') | third_party/WebKit/Source/core/dom/ScriptLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698