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

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: Address code review feedback. 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 return toLocalFrame(parent)->pageZoomFactor(); 248 return toLocalFrame(parent)->pageZoomFactor();
249 } 249 }
250 250
251 inline float parentTextZoomFactor(LocalFrame* frame) { 251 inline float parentTextZoomFactor(LocalFrame* frame) {
252 Frame* parent = frame->tree().parent(); 252 Frame* parent = frame->tree().parent();
253 if (!parent || !parent->isLocalFrame()) 253 if (!parent || !parent->isLocalFrame())
254 return 1; 254 return 1;
255 return toLocalFrame(parent)->textZoomFactor(); 255 return toLocalFrame(parent)->textZoomFactor();
256 } 256 }
257 257
258 std::vector<LocalFrame::FrameInitCallback>& getInitializationVector() {
259 DEFINE_THREAD_SAFE_STATIC_LOCAL(
260 std::vector<LocalFrame::FrameInitCallback>, initializationVector,
haraken 2017/03/29 08:10:24 Use WTF::Vector. Blink doesn't use std::vector. A
slangley 2017/03/29 23:09:38 Done
261 new std::vector<LocalFrame::FrameInitCallback>());
262 return initializationVector;
263 }
264
258 } // namespace 265 } // namespace
259 266
260 template class CORE_TEMPLATE_EXPORT Supplement<LocalFrame>; 267 template class CORE_TEMPLATE_EXPORT Supplement<LocalFrame>;
261 268
262 LocalFrame* LocalFrame::create(LocalFrameClient* client, 269 LocalFrame* LocalFrame::create(LocalFrameClient* client,
263 Page& page, 270 Page& page,
264 FrameOwner* owner, 271 FrameOwner* owner,
265 InterfaceProvider* interfaceProvider, 272 InterfaceProvider* interfaceProvider,
266 InterfaceRegistry* interfaceRegistry) { 273 InterfaceRegistry* interfaceRegistry) {
267 LocalFrame* frame = new LocalFrame( 274 LocalFrame* frame = new LocalFrame(
268 client, page, owner, 275 client, page, owner,
269 interfaceProvider ? interfaceProvider 276 interfaceProvider ? interfaceProvider
270 : InterfaceProvider::getEmptyInterfaceProvider(), 277 : InterfaceProvider::getEmptyInterfaceProvider(),
271 interfaceRegistry ? interfaceRegistry 278 interfaceRegistry ? interfaceRegistry
272 : InterfaceRegistry::getEmptyInterfaceRegistry()); 279 : InterfaceRegistry::getEmptyInterfaceRegistry());
273 probe::frameAttachedToParent(frame); 280 probe::frameAttachedToParent(frame);
274 return frame; 281 return frame;
275 } 282 }
276 283
284 void LocalFrame::init() {
285 m_loader.init();
286
287 for (auto& initilizationCallback : getInitializationVector()) {
288 initilizationCallback(this);
289 }
290 }
291
277 void LocalFrame::setView(FrameView* view) { 292 void LocalFrame::setView(FrameView* view) {
278 ASSERT(!m_view || m_view != view); 293 ASSERT(!m_view || m_view != view);
279 ASSERT(!document() || !document()->isActive()); 294 ASSERT(!document() || !document()->isActive());
280 295
281 eventHandler().clear(); 296 eventHandler().clear();
282 297
283 m_view = view; 298 m_view = view;
284 } 299 }
285 300
286 void LocalFrame::createView(const IntSize& viewportSize, 301 void LocalFrame::createView(const IntSize& viewportSize,
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 } 852 }
838 } 853 }
839 854
840 return layers ? layers->toPrettyJSONString() : String(); 855 return layers ? layers->toPrettyJSONString() : String();
841 } 856 }
842 857
843 bool LocalFrame::shouldThrottleRendering() const { 858 bool LocalFrame::shouldThrottleRendering() const {
844 return view() && view()->shouldThrottleRendering(); 859 return view() && view()->shouldThrottleRendering();
845 } 860 }
846 861
862 void LocalFrame::registerInitializationCallback(FrameInitCallback cb) {
863 getInitializationVector().push_back(cb);
haraken 2017/03/29 08:10:24 cb => callback Blink prefers a fully qualified na
slangley 2017/03/29 23:09:38 Done
864 }
865
847 inline LocalFrame::LocalFrame(LocalFrameClient* client, 866 inline LocalFrame::LocalFrame(LocalFrameClient* client,
848 Page& page, 867 Page& page,
849 FrameOwner* owner, 868 FrameOwner* owner,
850 InterfaceProvider* interfaceProvider, 869 InterfaceProvider* interfaceProvider,
851 InterfaceRegistry* interfaceRegistry) 870 InterfaceRegistry* interfaceRegistry)
852 : Frame(client, page, owner, LocalWindowProxyManager::create(*this)), 871 : Frame(client, page, owner, LocalWindowProxyManager::create(*this)),
853 m_frameScheduler(page.chromeClient().createFrameScheduler( 872 m_frameScheduler(page.chromeClient().createFrameScheduler(
854 client->frameBlameContext())), 873 client->frameBlameContext())),
855 m_loader(this), 874 m_loader(this),
856 m_navigationScheduler(NavigationScheduler::create(this)), 875 m_navigationScheduler(NavigationScheduler::create(this)),
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext()) 933 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext())
915 m_frame->client()->frameBlameContext()->Enter(); 934 m_frame->client()->frameBlameContext()->Enter();
916 } 935 }
917 936
918 ScopedFrameBlamer::~ScopedFrameBlamer() { 937 ScopedFrameBlamer::~ScopedFrameBlamer() {
919 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext()) 938 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext())
920 m_frame->client()->frameBlameContext()->Leave(); 939 m_frame->client()->frameBlameContext()->Leave();
921 } 940 }
922 941
923 } // namespace blink 942 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698