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

Unified Diff: Source/bindings/v8/ScriptController.cpp

Issue 209713003: Make DOMWrapperWorld::current() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/v8/ScriptController.h ('k') | Source/bindings/v8/ScriptPreprocessor.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/ScriptController.cpp
diff --git a/Source/bindings/v8/ScriptController.cpp b/Source/bindings/v8/ScriptController.cpp
index 5e5e1ddcba7942a981655100045a79d775e49424..38ad6836050e71e2cea9ee90124ffd2c4b4e8189 100644
--- a/Source/bindings/v8/ScriptController.cpp
+++ b/Source/bindings/v8/ScriptController.cpp
@@ -214,34 +214,30 @@ bool ScriptController::initializeMainWorld()
return windowShell(DOMWrapperWorld::mainWorld())->isContextInitialized();
}
-V8WindowShell* ScriptController::existingWindowShell(DOMWrapperWorld* world)
+V8WindowShell* ScriptController::existingWindowShell(DOMWrapperWorld& world)
{
- ASSERT(world);
-
- if (world->isMainWorld())
+ if (world.isMainWorld())
return m_windowShell->isContextInitialized() ? m_windowShell.get() : 0;
- IsolatedWorldMap::iterator iter = m_isolatedWorlds.find(world->worldId());
+ IsolatedWorldMap::iterator iter = m_isolatedWorlds.find(world.worldId());
if (iter == m_isolatedWorlds.end())
return 0;
return iter->value->isContextInitialized() ? iter->value.get() : 0;
}
-V8WindowShell* ScriptController::windowShell(DOMWrapperWorld* world)
+V8WindowShell* ScriptController::windowShell(DOMWrapperWorld& world)
{
- ASSERT(world);
-
V8WindowShell* shell = 0;
- if (world->isMainWorld())
+ if (world.isMainWorld())
shell = m_windowShell.get();
else {
- IsolatedWorldMap::iterator iter = m_isolatedWorlds.find(world->worldId());
+ IsolatedWorldMap::iterator iter = m_isolatedWorlds.find(world.worldId());
if (iter != m_isolatedWorlds.end())
shell = iter->value.get();
else {
OwnPtr<V8WindowShell> isolatedWorldShell = V8WindowShell::create(m_frame, world, m_isolate);
shell = isolatedWorldShell.get();
- m_isolatedWorlds.set(world->worldId(), isolatedWorldShell.release());
+ m_isolatedWorlds.set(world.worldId(), isolatedWorldShell.release());
}
}
if (!shell->isContextInitialized() && shell->initializeIfNeeded())
@@ -254,8 +250,8 @@ bool ScriptController::shouldBypassMainWorldContentSecurityPolicy()
v8::Handle<v8::Context> context = m_isolate->GetCurrentContext();
if (context.IsEmpty() || !toDOMWindow(context))
return false;
- DOMWrapperWorld* world = DOMWrapperWorld::current(m_isolate);
- return world->isIsolatedWorld() ? world->isolatedWorldHasContentSecurityPolicy() : false;
+ DOMWrapperWorld& world = DOMWrapperWorld::current(m_isolate);
+ return world.isIsolatedWorld() ? world.isolatedWorldHasContentSecurityPolicy() : false;
}
TextPosition ScriptController::eventHandlerPosition() const
@@ -454,7 +450,7 @@ void ScriptController::collectIsolatedContexts(Vector<std::pair<ScriptState*, Se
v8::HandleScope handleScope(m_isolate);
for (IsolatedWorldMap::iterator it = m_isolatedWorlds.begin(); it != m_isolatedWorlds.end(); ++it) {
V8WindowShell* isolatedWorldShell = it->value.get();
- SecurityOrigin* origin = isolatedWorldShell->world()->isolatedWorldSecurityOrigin();
+ SecurityOrigin* origin = isolatedWorldShell->world().isolatedWorldSecurityOrigin();
if (!origin)
continue;
v8::Local<v8::Context> v8Context = isolatedWorldShell->context();
@@ -620,7 +616,7 @@ void ScriptController::executeScriptInIsolatedWorld(int worldID, const Vector<Sc
{
v8::EscapableHandleScope evaluateHandleScope(m_isolate);
RefPtr<DOMWrapperWorld> world = DOMWrapperWorld::ensureIsolatedWorld(worldID, extensionGroup);
- V8WindowShell* isolatedWorldShell = windowShell(world.get());
+ V8WindowShell* isolatedWorldShell = windowShell(*world);
if (!isolatedWorldShell->isContextInitialized())
return;
« no previous file with comments | « Source/bindings/v8/ScriptController.h ('k') | Source/bindings/v8/ScriptPreprocessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698