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

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

Issue 2449673002: Refactor InspectorWebPerfAgent: update lifecycle management to be per Local Frame root; replace hea… (Closed)
Patch Set: Created 4 years, 1 month 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "core/frame/EventHandlerRegistry.h" 46 #include "core/frame/EventHandlerRegistry.h"
47 #include "core/frame/FrameConsole.h" 47 #include "core/frame/FrameConsole.h"
48 #include "core/frame/FrameHost.h" 48 #include "core/frame/FrameHost.h"
49 #include "core/frame/FrameView.h" 49 #include "core/frame/FrameView.h"
50 #include "core/frame/LocalDOMWindow.h" 50 #include "core/frame/LocalDOMWindow.h"
51 #include "core/frame/Settings.h" 51 #include "core/frame/Settings.h"
52 #include "core/frame/VisualViewport.h" 52 #include "core/frame/VisualViewport.h"
53 #include "core/html/HTMLFrameElementBase.h" 53 #include "core/html/HTMLFrameElementBase.h"
54 #include "core/html/HTMLPlugInElement.h" 54 #include "core/html/HTMLPlugInElement.h"
55 #include "core/input/EventHandler.h" 55 #include "core/input/EventHandler.h"
56 #include "core/inspector/InspectedFrames.h"
56 #include "core/inspector/InspectorInstrumentation.h" 57 #include "core/inspector/InspectorInstrumentation.h"
58 #include "core/inspector/InspectorWebPerfAgent.h"
57 #include "core/layout/HitTestResult.h" 59 #include "core/layout/HitTestResult.h"
58 #include "core/layout/LayoutView.h" 60 #include "core/layout/LayoutView.h"
59 #include "core/layout/api/LayoutPartItem.h" 61 #include "core/layout/api/LayoutPartItem.h"
60 #include "core/layout/api/LayoutViewItem.h" 62 #include "core/layout/api/LayoutViewItem.h"
61 #include "core/layout/compositing/PaintLayerCompositor.h" 63 #include "core/layout/compositing/PaintLayerCompositor.h"
62 #include "core/loader/FrameLoadRequest.h" 64 #include "core/loader/FrameLoadRequest.h"
63 #include "core/loader/FrameLoaderClient.h" 65 #include "core/loader/FrameLoaderClient.h"
64 #include "core/loader/NavigationScheduler.h" 66 #include "core/loader/NavigationScheduler.h"
65 #include "core/page/ChromeClient.h" 67 #include "core/page/ChromeClient.h"
66 #include "core/page/FocusController.h" 68 #include "core/page/FocusController.h"
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 } 324 }
323 325
324 LocalFrame::~LocalFrame() { 326 LocalFrame::~LocalFrame() {
325 // Verify that the FrameView has been cleared as part of detaching 327 // Verify that the FrameView has been cleared as part of detaching
326 // the frame owner. 328 // the frame owner.
327 ASSERT(!m_view); 329 ASSERT(!m_view);
328 } 330 }
329 331
330 DEFINE_TRACE(LocalFrame) { 332 DEFINE_TRACE(LocalFrame) {
331 visitor->trace(m_instrumentingAgents); 333 visitor->trace(m_instrumentingAgents);
334 visitor->trace(m_inspectorWebPerfAgent);
332 visitor->trace(m_loader); 335 visitor->trace(m_loader);
333 visitor->trace(m_navigationScheduler); 336 visitor->trace(m_navigationScheduler);
334 visitor->trace(m_view); 337 visitor->trace(m_view);
335 visitor->trace(m_domWindow); 338 visitor->trace(m_domWindow);
336 visitor->trace(m_pagePopupOwner); 339 visitor->trace(m_pagePopupOwner);
337 visitor->trace(m_script); 340 visitor->trace(m_script);
338 visitor->trace(m_editor); 341 visitor->trace(m_editor);
339 visitor->trace(m_spellChecker); 342 visitor->trace(m_spellChecker);
340 visitor->trace(m_selection); 343 visitor->trace(m_selection);
341 visitor->trace(m_eventHandler); 344 visitor->trace(m_eventHandler);
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 } 547 }
545 548
546 bool LocalFrame::isCrossOriginSubframe() const { 549 bool LocalFrame::isCrossOriginSubframe() const {
547 const SecurityOrigin* securityOrigin = securityContext()->getSecurityOrigin(); 550 const SecurityOrigin* securityOrigin = securityContext()->getSecurityOrigin();
548 Frame* top = tree().top(); 551 Frame* top = tree().top();
549 return top && 552 return top &&
550 !securityOrigin->canAccess( 553 !securityOrigin->canAccess(
551 top->securityContext()->getSecurityOrigin()); 554 top->securityContext()->getSecurityOrigin());
552 } 555 }
553 556
557 void LocalFrame::enableInspectorWebPerfAgent() {
558 m_inspectorWebPerfAgentObservers++;
559 if (!inspectorWebPerfAgent()->isEnabled())
caseq 2016/10/26 21:19:41 can we perhaps get rid of enable/disable methods a
panicker 2016/10/27 23:06:53 It could be created and destroyed multiple times d
560 inspectorWebPerfAgent()->enable();
561 }
562
563 void LocalFrame::disableInspectorWebPerfAgent() {
564 m_inspectorWebPerfAgentObservers--;
565 if (m_inspectorWebPerfAgentObservers == 0)
566 inspectorWebPerfAgent()->disable();
567 }
568
554 void LocalFrame::setPrinting(bool printing, 569 void LocalFrame::setPrinting(bool printing,
555 const FloatSize& pageSize, 570 const FloatSize& pageSize,
556 const FloatSize& originalPageSize, 571 const FloatSize& originalPageSize,
557 float maximumShrinkRatio) { 572 float maximumShrinkRatio) {
558 // In setting printing, we should not validate resources already cached for 573 // In setting printing, we should not validate resources already cached for
559 // the document. See https://bugs.webkit.org/show_bug.cgi?id=43704 574 // the document. See https://bugs.webkit.org/show_bug.cgi?id=43704
560 ResourceCacheValidationSuppressor validationSuppressor(document()->fetcher()); 575 ResourceCacheValidationSuppressor validationSuppressor(document()->fetcher());
561 576
562 document()->setPrinting(printing ? Document::Printing 577 document()->setPrinting(printing ? Document::Printing
563 : Document::FinishingPrinting); 578 : Document::FinishingPrinting);
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 m_editor(Editor::create(*this)), 872 m_editor(Editor::create(*this)),
858 m_spellChecker(SpellChecker::create(*this)), 873 m_spellChecker(SpellChecker::create(*this)),
859 m_selection(FrameSelection::create(this)), 874 m_selection(FrameSelection::create(this)),
860 m_eventHandler(new EventHandler(this)), 875 m_eventHandler(new EventHandler(this)),
861 m_console(FrameConsole::create(*this)), 876 m_console(FrameConsole::create(*this)),
862 m_inputMethodController(InputMethodController::create(*this)), 877 m_inputMethodController(InputMethodController::create(*this)),
863 m_navigationDisableCount(0), 878 m_navigationDisableCount(0),
864 m_pageZoomFactor(parentPageZoomFactor(this)), 879 m_pageZoomFactor(parentPageZoomFactor(this)),
865 m_textZoomFactor(parentTextZoomFactor(this)), 880 m_textZoomFactor(parentTextZoomFactor(this)),
866 m_inViewSourceMode(false), 881 m_inViewSourceMode(false),
882 m_inspectorWebPerfAgentObservers(false),
caseq 2016/10/26 21:19:41 that's a fancy way to initialize an int :-)
panicker 2016/10/28 00:09:24 :) not needed anymore
867 m_interfaceProvider(interfaceProvider), 883 m_interfaceProvider(interfaceProvider),
868 m_interfaceRegistry(interfaceRegistry) { 884 m_interfaceRegistry(interfaceRegistry) {
869 if (isLocalRoot()) 885 if (isLocalRoot()) {
870 m_instrumentingAgents = new InstrumentingAgents(); 886 m_instrumentingAgents = new InstrumentingAgents();
871 else 887 m_inspectorWebPerfAgent =
888 new InspectorWebPerfAgent(InspectedFrames::create(this));
889 } else {
872 m_instrumentingAgents = localFrameRoot()->m_instrumentingAgents; 890 m_instrumentingAgents = localFrameRoot()->m_instrumentingAgents;
891 }
873 } 892 }
874 893
875 WebFrameScheduler* LocalFrame::frameScheduler() { 894 WebFrameScheduler* LocalFrame::frameScheduler() {
876 return m_frameScheduler.get(); 895 return m_frameScheduler.get();
877 } 896 }
878 897
879 void LocalFrame::scheduleVisualUpdateUnlessThrottled() { 898 void LocalFrame::scheduleVisualUpdateUnlessThrottled() {
880 if (shouldThrottleRendering()) 899 if (shouldThrottleRendering())
881 return; 900 return;
882 page()->animator().scheduleVisualUpdate(this); 901 page()->animator().scheduleVisualUpdate(this);
(...skipping 25 matching lines...) Expand all
908 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext()) 927 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext())
909 m_frame->client()->frameBlameContext()->Enter(); 928 m_frame->client()->frameBlameContext()->Enter();
910 } 929 }
911 930
912 ScopedFrameBlamer::~ScopedFrameBlamer() { 931 ScopedFrameBlamer::~ScopedFrameBlamer() {
913 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext()) 932 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext())
914 m_frame->client()->frameBlameContext()->Leave(); 933 m_frame->client()->frameBlameContext()->Leave();
915 } 934 }
916 935
917 } // namespace blink 936 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698