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

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

Issue 713743002: Remove a EscapableHandleScope from executeScriptInIsolatedWorld() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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/core/v8/ScriptController.h ('k') | no next file » | 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 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 void ScriptController::executeScriptInIsolatedWorld(int worldID, const Vector<Sc riptSourceCode>& sources, int extensionGroup, Vector<v8::Local<v8::Value> >* res ults) 630 void ScriptController::executeScriptInIsolatedWorld(int worldID, const Vector<Sc riptSourceCode>& sources, int extensionGroup, Vector<v8::Local<v8::Value> >* res ults)
631 { 631 {
632 ASSERT(worldID > 0); 632 ASSERT(worldID > 0);
633 633
634 RefPtr<DOMWrapperWorld> world = DOMWrapperWorld::ensureIsolatedWorld(m_isola te, worldID, extensionGroup); 634 RefPtr<DOMWrapperWorld> world = DOMWrapperWorld::ensureIsolatedWorld(m_isola te, worldID, extensionGroup);
635 WindowProxy* isolatedWorldWindowProxy = windowProxy(*world); 635 WindowProxy* isolatedWorldWindowProxy = windowProxy(*world);
636 if (!isolatedWorldWindowProxy->isContextInitialized()) 636 if (!isolatedWorldWindowProxy->isContextInitialized())
637 return; 637 return;
638 638
639 ScriptState* scriptState = isolatedWorldWindowProxy->scriptState(); 639 ScriptState* scriptState = isolatedWorldWindowProxy->scriptState();
640 v8::EscapableHandleScope handleScope(scriptState->isolate()); 640 v8::Context::Scope scope(scriptState->context());
641 ScriptState::Scope scope(scriptState);
642 v8::Local<v8::Array> resultArray = v8::Array::New(m_isolate, sources.size()) ; 641 v8::Local<v8::Array> resultArray = v8::Array::New(m_isolate, sources.size()) ;
643 642
644 for (size_t i = 0; i < sources.size(); ++i) { 643 for (size_t i = 0; i < sources.size(); ++i) {
645 v8::Local<v8::Value> evaluationResult = executeScriptAndReturnValue(scri ptState->context(), sources[i]); 644 v8::Local<v8::Value> evaluationResult = executeScriptAndReturnValue(scri ptState->context(), sources[i]);
646 if (evaluationResult.IsEmpty()) 645 if (evaluationResult.IsEmpty())
647 evaluationResult = v8::Local<v8::Value>::New(m_isolate, v8::Undefine d(m_isolate)); 646 evaluationResult = v8::Local<v8::Value>::New(m_isolate, v8::Undefine d(m_isolate));
648 resultArray->Set(i, evaluationResult); 647 resultArray->Set(i, evaluationResult);
649 } 648 }
650 649
651 if (results) { 650 if (results) {
652 for (size_t i = 0; i < resultArray->Length(); ++i) 651 for (size_t i = 0; i < resultArray->Length(); ++i)
653 results->append(handleScope.Escape(resultArray->Get(i))); 652 results->append(resultArray->Get(i));
654 } 653 }
655 } 654 }
656 655
657 } // namespace blink 656 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/ScriptController.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698