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

Side by Side Diff: third_party/WebKit/Source/core/paint/FramePainter.cpp

Issue 2140983003: Early out for inactive documents in FrameView lifecycle updating functions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: - Created 4 years, 5 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
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/paint/FramePainter.h" 5 #include "core/paint/FramePainter.h"
6 6
7 #include "core/editing/markers/DocumentMarkerController.h" 7 #include "core/editing/markers/DocumentMarkerController.h"
8 #include "core/fetch/MemoryCache.h" 8 #include "core/fetch/MemoryCache.h"
9 #include "core/frame/FrameView.h" 9 #include "core/frame/FrameView.h"
10 #include "core/inspector/InspectorInstrumentation.h" 10 #include "core/inspector/InspectorInstrumentation.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 ClipRecorder recorder(context, *frameView().layoutView(), DisplayItem::C lipFrameScrollbars, IntRect(IntPoint(), visibleAreaWithScrollbars.size())); 88 ClipRecorder recorder(context, *frameView().layoutView(), DisplayItem::C lipFrameScrollbars, IntRect(IntPoint(), visibleAreaWithScrollbars.size()));
89 89
90 paintScrollbars(context, scrollViewDirtyRect); 90 paintScrollbars(context, scrollViewDirtyRect);
91 } 91 }
92 } 92 }
93 93
94 void FramePainter::paintContents(GraphicsContext& context, const GlobalPaintFlag s globalPaintFlags, const IntRect& rect) 94 void FramePainter::paintContents(GraphicsContext& context, const GlobalPaintFlag s globalPaintFlags, const IntRect& rect)
95 { 95 {
96 Document* document = frameView().frame().document(); 96 Document* document = frameView().frame().document();
97 97
98 if (frameView().shouldThrottleRendering()) 98 if (frameView().shouldThrottleRendering() || !document->isActive())
99 return; 99 return;
100 100
101 #ifndef NDEBUG 101 #ifndef NDEBUG
102 bool fillWithRed; 102 bool fillWithRed;
103 if (document->printing()) 103 if (document->printing())
104 fillWithRed = false; // Printing, don't fill with red (can't remember wh y). 104 fillWithRed = false; // Printing, don't fill with red (can't remember wh y).
105 else if (frameView().frame().owner()) 105 else if (frameView().frame().owner())
106 fillWithRed = false; // Subframe, don't fill with red. 106 fillWithRed = false; // Subframe, don't fill with red.
107 else if (frameView().isTransparent()) 107 else if (frameView().isTransparent())
108 fillWithRed = false; // Transparent, don't fill with red. 108 fillWithRed = false; // Transparent, don't fill with red.
109 else if (globalPaintFlags & GlobalPaintSelectionOnly) 109 else if (globalPaintFlags & GlobalPaintSelectionOnly)
110 fillWithRed = false; // Selections are transparent, don't fill with red. 110 fillWithRed = false; // Selections are transparent, don't fill with red.
111 else 111 else
112 fillWithRed = true; 112 fillWithRed = true;
113 113
114 if (fillWithRed && !LayoutObjectDrawingRecorder::useCachedDrawingIfPossible( context, *frameView().layoutView(), DisplayItem::DebugRedFill)) { 114 if (fillWithRed && !LayoutObjectDrawingRecorder::useCachedDrawingIfPossible( context, *frameView().layoutView(), DisplayItem::DebugRedFill)) {
115 IntRect contentRect(IntPoint(), frameView().contentsSize()); 115 IntRect contentRect(IntPoint(), frameView().contentsSize());
116 LayoutObjectDrawingRecorder drawingRecorder(context, *frameView().layout View(), DisplayItem::DebugRedFill, contentRect); 116 LayoutObjectDrawingRecorder drawingRecorder(context, *frameView().layout View(), DisplayItem::DebugRedFill, contentRect);
117 } 117 }
118 #endif 118 #endif
119 119
120 LayoutView* layoutView = frameView().layoutView(); 120 LayoutView* layoutView = frameView().layoutView();
121 if (!layoutView) { 121 if (!layoutView) {
122 DLOG(ERROR) << "called FramePainter::paint with nil layoutObject"; 122 DLOG(ERROR) << "called FramePainter::paint with nil layoutObject";
123 return; 123 return;
124 } 124 }
125 125
126 frameView().checkDoesNotNeedLayout(); 126 frameView().checkDoesNotNeedLayout();
127 // TODO(wangxianzhu): The following check should be stricter, but currently this is blocked
128 // by the svg root issue (crbug.com/442939).
127 ASSERT(document->lifecycle().state() >= DocumentLifecycle::CompositingClean) ; 129 ASSERT(document->lifecycle().state() >= DocumentLifecycle::CompositingClean) ;
128 130
129 TRACE_EVENT1("devtools.timeline", "Paint", "data", InspectorPaintEvent::data (layoutView, LayoutRect(rect), 0)); 131 TRACE_EVENT1("devtools.timeline", "Paint", "data", InspectorPaintEvent::data (layoutView, LayoutRect(rect), 0));
130 132
131 bool isTopLevelPainter = !s_inPaintContents; 133 bool isTopLevelPainter = !s_inPaintContents;
132 s_inPaintContents = true; 134 s_inPaintContents = true;
133 135
134 FontCachePurgePreventer fontCachePurgePreventer; 136 FontCachePurgePreventer fontCachePurgePreventer;
135 137
136 // TODO(jchaffraix): GlobalPaintFlags should be const during a paint 138 // TODO(jchaffraix): GlobalPaintFlags should be const during a paint
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 bar.paint(context, CullRect(rect)); 213 bar.paint(context, CullRect(rect));
212 } 214 }
213 215
214 const FrameView& FramePainter::frameView() 216 const FrameView& FramePainter::frameView()
215 { 217 {
216 ASSERT(m_frameView); 218 ASSERT(m_frameView);
217 return *m_frameView; 219 return *m_frameView;
218 } 220 }
219 221
220 } // namespace blink 222 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698