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

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

Issue 517043003: Move Frame to the Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update OilpanExpectations Created 6 years, 3 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 } 135 }
136 136
137 void ScriptController::updateSecurityOrigin(SecurityOrigin* origin) 137 void ScriptController::updateSecurityOrigin(SecurityOrigin* origin)
138 { 138 {
139 m_windowProxy->updateSecurityOrigin(origin); 139 m_windowProxy->updateSecurityOrigin(origin);
140 } 140 }
141 141
142 v8::Local<v8::Value> ScriptController::callFunction(v8::Handle<v8::Function> fun ction, v8::Handle<v8::Value> receiver, int argc, v8::Handle<v8::Value> info[]) 142 v8::Local<v8::Value> ScriptController::callFunction(v8::Handle<v8::Function> fun ction, v8::Handle<v8::Value> receiver, int argc, v8::Handle<v8::Value> info[])
143 { 143 {
144 // Keep LocalFrame (and therefore ScriptController) alive. 144 // Keep LocalFrame (and therefore ScriptController) alive.
145 RefPtr<LocalFrame> protect(m_frame); 145 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame);
146 return ScriptController::callFunction(m_frame->document(), function, receive r, argc, info, m_isolate); 146 return ScriptController::callFunction(m_frame->document(), function, receive r, argc, info, m_isolate);
147 } 147 }
148 148
149 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) 149 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)
150 { 150 {
151 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "FunctionCall", "data", devToolsTraceEventData(context, function, isolate)); 151 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "FunctionCall", "data", devToolsTraceEventData(context, function, isolate));
152 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), " CallStack", "stack", InspectorCallStackEvent::currentCallStack()); 152 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), " CallStack", "stack", InspectorCallStackEvent::currentCallStack());
153 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli ne migrates to tracing. 153 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli ne migrates to tracing.
154 InspectorInstrumentationCookie cookie; 154 InspectorInstrumentationCookie cookie;
155 if (InspectorInstrumentation::timelineAgentEnabled(context)) { 155 if (InspectorInstrumentation::timelineAgentEnabled(context)) {
(...skipping 26 matching lines...) Expand all
182 // Isolate exceptions that occur when compiling and executing 182 // Isolate exceptions that occur when compiling and executing
183 // the code. These exceptions should not interfere with 183 // the code. These exceptions should not interfere with
184 // javascript code we might evaluate from C++ when returning 184 // javascript code we might evaluate from C++ when returning
185 // from here. 185 // from here.
186 v8::TryCatch tryCatch; 186 v8::TryCatch tryCatch;
187 tryCatch.SetVerbose(true); 187 tryCatch.SetVerbose(true);
188 188
189 v8::Handle<v8::Script> script = V8ScriptRunner::compileScript(source, m_ isolate, corsStatus, v8CacheOptions); 189 v8::Handle<v8::Script> script = V8ScriptRunner::compileScript(source, m_ isolate, corsStatus, v8CacheOptions);
190 190
191 // Keep LocalFrame (and therefore ScriptController) alive. 191 // Keep LocalFrame (and therefore ScriptController) alive.
192 RefPtr<LocalFrame> protect(m_frame); 192 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame);
193 result = V8ScriptRunner::runCompiledScript(script, m_frame->document(), m_isolate); 193 result = V8ScriptRunner::runCompiledScript(script, m_frame->document(), m_isolate);
194 ASSERT(!tryCatch.HasCaught() || result.IsEmpty()); 194 ASSERT(!tryCatch.HasCaught() || result.IsEmpty());
195 } 195 }
196 196
197 InspectorInstrumentation::didEvaluateScript(cookie); 197 InspectorInstrumentation::didEvaluateScript(cookie);
198 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update Counters", "data", InspectorUpdateCountersEvent::data()); 198 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update Counters", "data", InspectorUpdateCountersEvent::data());
199 199
200 return result; 200 return result;
201 } 201 }
202 202
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 { 526 {
527 if (!protocolIsJavaScript(url)) 527 if (!protocolIsJavaScript(url))
528 return false; 528 return false;
529 529
530 if (!m_frame->page() 530 if (!m_frame->page()
531 || !m_frame->document()->contentSecurityPolicy()->allowJavaScriptURLs(m_ frame->document()->url(), eventHandlerPosition().m_line)) 531 || !m_frame->document()->contentSecurityPolicy()->allowJavaScriptURLs(m_ frame->document()->url(), eventHandlerPosition().m_line))
532 return true; 532 return true;
533 533
534 // We need to hold onto the LocalFrame here because executing script can 534 // We need to hold onto the LocalFrame here because executing script can
535 // destroy the frame. 535 // destroy the frame.
536 RefPtr<LocalFrame> protector(m_frame); 536 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame);
537 RefPtrWillBeRawPtr<Document> ownerDocument(m_frame->document()); 537 RefPtrWillBeRawPtr<Document> ownerDocument(m_frame->document());
538 538
539 const int javascriptSchemeLength = sizeof("javascript:") - 1; 539 const int javascriptSchemeLength = sizeof("javascript:") - 1;
540 540
541 bool locationChangeBefore = m_frame->navigationScheduler().locationChangePen ding(); 541 bool locationChangeBefore = m_frame->navigationScheduler().locationChangePen ding();
542 542
543 String decodedURL = decodeURLEscapeSequences(url.string()); 543 String decodedURL = decodeURLEscapeSequences(url.string());
544 v8::HandleScope handleScope(m_isolate); 544 v8::HandleScope handleScope(m_isolate);
545 v8::Local<v8::Value> result = evaluateScriptInMainWorld(ScriptSourceCode(dec odedURL.substring(javascriptSchemeLength)), NotSharableCrossOrigin, DoNotExecute ScriptWhenScriptsDisabled); 545 v8::Local<v8::Value> result = evaluateScriptInMainWorld(ScriptSourceCode(dec odedURL.substring(javascriptSchemeLength)), NotSharableCrossOrigin, DoNotExecute ScriptWhenScriptsDisabled);
546 546
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 m_sourceURL = &sourceURL; 589 m_sourceURL = &sourceURL;
590 590
591 v8::EscapableHandleScope handleScope(m_isolate); 591 v8::EscapableHandleScope handleScope(m_isolate);
592 v8::Handle<v8::Context> context = toV8Context(m_frame, DOMWrapperWorld::main World()); 592 v8::Handle<v8::Context> context = toV8Context(m_frame, DOMWrapperWorld::main World());
593 if (context.IsEmpty()) 593 if (context.IsEmpty())
594 return v8::Local<v8::Value>(); 594 return v8::Local<v8::Value>();
595 595
596 ScriptState* scriptState = ScriptState::from(context); 596 ScriptState* scriptState = ScriptState::from(context);
597 ScriptState::Scope scope(scriptState); 597 ScriptState::Scope scope(scriptState);
598 598
599 RefPtr<LocalFrame> protect(m_frame); 599 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame);
600 if (m_frame->loader().stateMachine()->isDisplayingInitialEmptyDocument()) 600 if (m_frame->loader().stateMachine()->isDisplayingInitialEmptyDocument())
601 m_frame->loader().didAccessInitialDocument(); 601 m_frame->loader().didAccessInitialDocument();
602 602
603 OwnPtr<ScriptSourceCode> maybeProcessedSourceCode = InspectorInstrumentatio n::preprocess(m_frame, sourceCode); 603 OwnPtr<ScriptSourceCode> maybeProcessedSourceCode = InspectorInstrumentatio n::preprocess(m_frame, sourceCode);
604 const ScriptSourceCode& sourceCodeToCompile = maybeProcessedSourceCode ? *ma ybeProcessedSourceCode : sourceCode; 604 const ScriptSourceCode& sourceCodeToCompile = maybeProcessedSourceCode ? *ma ybeProcessedSourceCode : sourceCode;
605 605
606 v8::Local<v8::Value> object = executeScriptAndReturnValue(scriptState->conte xt(), sourceCodeToCompile, corsStatus); 606 v8::Local<v8::Value> object = executeScriptAndReturnValue(scriptState->conte xt(), sourceCodeToCompile, corsStatus);
607 m_sourceURL = savedSourceURL; 607 m_sourceURL = savedSourceURL;
608 608
609 if (object.IsEmpty()) 609 if (object.IsEmpty())
(...skipping 23 matching lines...) Expand all
633 resultArray->Set(i, evaluationResult); 633 resultArray->Set(i, evaluationResult);
634 } 634 }
635 635
636 if (results) { 636 if (results) {
637 for (size_t i = 0; i < resultArray->Length(); ++i) 637 for (size_t i = 0; i < resultArray->Length(); ++i)
638 results->append(handleScope.Escape(resultArray->Get(i))); 638 results->append(handleScope.Escape(resultArray->Get(i)));
639 } 639 }
640 } 640 }
641 641
642 } // namespace blink 642 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698