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

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

Issue 2670763009: 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 return parent ? parent->domWindow() : frame()->domWindow(); 105 return parent ? parent->domWindow() : frame()->domWindow();
106 } 106 }
107 107
108 DOMWindow* DOMWindow::top() const { 108 DOMWindow* DOMWindow::top() const {
109 if (!frame()) 109 if (!frame())
110 return nullptr; 110 return nullptr;
111 111
112 return frame()->tree().top()->domWindow(); 112 return frame()->tree().top()->domWindow();
113 } 113 }
114 114
115 External* DOMWindow::external() const { 115 External* DOMWindow::external() {
116 DEFINE_STATIC_LOCAL(Persistent<External>, external, (new External)); 116 if (!m_external)
117 return external; 117 m_external = new External;
118 return m_external;
118 } 119 }
119 120
120 DOMWindow* DOMWindow::anonymousIndexedGetter(uint32_t index) const { 121 DOMWindow* DOMWindow::anonymousIndexedGetter(uint32_t index) const {
121 if (!frame()) 122 if (!frame())
122 return nullptr; 123 return nullptr;
123 124
124 Frame* child = frame()->tree().scopedChild(index); 125 Frame* child = frame()->tree().scopedChild(index);
125 return child ? child->domWindow() : nullptr; 126 return child ? child->domWindow() : nullptr;
126 } 127 }
127 128
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 // If we're a top level window, bring the window to the front. 433 // If we're a top level window, bring the window to the front.
433 if (frame()->isMainFrame() && allowFocus) 434 if (frame()->isMainFrame() && allowFocus)
434 page->chromeClient().focus(); 435 page->chromeClient().focus();
435 436
436 page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */); 437 page->focusController().focusDocumentView(frame(), true /* notifyEmbedder */);
437 } 438 }
438 439
439 DEFINE_TRACE(DOMWindow) { 440 DEFINE_TRACE(DOMWindow) {
440 visitor->trace(m_frame); 441 visitor->trace(m_frame);
441 visitor->trace(m_location); 442 visitor->trace(m_location);
443 visitor->trace(m_external);
442 EventTargetWithInlineData::trace(visitor); 444 EventTargetWithInlineData::trace(visitor);
443 } 445 }
444 446
445 } // namespace blink 447 } // 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