| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "bindings/core/v8/WindowProxyManager.h" | 5 #include "bindings/core/v8/WindowProxyManager.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/DOMWrapperWorld.h" | 7 #include "bindings/core/v8/DOMWrapperWorld.h" |
| 8 #include "bindings/core/v8/WindowProxy.h" | 8 #include "bindings/core/v8/WindowProxy.h" |
| 9 #include "core/frame/Frame.h" | 9 #include "core/frame/Frame.h" |
| 10 | 10 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 return iter->value->isContextInitialized() ? iter->value.get() : nullptr; | 71 return iter->value->isContextInitialized() ? iter->value.get() : nullptr; |
| 72 } | 72 } |
| 73 | 73 |
| 74 void WindowProxyManager::collectIsolatedContexts(Vector<std::pair<ScriptState*,
SecurityOrigin*>>& result) | 74 void WindowProxyManager::collectIsolatedContexts(Vector<std::pair<ScriptState*,
SecurityOrigin*>>& result) |
| 75 { | 75 { |
| 76 for (auto& entry : m_isolatedWorlds) { | 76 for (auto& entry : m_isolatedWorlds) { |
| 77 WindowProxy* isolatedWorldWindowProxy = entry.value.get(); | 77 WindowProxy* isolatedWorldWindowProxy = entry.value.get(); |
| 78 SecurityOrigin* origin = isolatedWorldWindowProxy->world().isolatedWorld
SecurityOrigin(); | 78 SecurityOrigin* origin = isolatedWorldWindowProxy->world().isolatedWorld
SecurityOrigin(); |
| 79 if (!isolatedWorldWindowProxy->isContextInitialized()) | 79 if (!isolatedWorldWindowProxy->isContextInitialized()) |
| 80 continue; | 80 continue; |
| 81 result.append(std::make_pair(isolatedWorldWindowProxy->scriptState(), or
igin)); | 81 result.append(std::make_pair(isolatedWorldWindowProxy->getScriptState(),
origin)); |
| 82 } | 82 } |
| 83 } | 83 } |
| 84 | 84 |
| 85 void WindowProxyManager::releaseGlobals(HashMap<DOMWrapperWorld*, v8::Local<v8::
Object>>& map) | 85 void WindowProxyManager::releaseGlobals(HashMap<DOMWrapperWorld*, v8::Local<v8::
Object>>& map) |
| 86 { | 86 { |
| 87 map.add(&m_windowProxy->world(), m_windowProxy->releaseGlobal()); | 87 map.add(&m_windowProxy->world(), m_windowProxy->releaseGlobal()); |
| 88 for (auto& entry : m_isolatedWorlds) | 88 for (auto& entry : m_isolatedWorlds) |
| 89 map.add(&entry.value->world(), windowProxy(entry.value->world())->releas
eGlobal()); | 89 map.add(&entry.value->world(), windowProxy(entry.value->world())->releas
eGlobal()); |
| 90 } | 90 } |
| 91 | 91 |
| 92 void WindowProxyManager::setGlobals(const HashMap<DOMWrapperWorld*, v8::Local<v8
::Object>>& map) | 92 void WindowProxyManager::setGlobals(const HashMap<DOMWrapperWorld*, v8::Local<v8
::Object>>& map) |
| 93 { | 93 { |
| 94 for (auto& entry : map) | 94 for (auto& entry : map) |
| 95 windowProxy(*entry.key)->setGlobal(entry.value); | 95 windowProxy(*entry.key)->setGlobal(entry.value); |
| 96 } | 96 } |
| 97 | 97 |
| 98 WindowProxyManager::WindowProxyManager(Frame& frame) | 98 WindowProxyManager::WindowProxyManager(Frame& frame) |
| 99 : m_frame(&frame) | 99 : m_frame(&frame) |
| 100 , m_isolate(v8::Isolate::GetCurrent()) | 100 , m_isolate(v8::Isolate::GetCurrent()) |
| 101 , m_windowProxy(WindowProxy::create(m_isolate, &frame, DOMWrapperWorld::main
World())) | 101 , m_windowProxy(WindowProxy::create(m_isolate, &frame, DOMWrapperWorld::main
World())) |
| 102 { | 102 { |
| 103 } | 103 } |
| 104 | 104 |
| 105 } // namespace blink | 105 } // namespace blink |
| OLD | NEW |