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

Side by Side Diff: third_party/WebKit/Source/core/frame/DOMWindow.cpp

Issue 2681233004: Make External per-window rather than a static Persistent. (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « third_party/WebKit/Source/core/frame/DOMWindow.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "core/frame/DOMWindow.h" 5 #include "core/frame/DOMWindow.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/dom/ExceptionCode.h" 8 #include "core/dom/ExceptionCode.h"
9 #include "core/dom/ExecutionContext.h" 9 #include "core/dom/ExecutionContext.h"
10 #include "core/dom/SecurityContext.h" 10 #include "core/dom/SecurityContext.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 return parent ? parent->domWindow() : frame()->domWindow(); 100 return parent ? parent->domWindow() : frame()->domWindow();
101 } 101 }
102 102
103 DOMWindow* DOMWindow::top() const { 103 DOMWindow* DOMWindow::top() const {
104 if (!frame()) 104 if (!frame())
105 return nullptr; 105 return nullptr;
106 106
107 return frame()->tree().top()->domWindow(); 107 return frame()->tree().top()->domWindow();
108 } 108 }
109 109
110 External* DOMWindow::external() const { 110 External* DOMWindow::external() {
111 DEFINE_STATIC_LOCAL(Persistent<External>, external, (new External)); 111 if (!m_external)
112 return external; 112 m_external = new External;
113 return m_external;
113 } 114 }
114 115
115 DOMWindow* DOMWindow::anonymousIndexedGetter(uint32_t index) const { 116 DOMWindow* DOMWindow::anonymousIndexedGetter(uint32_t index) const {
116 if (!frame()) 117 if (!frame())
117 return nullptr; 118 return nullptr;
118 119
119 Frame* child = frame()->tree().scopedChild(index); 120 Frame* child = frame()->tree().scopedChild(index);
120 return child ? child->domWindow() : nullptr; 121 return child ? child->domWindow() : nullptr;
121 } 122 }
122 123
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 428
428 // If we're a top level window, bring the window to the front. 429 // If we're a top level window, bring the window to the front.
429 if (frame()->isMainFrame() && allowFocus) 430 if (frame()->isMainFrame() && allowFocus)
430 page->chromeClient().focus(); 431 page->chromeClient().focus();
431 432
432 page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */); 433 page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */);
433 } 434 }
434 435
435 DEFINE_TRACE(DOMWindow) { 436 DEFINE_TRACE(DOMWindow) {
436 visitor->trace(m_location); 437 visitor->trace(m_location);
438 visitor->trace(m_external);
437 EventTargetWithInlineData::trace(visitor); 439 EventTargetWithInlineData::trace(visitor);
438 } 440 }
439 441
440 } // namespace blink 442 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/DOMWindow.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698