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

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

Issue 2238883005: POC for InspectorInstrumentation adding InspectorWebPerfAgent Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add task observer to WebPerfAgent Created 4 years, 4 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 r ights reserved. 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> 9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com>
10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
(...skipping 29 matching lines...) Expand all
40 #include "core/editing/InputMethodController.h" 40 #include "core/editing/InputMethodController.h"
41 #include "core/editing/serializers/Serialization.h" 41 #include "core/editing/serializers/Serialization.h"
42 #include "core/editing/spellcheck/SpellChecker.h" 42 #include "core/editing/spellcheck/SpellChecker.h"
43 #include "core/events/Event.h" 43 #include "core/events/Event.h"
44 #include "core/fetch/ResourceFetcher.h" 44 #include "core/fetch/ResourceFetcher.h"
45 #include "core/frame/EventHandlerRegistry.h" 45 #include "core/frame/EventHandlerRegistry.h"
46 #include "core/frame/FrameConsole.h" 46 #include "core/frame/FrameConsole.h"
47 #include "core/frame/FrameHost.h" 47 #include "core/frame/FrameHost.h"
48 #include "core/frame/FrameView.h" 48 #include "core/frame/FrameView.h"
49 #include "core/frame/LocalDOMWindow.h" 49 #include "core/frame/LocalDOMWindow.h"
50 #include "core/frame/Location.h"
50 #include "core/frame/Settings.h" 51 #include "core/frame/Settings.h"
51 #include "core/html/HTMLFrameElementBase.h" 52 #include "core/html/HTMLFrameElementBase.h"
52 #include "core/html/HTMLPlugInElement.h" 53 #include "core/html/HTMLPlugInElement.h"
53 #include "core/input/EventHandler.h" 54 #include "core/input/EventHandler.h"
55 #include "core/inspector/InspectedFrames.h"
54 #include "core/inspector/InspectorInstrumentation.h" 56 #include "core/inspector/InspectorInstrumentation.h"
57 #include "core/inspector/InspectorWebPerfAgent.h"
55 #include "core/layout/HitTestResult.h" 58 #include "core/layout/HitTestResult.h"
56 #include "core/layout/LayoutView.h" 59 #include "core/layout/LayoutView.h"
57 #include "core/layout/api/LayoutViewItem.h" 60 #include "core/layout/api/LayoutViewItem.h"
58 #include "core/layout/compositing/PaintLayerCompositor.h" 61 #include "core/layout/compositing/PaintLayerCompositor.h"
59 #include "core/loader/FrameLoadRequest.h" 62 #include "core/loader/FrameLoadRequest.h"
60 #include "core/loader/FrameLoaderClient.h" 63 #include "core/loader/FrameLoaderClient.h"
61 #include "core/loader/NavigationScheduler.h" 64 #include "core/loader/NavigationScheduler.h"
62 #include "core/page/ChromeClient.h" 65 #include "core/page/ChromeClient.h"
63 #include "core/page/FocusController.h" 66 #include "core/page/FocusController.h"
64 #include "core/page/Page.h" 67 #include "core/page/Page.h"
65 #include "core/page/scrolling/ScrollingCoordinator.h" 68 #include "core/page/scrolling/ScrollingCoordinator.h"
66 #include "core/paint/ObjectPainter.h" 69 #include "core/paint/ObjectPainter.h"
67 #include "core/paint/PaintInfo.h" 70 #include "core/paint/PaintInfo.h"
68 #include "core/paint/PaintLayer.h" 71 #include "core/paint/PaintLayer.h"
69 #include "core/paint/TransformRecorder.h" 72 #include "core/paint/TransformRecorder.h"
70 #include "core/svg/SVGDocumentExtensions.h" 73 #include "core/svg/SVGDocumentExtensions.h"
74 #include "core/timing/DOMWindowPerformance.h"
71 #include "platform/DragImage.h" 75 #include "platform/DragImage.h"
72 #include "platform/JSONValues.h" 76 #include "platform/JSONValues.h"
73 #include "platform/PluginScriptForbiddenScope.h" 77 #include "platform/PluginScriptForbiddenScope.h"
74 #include "platform/RuntimeEnabledFeatures.h" 78 #include "platform/RuntimeEnabledFeatures.h"
75 #include "platform/ScriptForbiddenScope.h" 79 #include "platform/ScriptForbiddenScope.h"
76 #include "platform/graphics/GraphicsContext.h" 80 #include "platform/graphics/GraphicsContext.h"
77 #include "platform/graphics/StaticBitmapImage.h" 81 #include "platform/graphics/StaticBitmapImage.h"
78 #include "platform/graphics/paint/ClipRecorder.h" 82 #include "platform/graphics/paint/ClipRecorder.h"
79 #include "platform/graphics/paint/PaintController.h" 83 #include "platform/graphics/paint/PaintController.h"
80 #include "platform/graphics/paint/SkPictureBuilder.h" 84 #include "platform/graphics/paint/SkPictureBuilder.h"
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 LocalFrame::~LocalFrame() 314 LocalFrame::~LocalFrame()
311 { 315 {
312 // Verify that the FrameView has been cleared as part of detaching 316 // Verify that the FrameView has been cleared as part of detaching
313 // the frame owner. 317 // the frame owner.
314 ASSERT(!m_view); 318 ASSERT(!m_view);
315 } 319 }
316 320
317 DEFINE_TRACE(LocalFrame) 321 DEFINE_TRACE(LocalFrame)
318 { 322 {
319 visitor->trace(m_instrumentingAgents); 323 visitor->trace(m_instrumentingAgents);
324 visitor->trace(m_inspectorWebPerformanceAgent);
320 visitor->trace(m_loader); 325 visitor->trace(m_loader);
321 visitor->trace(m_navigationScheduler); 326 visitor->trace(m_navigationScheduler);
322 visitor->trace(m_view); 327 visitor->trace(m_view);
323 visitor->trace(m_domWindow); 328 visitor->trace(m_domWindow);
324 visitor->trace(m_pagePopupOwner); 329 visitor->trace(m_pagePopupOwner);
325 visitor->trace(m_script); 330 visitor->trace(m_script);
326 visitor->trace(m_editor); 331 visitor->trace(m_editor);
327 visitor->trace(m_spellChecker); 332 visitor->trace(m_spellChecker);
328 visitor->trace(m_selection); 333 visitor->trace(m_selection);
329 visitor->trace(m_eventHandler); 334 visitor->trace(m_eventHandler);
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 , m_selection(FrameSelection::create(this)) 818 , m_selection(FrameSelection::create(this))
814 , m_eventHandler(new EventHandler(this)) 819 , m_eventHandler(new EventHandler(this))
815 , m_console(FrameConsole::create(*this)) 820 , m_console(FrameConsole::create(*this))
816 , m_inputMethodController(InputMethodController::create(*this)) 821 , m_inputMethodController(InputMethodController::create(*this))
817 , m_navigationDisableCount(0) 822 , m_navigationDisableCount(0)
818 , m_pageZoomFactor(parentPageZoomFactor(this)) 823 , m_pageZoomFactor(parentPageZoomFactor(this))
819 , m_textZoomFactor(parentTextZoomFactor(this)) 824 , m_textZoomFactor(parentTextZoomFactor(this))
820 , m_inViewSourceMode(false) 825 , m_inViewSourceMode(false)
821 , m_interfaceProvider(interfaceProvider) 826 , m_interfaceProvider(interfaceProvider)
822 { 827 {
823 if (isLocalRoot()) 828 if (isLocalRoot()) {
pfeldman 2016/08/17 21:12:10 revert these
824 m_instrumentingAgents = new InstrumentingAgents(); 829 m_instrumentingAgents = new InstrumentingAgents();
825 else 830 } else {
826 m_instrumentingAgents = localFrameRoot()->m_instrumentingAgents; 831 m_instrumentingAgents = localFrameRoot()->m_instrumentingAgents;
832 }
827 } 833 }
828 834
829 WebFrameScheduler* LocalFrame::frameScheduler() 835 WebFrameScheduler* LocalFrame::frameScheduler()
830 { 836 {
831 return m_frameScheduler.get(); 837 return m_frameScheduler.get();
832 } 838 }
833 839
834 void LocalFrame::scheduleVisualUpdateUnlessThrottled() 840 void LocalFrame::scheduleVisualUpdateUnlessThrottled()
835 { 841 {
836 if (shouldThrottleRendering()) 842 if (shouldThrottleRendering())
837 return; 843 return;
838 page()->animator().scheduleVisualUpdate(this); 844 page()->animator().scheduleVisualUpdate(this);
839 } 845 }
840 846
841 FrameLoaderClient* LocalFrame::client() const 847 FrameLoaderClient* LocalFrame::client() const
842 { 848 {
843 return static_cast<FrameLoaderClient*>(Frame::client()); 849 return static_cast<FrameLoaderClient*>(Frame::client());
844 } 850 }
845 851
846 PluginData* LocalFrame::pluginData() const 852 PluginData* LocalFrame::pluginData() const
847 { 853 {
848 if (!loader().allowPlugins(NotAboutToInstantiatePlugin)) 854 if (!loader().allowPlugins(NotAboutToInstantiatePlugin))
849 return nullptr; 855 return nullptr;
850 return page()->pluginData(); 856 return page()->pluginData();
851 } 857 }
852 858
859 void LocalFrame::enableWebPerfInspectorInstrumentation()
Sami 2016/08/17 10:40:28 Could we have a way to disable this too?
860 {
861 // Register InspectorAgent to begin observing LongTaskTiming
862 if (this->isLocalRoot()) {
863 if (!m_inspectorWebPerformanceAgent) {
pfeldman 2016/08/17 21:12:10 This can become a utility static function within I
864 Location* location = document()->location();
865 fprintf(stderr, "\n^^^LocalFrame::enableWebPerfInspectorInstrumentat ion() %s: %s!",
866 location->hostname().ascii().data(),
867 location->pathname().ascii().data());
868 m_inspectorWebPerformanceAgent = new InspectorWebPerfAgent(
869 InspectedFrames::create(localFrameRoot()));
870 m_instrumentingAgents->addInspectorWebPerfAgent(
871 m_inspectorWebPerformanceAgent);
872 }
873 }
874 }
875
853 DEFINE_WEAK_IDENTIFIER_MAP(LocalFrame); 876 DEFINE_WEAK_IDENTIFIER_MAP(LocalFrame);
854 877
855 FrameNavigationDisabler::FrameNavigationDisabler(LocalFrame& frame) 878 FrameNavigationDisabler::FrameNavigationDisabler(LocalFrame& frame)
856 : m_frame(&frame) 879 : m_frame(&frame)
857 { 880 {
858 m_frame->disableNavigation(); 881 m_frame->disableNavigation();
859 } 882 }
860 883
861 FrameNavigationDisabler::~FrameNavigationDisabler() 884 FrameNavigationDisabler::~FrameNavigationDisabler()
862 { 885 {
863 m_frame->enableNavigation(); 886 m_frame->enableNavigation();
864 } 887 }
865 888
866 ScopedFrameBlamer::ScopedFrameBlamer(LocalFrame* frame) 889 ScopedFrameBlamer::ScopedFrameBlamer(LocalFrame* frame)
867 : m_frame(frame) 890 : m_frame(frame)
868 { 891 {
869 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext()) 892 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext())
870 m_frame->client()->frameBlameContext()->Enter(); 893 m_frame->client()->frameBlameContext()->Enter();
871 } 894 }
872 895
873 ScopedFrameBlamer::~ScopedFrameBlamer() 896 ScopedFrameBlamer::~ScopedFrameBlamer()
874 { 897 {
875 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext()) 898 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext())
876 m_frame->client()->frameBlameContext()->Leave(); 899 m_frame->client()->frameBlameContext()->Leave();
877 } 900 }
878 901
879 } // namespace blink 902 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698