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

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: change to CHECK 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 | « no previous file | 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 "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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 251
252 void RecordingImageBufferSurface::didDraw(const FloatRect& rect) 252 void RecordingImageBufferSurface::didDraw(const FloatRect& rect)
253 { 253 {
254 m_didRecordDrawCommandsInCurrentFrame = true; 254 m_didRecordDrawCommandsInCurrentFrame = true;
255 IntRect pixelBounds = enclosingIntRect(rect); 255 IntRect pixelBounds = enclosingIntRect(rect);
256 m_currentFramePixelCount += pixelBounds.width() * pixelBounds.height(); 256 m_currentFramePixelCount += pixelBounds.width() * pixelBounds.height();
257 } 257 }
258 258
259 bool RecordingImageBufferSurface::finalizeFrameInternal(FallbackReason* fallback Reason) 259 bool RecordingImageBufferSurface::finalizeFrameInternal(FallbackReason* fallback Reason)
260 { 260 {
261 ASSERT(!m_fallbackSurface); 261 ASSERT(!m_fallbackSurface);
Justin Novosad 2016/07/04 14:38:55 I meant this one.
xidachen 2016/07/04 14:43:36 Done.
262 ASSERT(m_currentFrame); 262 CHECK(m_currentFrame);
263 ASSERT(m_currentFrame->getRecordingCanvas()); 263 CHECK(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 CHECK(m_currentFrame);
273 return m_currentFrame.get(); 274 return m_currentFrame.get();
Justin Novosad 2016/07/04 14:38:55 tautology: just return true here.
xidachen 2016/07/04 14:43:36 Done.
274 } 275 }
275 276
276 if (!m_frameWasCleared) { 277 if (!m_frameWasCleared) {
277 *fallbackReason = FallbackReasonCanvasNotClearedBetweenFrames; 278 *fallbackReason = FallbackReasonCanvasNotClearedBetweenFrames;
278 return false; 279 return false;
279 } 280 }
280 281
281 if (m_fallbackFactory && m_currentFrame->getRecordingCanvas()->getSaveCount( ) > ExpensiveCanvasHeuristicParameters::ExpensiveRecordingStackDepth) { 282 if (m_fallbackFactory && m_currentFrame->getRecordingCanvas()->getSaveCount( ) > ExpensiveCanvasHeuristicParameters::ExpensiveRecordingStackDepth) {
282 *fallbackReason = FallbackReasonRunawayStateStack; 283 *fallbackReason = FallbackReasonRunawayStateStack;
283 return false; 284 return false;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 360
360 void RecordingImageBufferSurface::setIsHidden(bool hidden) 361 void RecordingImageBufferSurface::setIsHidden(bool hidden)
361 { 362 {
362 if (m_fallbackSurface) 363 if (m_fallbackSurface)
363 m_fallbackSurface->setIsHidden(hidden); 364 m_fallbackSurface->setIsHidden(hidden);
364 else 365 else
365 ImageBufferSurface::setIsHidden(hidden); 366 ImageBufferSurface::setIsHidden(hidden);
366 } 367 }
367 368
368 } // namespace blink 369 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698