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

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

Issue 23450039: Pass isolate to ScriptValue constructor (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/bindings/v8/ScriptCallStackFactory.cpp ('k') | Source/bindings/v8/ScriptDebugServer.cpp » ('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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 v8::Local<v8::Value> ScriptController::callFunction(v8::Handle<v8::Function> fun ction, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[]) 155 v8::Local<v8::Value> ScriptController::callFunction(v8::Handle<v8::Function> fun ction, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[])
156 { 156 {
157 // Keep Frame (and therefore ScriptController) alive. 157 // Keep Frame (and therefore ScriptController) alive.
158 RefPtr<Frame> protect(m_frame); 158 RefPtr<Frame> protect(m_frame);
159 return ScriptController::callFunctionWithInstrumentation(m_frame ? m_frame-> document() : 0, function, receiver, argc, args, m_isolate); 159 return ScriptController::callFunctionWithInstrumentation(m_frame ? m_frame-> document() : 0, function, receiver, argc, args, m_isolate);
160 } 160 }
161 161
162 ScriptValue ScriptController::callFunctionEvenIfScriptDisabled(v8::Handle<v8::Fu nction> function, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Valu e> argv[]) 162 ScriptValue ScriptController::callFunctionEvenIfScriptDisabled(v8::Handle<v8::Fu nction> function, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Valu e> argv[])
163 { 163 {
164 // FIXME: This should probably perform the same isPaused check that happens in ScriptController::executeScript. 164 // FIXME: This should probably perform the same isPaused check that happens in ScriptController::executeScript.
165 return ScriptValue(callFunction(function, receiver, argc, argv)); 165 return ScriptValue(callFunction(function, receiver, argc, argv), m_isolate);
166 } 166 }
167 167
168 static void resourceInfo(const v8::Handle<v8::Function> function, String& resour ceName, int& lineNumber) 168 static void resourceInfo(const v8::Handle<v8::Function> function, String& resour ceName, int& lineNumber)
169 { 169 {
170 v8::ScriptOrigin origin = function->GetScriptOrigin(); 170 v8::ScriptOrigin origin = function->GetScriptOrigin();
171 if (origin.ResourceName().IsEmpty()) { 171 if (origin.ResourceName().IsEmpty()) {
172 resourceName = "undefined"; 172 resourceName = "undefined";
173 lineNumber = 1; 173 lineNumber = 1;
174 } else { 174 } else {
175 resourceName = toWebCoreString(origin.ResourceName()); 175 resourceName = toWebCoreString(origin.ResourceName());
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 const ScriptSourceCode& sourceCodeToCompile = maybeProcessedSourceCode ? *ma ybeProcessedSourceCode : sourceCode; 676 const ScriptSourceCode& sourceCodeToCompile = maybeProcessedSourceCode ? *ma ybeProcessedSourceCode : sourceCode;
677 677
678 v8::Context::Scope scope(v8Context); 678 v8::Context::Scope scope(v8Context);
679 v8::Local<v8::Value> object = compileAndRunScript(sourceCodeToCompile, corsS tatus); 679 v8::Local<v8::Value> object = compileAndRunScript(sourceCodeToCompile, corsS tatus);
680 680
681 m_sourceURL = savedSourceURL; 681 m_sourceURL = savedSourceURL;
682 682
683 if (object.IsEmpty()) 683 if (object.IsEmpty())
684 return ScriptValue(); 684 return ScriptValue();
685 685
686 return ScriptValue(object); 686 return ScriptValue(object, m_isolate);
687 } 687 }
688 688
689 void ScriptController::executeScriptInIsolatedWorld(int worldID, const Vector<Sc riptSourceCode>& sources, int extensionGroup, Vector<ScriptValue>* results) 689 void ScriptController::executeScriptInIsolatedWorld(int worldID, const Vector<Sc riptSourceCode>& sources, int extensionGroup, Vector<ScriptValue>* results)
690 { 690 {
691 ASSERT(worldID > 0); 691 ASSERT(worldID > 0);
692 692
693 v8::HandleScope handleScope(m_isolate); 693 v8::HandleScope handleScope(m_isolate);
694 v8::Local<v8::Array> v8Results; 694 v8::Local<v8::Array> v8Results;
695 { 695 {
696 v8::HandleScope evaluateHandleScope(m_isolate); 696 v8::HandleScope evaluateHandleScope(m_isolate);
(...skipping 12 matching lines...) Expand all
709 if (evaluationResult.IsEmpty()) 709 if (evaluationResult.IsEmpty())
710 evaluationResult = v8::Local<v8::Value>::New(m_isolate, v8::Unde fined(m_isolate)); 710 evaluationResult = v8::Local<v8::Value>::New(m_isolate, v8::Unde fined(m_isolate));
711 resultArray->Set(i, evaluationResult); 711 resultArray->Set(i, evaluationResult);
712 } 712 }
713 713
714 v8Results = evaluateHandleScope.Close(resultArray); 714 v8Results = evaluateHandleScope.Close(resultArray);
715 } 715 }
716 716
717 if (results && !v8Results.IsEmpty()) { 717 if (results && !v8Results.IsEmpty()) {
718 for (size_t i = 0; i < v8Results->Length(); ++i) 718 for (size_t i = 0; i < v8Results->Length(); ++i)
719 results->append(ScriptValue(v8Results->Get(i))); 719 results->append(ScriptValue(v8Results->Get(i), m_isolate));
720 } 720 }
721 } 721 }
722 722
723 } // namespace WebCore 723 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/ScriptCallStackFactory.cpp ('k') | Source/bindings/v8/ScriptDebugServer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698