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

Unified Diff: sky/engine/bindings/core/v8/ScriptController.cpp

Issue 776143003: Remove Isolated Worlds from Sky (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 side-by-side diff with in-line comments
Download patch
Index: sky/engine/bindings/core/v8/ScriptController.cpp
diff --git a/sky/engine/bindings/core/v8/ScriptController.cpp b/sky/engine/bindings/core/v8/ScriptController.cpp
index 73fd258e2b57b494b961db52043ec4f465f034c8..9ee669e958124fd6513f8aa6c4da5ebe56ccc936 100644
--- a/sky/engine/bindings/core/v8/ScriptController.cpp
+++ b/sky/engine/bindings/core/v8/ScriptController.cpp
@@ -162,30 +162,13 @@ WindowProxy* ScriptController::existingWindowProxy(DOMWrapperWorld& world)
{
if (world.isMainWorld())
return m_windowProxy->isContextInitialized() ? m_windowProxy.get() : 0;
-
- IsolatedWorldMap::iterator iter = m_isolatedWorlds.find(world.worldId());
- if (iter == m_isolatedWorlds.end())
- return 0;
- return iter->value->isContextInitialized() ? iter->value.get() : 0;
+ return 0;
}
WindowProxy* ScriptController::windowProxy(DOMWrapperWorld& world)
{
- WindowProxy* windowProxy = 0;
- if (world.isMainWorld()) {
- windowProxy = m_windowProxy.get();
- } else {
- IsolatedWorldMap::iterator iter = m_isolatedWorlds.find(world.worldId());
- if (iter != m_isolatedWorlds.end()) {
- windowProxy = iter->value.get();
- } else {
- OwnPtr<WindowProxy> isolatedWorldWindowProxy = WindowProxy::create(m_frame, world, m_isolate);
- windowProxy = isolatedWorldWindowProxy.get();
- m_isolatedWorlds.set(world.worldId(), isolatedWorldWindowProxy.release());
- }
- }
- windowProxy->initializeIfNeeded();
- return windowProxy;
+ m_windowProxy->initializeIfNeeded();
+ return m_windowProxy.get();
}
V8Extensions& ScriptController::registeredExtensions()
@@ -222,24 +205,14 @@ void ScriptController::setCaptureCallStackForUncaughtExceptions(bool value)
v8::V8::SetCaptureStackTraceForUncaughtExceptions(value, ScriptCallStack::maxCallStackSizeToCapture, stackTraceOptions);
}
-void ScriptController::setWorldDebugId(int worldId, int debuggerId)
+void ScriptController::setWorldDebugId(int debuggerId)
{
ASSERT(debuggerId > 0);
- bool isMainWorld = worldId == MainWorldId;
- WindowProxy* windowProxy = 0;
- if (isMainWorld) {
- windowProxy = m_windowProxy.get();
- } else {
- IsolatedWorldMap::iterator iter = m_isolatedWorlds.find(worldId);
- if (iter != m_isolatedWorlds.end())
- windowProxy = iter->value.get();
- }
- if (!windowProxy || !windowProxy->isContextInitialized())
+ if (!m_windowProxy || !m_windowProxy->isContextInitialized())
return;
v8::HandleScope scope(m_isolate);
- v8::Local<v8::Context> context = windowProxy->context();
- const char* worldName = isMainWorld ? "page" : "injected";
- V8PerContextDebugData::setContextDebugData(context, worldName, debuggerId);
+ v8::Local<v8::Context> context = m_windowProxy->context();
+ V8PerContextDebugData::setContextDebugData(context, "page", debuggerId);
}
void ScriptController::updateDocument()
@@ -294,33 +267,6 @@ v8::Local<v8::Value> ScriptController::evaluateScriptInMainWorld(const ScriptSou
return handleScope.Escape(object);
}
-void ScriptController::executeScriptInIsolatedWorld(int worldID, const Vector<ScriptSourceCode>& sources, int extensionGroup, Vector<v8::Local<v8::Value> >* results)
-{
- ASSERT(worldID > 0);
-
- RefPtr<DOMWrapperWorld> world = DOMWrapperWorld::ensureIsolatedWorld(worldID, extensionGroup);
- WindowProxy* isolatedWorldWindowProxy = windowProxy(*world);
- if (!isolatedWorldWindowProxy->isContextInitialized())
- return;
-
- ScriptState* scriptState = isolatedWorldWindowProxy->scriptState();
- v8::EscapableHandleScope handleScope(scriptState->isolate());
- ScriptState::Scope scope(scriptState);
- v8::Local<v8::Array> resultArray = v8::Array::New(m_isolate, sources.size());
-
- for (size_t i = 0; i < sources.size(); ++i) {
- v8::Local<v8::Value> evaluationResult = executeScriptAndReturnValue(scriptState->context(), sources[i]);
- if (evaluationResult.IsEmpty())
- evaluationResult = v8::Local<v8::Value>::New(m_isolate, v8::Undefined(m_isolate));
- resultArray->Set(i, evaluationResult);
- }
-
- if (results) {
- for (size_t i = 0; i < resultArray->Length(); ++i)
- results->append(handleScope.Escape(resultArray->Get(i)));
- }
-}
-
void ScriptController::executeModuleScript(AbstractModule& module, const String& source, const TextPosition& textPosition)
{
v8::HandleScope handleScope(m_isolate);
« no previous file with comments | « sky/engine/bindings/core/v8/ScriptController.h ('k') | sky/engine/bindings/core/v8/SerializedScriptValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698