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

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

Issue 2783543004: Move registration of LocalFrame mojo interfaces to ModulesInitializer. (Closed)
Patch Set: Move modules initialization to the first operation in LocalFrame::Init as the loader can actually d… Created 3 years, 8 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 return toLocalFrame(parent)->pageZoomFactor(); 233 return toLocalFrame(parent)->pageZoomFactor();
234 } 234 }
235 235
236 inline float parentTextZoomFactor(LocalFrame* frame) { 236 inline float parentTextZoomFactor(LocalFrame* frame) {
237 Frame* parent = frame->tree().parent(); 237 Frame* parent = frame->tree().parent();
238 if (!parent || !parent->isLocalFrame()) 238 if (!parent || !parent->isLocalFrame())
239 return 1; 239 return 1;
240 return toLocalFrame(parent)->textZoomFactor(); 240 return toLocalFrame(parent)->textZoomFactor();
241 } 241 }
242 242
243 using FrameInitCallbackVector = WTF::Vector<LocalFrame::FrameInitCallback>;
244 FrameInitCallbackVector& getInitializationVector() {
245 DEFINE_THREAD_SAFE_STATIC_LOCAL(FrameInitCallbackVector, initializationVector,
246 new FrameInitCallbackVector());
247 return initializationVector;
248 }
249
243 } // namespace 250 } // namespace
244 251
245 template class CORE_TEMPLATE_EXPORT Supplement<LocalFrame>; 252 template class CORE_TEMPLATE_EXPORT Supplement<LocalFrame>;
246 253
247 LocalFrame* LocalFrame::create(LocalFrameClient* client, 254 LocalFrame* LocalFrame::create(LocalFrameClient* client,
248 Page& page, 255 Page& page,
249 FrameOwner* owner, 256 FrameOwner* owner,
250 InterfaceProvider* interfaceProvider, 257 InterfaceProvider* interfaceProvider,
251 InterfaceRegistry* interfaceRegistry) { 258 InterfaceRegistry* interfaceRegistry) {
252 LocalFrame* frame = new LocalFrame( 259 LocalFrame* frame = new LocalFrame(
253 client, page, owner, 260 client, page, owner,
254 interfaceProvider ? interfaceProvider 261 interfaceProvider ? interfaceProvider
255 : InterfaceProvider::getEmptyInterfaceProvider(), 262 : InterfaceProvider::getEmptyInterfaceProvider(),
256 interfaceRegistry ? interfaceRegistry 263 interfaceRegistry ? interfaceRegistry
257 : InterfaceRegistry::getEmptyInterfaceRegistry()); 264 : InterfaceRegistry::getEmptyInterfaceRegistry());
258 probe::frameAttachedToParent(frame); 265 probe::frameAttachedToParent(frame);
259 return frame; 266 return frame;
260 } 267 }
261 268
269 void LocalFrame::init() {
270 // Initialization code needs to run first as the call to m_loader.init() can
271 // actually lead to this object being freed!
272 DCHECK(!getInitializationVector().isEmpty());
273 for (auto& initilizationCallback : getInitializationVector()) {
274 initilizationCallback(this);
275 }
276
277 m_loader.init();
278 }
279
262 void LocalFrame::setView(FrameView* view) { 280 void LocalFrame::setView(FrameView* view) {
263 ASSERT(!m_view || m_view != view); 281 ASSERT(!m_view || m_view != view);
264 ASSERT(!document() || !document()->isActive()); 282 ASSERT(!document() || !document()->isActive());
265 283
266 eventHandler().clear(); 284 eventHandler().clear();
267 285
268 m_view = view; 286 m_view = view;
269 } 287 }
270 288
271 void LocalFrame::createView(const IntSize& viewportSize, 289 void LocalFrame::createView(const IntSize& viewportSize,
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 } 842 }
825 } 843 }
826 844
827 return layers ? layers->toPrettyJSONString() : String(); 845 return layers ? layers->toPrettyJSONString() : String();
828 } 846 }
829 847
830 bool LocalFrame::shouldThrottleRendering() const { 848 bool LocalFrame::shouldThrottleRendering() const {
831 return view() && view()->shouldThrottleRendering(); 849 return view() && view()->shouldThrottleRendering();
832 } 850 }
833 851
852 void LocalFrame::registerInitializationCallback(FrameInitCallback callback) {
853 getInitializationVector().push_back(callback);
854 }
855
834 inline LocalFrame::LocalFrame(LocalFrameClient* client, 856 inline LocalFrame::LocalFrame(LocalFrameClient* client,
835 Page& page, 857 Page& page,
836 FrameOwner* owner, 858 FrameOwner* owner,
837 InterfaceProvider* interfaceProvider, 859 InterfaceProvider* interfaceProvider,
838 InterfaceRegistry* interfaceRegistry) 860 InterfaceRegistry* interfaceRegistry)
839 : Frame(client, page, owner, LocalWindowProxyManager::create(*this)), 861 : Frame(client, page, owner, LocalWindowProxyManager::create(*this)),
840 m_frameScheduler(page.chromeClient().createFrameScheduler( 862 m_frameScheduler(page.chromeClient().createFrameScheduler(
841 client->frameBlameContext())), 863 client->frameBlameContext())),
842 m_loader(this), 864 m_loader(this),
843 m_navigationScheduler(NavigationScheduler::create(this)), 865 m_navigationScheduler(NavigationScheduler::create(this)),
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext()) 923 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext())
902 m_frame->client()->frameBlameContext()->Enter(); 924 m_frame->client()->frameBlameContext()->Enter();
903 } 925 }
904 926
905 ScopedFrameBlamer::~ScopedFrameBlamer() { 927 ScopedFrameBlamer::~ScopedFrameBlamer() {
906 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext()) 928 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext())
907 m_frame->client()->frameBlameContext()->Leave(); 929 m_frame->client()->frameBlameContext()->Leave();
908 } 930 }
909 931
910 } // namespace blink 932 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/LocalFrame.h ('k') | third_party/WebKit/Source/modules/ModulesInitializer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698