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

Unified Diff: Source/bindings/core/v8/WindowProxyManager.cpp

Issue 834203003: Revert of Revert of Revert of Reland factor out window proxy management (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 11 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/core/v8/WindowProxyManager.h ('k') | Source/bindings/core/v8/v8.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/WindowProxyManager.cpp
diff --git a/Source/bindings/core/v8/WindowProxyManager.cpp b/Source/bindings/core/v8/WindowProxyManager.cpp
deleted file mode 100644
index 9520ec4ee4002b3b4f15e56c18ab6d41bad854db..0000000000000000000000000000000000000000
--- a/Source/bindings/core/v8/WindowProxyManager.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "config.h"
-#include "bindings/core/v8/WindowProxyManager.h"
-
-#include "bindings/core/v8/DOMWrapperWorld.h"
-#include "bindings/core/v8/WindowProxy.h"
-#include "core/frame/Frame.h"
-
-namespace blink {
-
-PassOwnPtrWillBeRawPtr<WindowProxyManager> WindowProxyManager::create(Frame* frame)
-{
- return adoptPtrWillBeNoop(new WindowProxyManager(frame));
-}
-
-WindowProxyManager::~WindowProxyManager()
-{
-}
-
-void WindowProxyManager::trace(Visitor* visitor)
-{
-#if ENABLE(OILPAN)
- visitor->trace(m_frame);
- visitor->trace(m_windowProxy);
- visitor->trace(m_isolatedWorlds);
-#endif
-}
-
-WindowProxy* WindowProxyManager::windowProxy(DOMWrapperWorld& world)
-{
- WindowProxy* windowProxy = nullptr;
- 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 {
- OwnPtrWillBeRawPtr<WindowProxy> isolatedWorldWindowProxy = WindowProxy::create(m_frame, world, m_isolate);
- windowProxy = isolatedWorldWindowProxy.get();
- m_isolatedWorlds.set(world.worldId(), isolatedWorldWindowProxy.release());
- }
- }
- return windowProxy;
-}
-
-void WindowProxyManager::clearForClose()
-{
- m_windowProxy->clearForClose();
- for (auto& entry : m_isolatedWorlds)
- entry.value->clearForClose();
-}
-
-void WindowProxyManager::clearForNavigation()
-{
- m_windowProxy->clearForNavigation();
- for (auto& entry : m_isolatedWorlds)
- entry.value->clearForNavigation();
-}
-
-WindowProxy* WindowProxyManager::existingWindowProxy(DOMWrapperWorld& world)
-{
- if (world.isMainWorld())
- return m_windowProxy->isContextInitialized() ? m_windowProxy.get() : nullptr;
-
- IsolatedWorldMap::iterator iter = m_isolatedWorlds.find(world.worldId());
- if (iter == m_isolatedWorlds.end())
- return nullptr;
- return iter->value->isContextInitialized() ? iter->value.get() : nullptr;
-}
-
-void WindowProxyManager::collectIsolatedContexts(Vector<std::pair<ScriptState*, SecurityOrigin*>>& result)
-{
- for (auto& entry : m_isolatedWorlds) {
- WindowProxy* isolatedWorldWindowProxy = entry.value.get();
- SecurityOrigin* origin = isolatedWorldWindowProxy->world().isolatedWorldSecurityOrigin();
- if (!isolatedWorldWindowProxy->isContextInitialized())
- continue;
- result.append(std::make_pair(isolatedWorldWindowProxy->scriptState(), origin));
- }
-}
-
-void WindowProxyManager::setWorldDebugId(int worldId, int debuggerId)
-{
- ASSERT(debuggerId > 0);
- bool isMainWorld = worldId == MainWorldId;
- WindowProxy* windowProxy = nullptr;
- 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())
- return;
- v8::HandleScope scope(m_isolate);
- v8::Local<v8::Context> context = windowProxy->context();
- const char* worldName = isMainWorld ? "page" : "injected";
- V8PerContextDebugData::setContextDebugData(context, worldName, debuggerId);
-}
-
-WindowProxyManager::WindowProxyManager(Frame* frame)
- : m_frame(frame)
- , m_isolate(v8::Isolate::GetCurrent())
- , m_windowProxy(WindowProxy::create(frame, DOMWrapperWorld::mainWorld(), m_isolate))
-{
-}
-
-} // namespace blink
« no previous file with comments | « Source/bindings/core/v8/WindowProxyManager.h ('k') | Source/bindings/core/v8/v8.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698