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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurface.cpp

Issue 2115493004: Make sure RecordingImageBufferSurface's current frame is valid (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
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 "platform/graphics/RecordingImageBufferSurface.h" 5 #include "platform/graphics/RecordingImageBufferSurface.h"
6 6
7 #include "platform/Histogram.h" 7 #include "platform/Histogram.h"
8 #include "platform/graphics/CanvasMetrics.h" 8 #include "platform/graphics/CanvasMetrics.h"
9 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" 9 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h"
10 #include "platform/graphics/GraphicsContext.h" 10 #include "platform/graphics/GraphicsContext.h"
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 ASSERT(m_currentFrame->getRecordingCanvas()); 263 ASSERT(m_currentFrame->getRecordingCanvas());
264 ASSERT(fallbackReason); 264 ASSERT(fallbackReason);
265 ASSERT(*fallbackReason == FallbackReasonUnknown); 265 ASSERT(*fallbackReason == FallbackReasonUnknown);
266 266
267 if (!m_imageBuffer->isDirty()) { 267 if (!m_imageBuffer->isDirty()) {
268 if (!m_previousFrame) { 268 if (!m_previousFrame) {
269 // Create an initial blank frame 269 // Create an initial blank frame
270 m_previousFrame = fromSkSp(m_currentFrame->finishRecordingAsPicture( )); 270 m_previousFrame = fromSkSp(m_currentFrame->finishRecordingAsPicture( ));
271 initializeCurrentFrame(); 271 initializeCurrentFrame();
272 } 272 }
273 if (!m_currentFrame.get())
274 *fallbackReason = FallbackReasonCurrentFrameNull;
Justin Novosad 2016/07/04 14:01:05 I don't think this is right. If m_currentFrame is
xidachen 2016/07/04 14:06:36 I don't have a repro case. But from the histogram
Justin Novosad 2016/07/04 14:16:57 Let's do an experiment on the canary channel then:
xidachen 2016/07/04 14:36:37 Okay. Let's do the experiment then. I remove the c
273 return m_currentFrame.get(); 275 return m_currentFrame.get();
274 } 276 }
275 277
276 if (!m_frameWasCleared) { 278 if (!m_frameWasCleared) {
277 *fallbackReason = FallbackReasonCanvasNotClearedBetweenFrames; 279 *fallbackReason = FallbackReasonCanvasNotClearedBetweenFrames;
278 return false; 280 return false;
279 } 281 }
280 282
281 if (m_fallbackFactory && m_currentFrame->getRecordingCanvas()->getSaveCount( ) > ExpensiveCanvasHeuristicParameters::ExpensiveRecordingStackDepth) { 283 if (m_fallbackFactory && m_currentFrame->getRecordingCanvas()->getSaveCount( ) > ExpensiveCanvasHeuristicParameters::ExpensiveRecordingStackDepth) {
282 *fallbackReason = FallbackReasonRunawayStateStack; 284 *fallbackReason = FallbackReasonRunawayStateStack;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 361
360 void RecordingImageBufferSurface::setIsHidden(bool hidden) 362 void RecordingImageBufferSurface::setIsHidden(bool hidden)
361 { 363 {
362 if (m_fallbackSurface) 364 if (m_fallbackSurface)
363 m_fallbackSurface->setIsHidden(hidden); 365 m_fallbackSurface->setIsHidden(hidden);
364 else 366 else
365 ImageBufferSurface::setIsHidden(hidden); 367 ImageBufferSurface::setIsHidden(hidden);
366 } 368 }
367 369
368 } // namespace blink 370 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurface.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698