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

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: Update unittests 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"
67 #include "core/page/Page.h" 69 #include "core/page/Page.h"
68 #include "core/page/scrolling/ScrollingCoordinator.h" 70 #include "core/page/scrolling/ScrollingCoordinator.h"
69 #include "core/paint/ObjectPainter.h" 71 #include "core/paint/ObjectPainter.h"
70 #include "core/paint/PaintInfo.h" 72 #include "core/paint/PaintInfo.h"
71 #include "core/paint/PaintLayer.h" 73 #include "core/paint/PaintLayer.h"
72 #include "core/paint/TransformRecorder.h" 74 #include "core/paint/TransformRecorder.h"
73 #include "core/svg/SVGDocumentExtensions.h" 75 #include "core/svg/SVGDocumentExtensions.h"
76 #include "core/timing/Performance.h"
74 #include "platform/DragImage.h" 77 #include "platform/DragImage.h"
75 #include "platform/PluginScriptForbiddenScope.h" 78 #include "platform/PluginScriptForbiddenScope.h"
76 #include "platform/RuntimeEnabledFeatures.h" 79 #include "platform/RuntimeEnabledFeatures.h"
77 #include "platform/ScriptForbiddenScope.h" 80 #include "platform/ScriptForbiddenScope.h"
78 #include "platform/graphics/GraphicsContext.h" 81 #include "platform/graphics/GraphicsContext.h"
79 #include "platform/graphics/StaticBitmapImage.h" 82 #include "platform/graphics/StaticBitmapImage.h"
80 #include "platform/graphics/paint/ClipRecorder.h" 83 #include "platform/graphics/paint/ClipRecorder.h"
81 #include "platform/graphics/paint/PaintController.h" 84 #include "platform/graphics/paint/PaintController.h"
82 #include "platform/graphics/paint/SkPictureBuilder.h" 85 #include "platform/graphics/paint/SkPictureBuilder.h"
83 #include "platform/graphics/paint/TransformDisplayItem.h" 86 #include "platform/graphics/paint/TransformDisplayItem.h"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 } 325 }
323 326
324 LocalFrame::~LocalFrame() { 327 LocalFrame::~LocalFrame() {
325 // Verify that the FrameView has been cleared as part of detaching 328 // Verify that the FrameView has been cleared as part of detaching
326 // the frame owner. 329 // the frame owner.
327 ASSERT(!m_view); 330 ASSERT(!m_view);
328 } 331 }
329 332
330 DEFINE_TRACE(LocalFrame) { 333 DEFINE_TRACE(LocalFrame) {
331 visitor->trace(m_instrumentingAgents); 334 visitor->trace(m_instrumentingAgents);
335 visitor->trace(m_inspectorWebPerfAgent);
336 visitor->trace(m_webPerformanceObservers);
332 visitor->trace(m_loader); 337 visitor->trace(m_loader);
333 visitor->trace(m_navigationScheduler); 338 visitor->trace(m_navigationScheduler);
334 visitor->trace(m_view); 339 visitor->trace(m_view);
335 visitor->trace(m_domWindow); 340 visitor->trace(m_domWindow);
336 visitor->trace(m_pagePopupOwner); 341 visitor->trace(m_pagePopupOwner);
337 visitor->trace(m_script); 342 visitor->trace(m_script);
338 visitor->trace(m_editor); 343 visitor->trace(m_editor);
339 visitor->trace(m_spellChecker); 344 visitor->trace(m_spellChecker);
340 visitor->trace(m_selection); 345 visitor->trace(m_selection);
341 visitor->trace(m_eventHandler); 346 visitor->trace(m_eventHandler);
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 } 549 }
545 550
546 bool LocalFrame::isCrossOriginSubframe() const { 551 bool LocalFrame::isCrossOriginSubframe() const {
547 const SecurityOrigin* securityOrigin = securityContext()->getSecurityOrigin(); 552 const SecurityOrigin* securityOrigin = securityContext()->getSecurityOrigin();
548 Frame* top = tree().top(); 553 Frame* top = tree().top();
549 return top && 554 return top &&
550 !securityOrigin->canAccess( 555 !securityOrigin->canAccess(
551 top->securityContext()->getSecurityOrigin()); 556 top->securityContext()->getSecurityOrigin());
552 } 557 }
553 558
559 void LocalFrame::enableInspectorWebPerfAgent(Performance* performance) {
560 m_webPerformanceObservers.add(performance);
561 if (!m_inspectorWebPerfAgent) {
562 m_inspectorWebPerfAgent =
563 new InspectorWebPerfAgent(InspectedFrames::create(this));
564 m_inspectorWebPerfAgent->enable();
565 }
566 }
567
568 void LocalFrame::disableInspectorWebPerfAgent(Performance* performance) {
569 auto perfEntry = m_webPerformanceObservers.find(performance);
570 DCHECK(perfEntry != m_webPerformanceObservers.end());
571 m_webPerformanceObservers.remove(perfEntry);
572 if (m_webPerformanceObservers.size() == 0) {
573 m_inspectorWebPerfAgent->disable();
574 m_inspectorWebPerfAgent = nullptr;
575 }
576 }
577
554 void LocalFrame::setPrinting(bool printing, 578 void LocalFrame::setPrinting(bool printing,
555 const FloatSize& pageSize, 579 const FloatSize& pageSize,
556 const FloatSize& originalPageSize, 580 const FloatSize& originalPageSize,
557 float maximumShrinkRatio) { 581 float maximumShrinkRatio) {
558 // In setting printing, we should not validate resources already cached for 582 // In setting printing, we should not validate resources already cached for
559 // the document. See https://bugs.webkit.org/show_bug.cgi?id=43704 583 // the document. See https://bugs.webkit.org/show_bug.cgi?id=43704
560 ResourceCacheValidationSuppressor validationSuppressor(document()->fetcher()); 584 ResourceCacheValidationSuppressor validationSuppressor(document()->fetcher());
561 585
562 document()->setPrinting(printing ? Document::Printing 586 document()->setPrinting(printing ? Document::Printing
563 : Document::FinishingPrinting); 587 : Document::FinishingPrinting);
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext()) 932 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext())
909 m_frame->client()->frameBlameContext()->Enter(); 933 m_frame->client()->frameBlameContext()->Enter();
910 } 934 }
911 935
912 ScopedFrameBlamer::~ScopedFrameBlamer() { 936 ScopedFrameBlamer::~ScopedFrameBlamer() {
913 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext()) 937 if (m_frame && m_frame->client() && m_frame->client()->frameBlameContext())
914 m_frame->client()->frameBlameContext()->Leave(); 938 m_frame->client()->frameBlameContext()->Leave();
915 } 939 }
916 940
917 } // namespace blink 941 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698