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

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

Issue 2680843006: Tidy DEFINE_(THREAD_SAFE_)STATIC_LOCAL() implementations. (Closed)
Patch Set: explain safety of HTMLTableSectionElement singletons 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Simon Hausmann <hausmann@kde.org> 5 * 2000 Simon Hausmann <hausmann@kde.org>
6 * 2000 Stefan Schimanski <1Stein@gmx.de> 6 * 2000 Stefan Schimanski <1Stein@gmx.de>
7 * 2001 George Staikos <staikos@kde.org> 7 * 2001 George Staikos <staikos@kde.org>
8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
9 * rights reserved. 9 * rights reserved.
10 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> 10 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com>
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 return tree().parent()->isRemoteFrame(); 118 return tree().parent()->isRemoteFrame();
119 } 119 }
120 120
121 HTMLFrameOwnerElement* Frame::deprecatedLocalOwner() const { 121 HTMLFrameOwnerElement* Frame::deprecatedLocalOwner() const {
122 return m_owner && m_owner->isLocal() ? toHTMLFrameOwnerElement(m_owner) 122 return m_owner && m_owner->isLocal() ? toHTMLFrameOwnerElement(m_owner)
123 : nullptr; 123 : nullptr;
124 } 124 }
125 125
126 static ChromeClient& emptyChromeClient() { 126 static ChromeClient& emptyChromeClient() {
127 DEFINE_STATIC_LOCAL(EmptyChromeClient, client, (EmptyChromeClient::create())); 127 // |ChromeClient| contains a weak reference to a |Node| (which derives
128 // from |ScriptWrappable|). That reference is only used for unit testing
129 // purposes and will not accidentally leak between contexts. Consequently,
haraken 2017/02/11 10:25:20 Nit: I don't think "leak between contexts" can hap
sof 2017/02/11 12:09:11 Hmm, doesn't the test from https://codereview.chro
dcheng 2017/02/12 09:33:45 The cross-context leak happens if: - we have a sta
sof 2017/02/12 21:52:28 Yes, it could be made to work for the unit tests t
haraken 2017/02/12 23:56:47 I think the problem here is *just* (=not security
130 // disable the singleton verification check.
131 DEFINE_STATIC_LOCAL(EmptyChromeClient, client, (EmptyChromeClient::create()),
132 CheckScriptWrappable::No);
128 return client; 133 return client;
129 } 134 }
130 135
131 ChromeClient& Frame::chromeClient() const { 136 ChromeClient& Frame::chromeClient() const {
132 if (Page* page = this->page()) 137 if (Page* page = this->page())
133 return page->chromeClient(); 138 return page->chromeClient();
134 return emptyChromeClient(); 139 return emptyChromeClient();
135 } 140 }
136 141
137 Frame* Frame::findFrameForNavigation(const AtomicString& name, 142 Frame* Frame::findFrameForNavigation(const AtomicString& name,
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 420
416 ASSERT(page()); 421 ASSERT(page());
417 422
418 if (m_owner) 423 if (m_owner)
419 m_owner->setContentFrame(*this); 424 m_owner->setContentFrame(*this);
420 else 425 else
421 page()->setMainFrame(this); 426 page()->setMainFrame(this);
422 } 427 }
423 428
424 } // namespace blink 429 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698