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

Side by Side Diff: cc/playback/display_list_raster_source.cc

Issue 1633203003: cc: Fix nullptr dereference when capturing skps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | « cc/playback/display_list_raster_source.h ('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 "cc/playback/display_list_raster_source.h" 5 #include "cc/playback/display_list_raster_source.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/containers/adapters.h" 9 #include "base/containers/adapters.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 } 380 }
381 } 381 }
382 382
383 skia::RefPtr<SkPicture> DisplayListRasterSource::GetFlattenedPicture() { 383 skia::RefPtr<SkPicture> DisplayListRasterSource::GetFlattenedPicture() {
384 TRACE_EVENT0("cc", "DisplayListRasterSource::GetFlattenedPicture"); 384 TRACE_EVENT0("cc", "DisplayListRasterSource::GetFlattenedPicture");
385 385
386 gfx::Rect display_list_rect(size_); 386 gfx::Rect display_list_rect(size_);
387 SkPictureRecorder recorder; 387 SkPictureRecorder recorder;
388 SkCanvas* canvas = recorder.beginRecording(display_list_rect.width(), 388 SkCanvas* canvas = recorder.beginRecording(display_list_rect.width(),
389 display_list_rect.height()); 389 display_list_rect.height());
390 if (!display_list_rect.IsEmpty()) 390 if (!display_list_rect.IsEmpty()) {
391 PlaybackToCanvas(canvas, display_list_rect, display_list_rect, 1.0); 391 PrepareForPlaybackToCanvas(canvas, display_list_rect, display_list_rect,
392 1.f);
393 RasterCommon(canvas, nullptr, display_list_rect, display_list_rect, 1.f);
394 }
392 skia::RefPtr<SkPicture> picture = 395 skia::RefPtr<SkPicture> picture =
393 skia::AdoptRef(recorder.endRecordingAsPicture()); 396 skia::AdoptRef(recorder.endRecordingAsPicture());
394 397
395 return picture; 398 return picture;
396 } 399 }
397 400
398 size_t DisplayListRasterSource::GetPictureMemoryUsage() const { 401 size_t DisplayListRasterSource::GetPictureMemoryUsage() const {
399 if (!display_list_) 402 if (!display_list_)
400 return 0; 403 return 0;
401 return display_list_->ApproximateMemoryUsage() + 404 return display_list_->ApproximateMemoryUsage() +
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 ImageDecodeController* image_decode_controller) { 496 ImageDecodeController* image_decode_controller) {
494 DCHECK(image_decode_controller); 497 DCHECK(image_decode_controller);
495 // Note that although this function should only be called once, tests tend to 498 // Note that although this function should only be called once, tests tend to
496 // call it several times using the same controller. 499 // call it several times using the same controller.
497 DCHECK(!image_decode_controller_ || 500 DCHECK(!image_decode_controller_ ||
498 image_decode_controller_ == image_decode_controller); 501 image_decode_controller_ == image_decode_controller);
499 image_decode_controller_ = image_decode_controller; 502 image_decode_controller_ = image_decode_controller;
500 } 503 }
501 504
502 } // namespace cc 505 } // namespace cc
OLDNEW
« no previous file with comments | « cc/playback/display_list_raster_source.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698