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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/WindowProxyManager.cpp

Issue 2743653002: Make context initialization order deterministic in WebFrame::swap(). (Closed)
Patch Set: Add comment. Created 3 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 unified diff | Download patch
OLDNEW
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 8
9 namespace blink { 9 namespace blink {
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 for (auto& entry : m_isolatedWorlds) 50 for (auto& entry : m_isolatedWorlds)
51 entry.value->clearForClose(); 51 entry.value->clearForClose();
52 } 52 }
53 53
54 void WindowProxyManagerBase::clearForNavigation() { 54 void WindowProxyManagerBase::clearForNavigation() {
55 m_windowProxy->clearForNavigation(); 55 m_windowProxy->clearForNavigation();
56 for (auto& entry : m_isolatedWorlds) 56 for (auto& entry : m_isolatedWorlds)
57 entry.value->clearForNavigation(); 57 entry.value->clearForNavigation();
58 } 58 }
59 59
60 void WindowProxyManagerBase::releaseGlobals( 60 void WindowProxyManagerBase::releaseGlobals(GlobalsVector& globals) {
61 HashMap<DOMWrapperWorld*, v8::Local<v8::Object>>& map) { 61 globals.reserveInitialCapacity(1 + m_isolatedWorlds.size());
62 map.insert(&m_windowProxy->world(), m_windowProxy->releaseGlobal()); 62 globals.emplace_back(&m_windowProxy->world(), m_windowProxy->releaseGlobal());
63 for (auto& entry : m_isolatedWorlds) 63 for (auto& entry : m_isolatedWorlds) {
64 map.insert(&entry.value->world(), 64 globals.emplace_back(&entry.value->world(),
65 windowProxy(entry.value->world())->releaseGlobal()); 65 windowProxy(entry.value->world())->releaseGlobal());
66 }
66 } 67 }
67 68
68 void WindowProxyManagerBase::setGlobals( 69 void WindowProxyManagerBase::setGlobals(const GlobalsVector& globals) {
69 const HashMap<DOMWrapperWorld*, v8::Local<v8::Object>>& map) { 70 for (const auto& entry : globals)
70 for (auto& entry : map) 71 windowProxy(*entry.first)->setGlobal(entry.second);
71 windowProxy(*entry.key)->setGlobal(entry.value);
72 } 72 }
73 73
74 WindowProxyManagerBase::WindowProxyManagerBase(Frame& frame) 74 WindowProxyManagerBase::WindowProxyManagerBase(Frame& frame)
75 : m_isolate(v8::Isolate::GetCurrent()), 75 : m_isolate(v8::Isolate::GetCurrent()),
76 m_frame(&frame), 76 m_frame(&frame),
77 m_windowProxy(createWindowProxyForFrame(m_isolate, 77 m_windowProxy(createWindowProxyForFrame(m_isolate,
78 frame, 78 frame,
79 &DOMWrapperWorld::mainWorld())) {} 79 &DOMWrapperWorld::mainWorld())) {}
80 80
81 void LocalWindowProxyManager::updateSecurityOrigin( 81 void LocalWindowProxyManager::updateSecurityOrigin(
82 SecurityOrigin* securityOrigin) { 82 SecurityOrigin* securityOrigin) {
83 static_cast<LocalWindowProxy*>(mainWorldProxy()) 83 static_cast<LocalWindowProxy*>(mainWorldProxy())
84 ->updateSecurityOrigin(securityOrigin); 84 ->updateSecurityOrigin(securityOrigin);
85 for (auto& entry : isolatedWorlds()) { 85 for (auto& entry : isolatedWorlds()) {
86 auto* isolatedWindowProxy = 86 auto* isolatedWindowProxy =
87 static_cast<LocalWindowProxy*>(entry.value.get()); 87 static_cast<LocalWindowProxy*>(entry.value.get());
88 SecurityOrigin* isolatedSecurityOrigin = 88 SecurityOrigin* isolatedSecurityOrigin =
89 isolatedWindowProxy->world().isolatedWorldSecurityOrigin(); 89 isolatedWindowProxy->world().isolatedWorldSecurityOrigin();
90 isolatedWindowProxy->updateSecurityOrigin(isolatedSecurityOrigin); 90 isolatedWindowProxy->updateSecurityOrigin(isolatedSecurityOrigin);
91 } 91 }
92 } 92 }
93 93
94 } // namespace blink 94 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/WindowProxyManager.h ('k') | third_party/WebKit/Source/web/WebFrame.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698