From 6abc838bd4fed2d0e0eef80febbda07aa0190644 Mon Sep 17 00:00:00 2001 From: vmpstr Date: Tue, 26 Jan 2016 16:19:07 -0800 Subject: cc: Fix nullptr dereference when capturing skps. We capture sk picture from PictureLayer, which happens before we had a chance to set the image decode controller during commit. The fix here is not to use PlaybackToCanvas, but rather use other functions to accomplish the same goal. PlaybackToCanvas should only be called after commit. R=enne BUG=581107 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1633203003 Cr-Commit-Position: refs/heads/master@{#371655} --- cc/playback/display_list_raster_source.cc | 7 +++++-- cc/playback/display_list_raster_source.h | 6 +++++- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'cc/playback') diff --git a/cc/playback/display_list_raster_source.cc b/cc/playback/display_list_raster_source.cc index 3f740af..38bc5e8 100644 --- a/cc/playback/display_list_raster_source.cc +++ b/cc/playback/display_list_raster_source.cc @@ -387,8 +387,11 @@ skia::RefPtr DisplayListRasterSource::GetFlattenedPicture() { SkPictureRecorder recorder; SkCanvas* canvas = recorder.beginRecording(display_list_rect.width(), display_list_rect.height()); - if (!display_list_rect.IsEmpty()) - PlaybackToCanvas(canvas, display_list_rect, display_list_rect, 1.0); + if (!display_list_rect.IsEmpty()) { + PrepareForPlaybackToCanvas(canvas, display_list_rect, display_list_rect, + 1.f); + RasterCommon(canvas, nullptr, display_list_rect, display_list_rect, 1.f); + } skia::RefPtr picture = skia::AdoptRef(recorder.endRecordingAsPicture()); diff --git a/cc/playback/display_list_raster_source.h b/cc/playback/display_list_raster_source.h index 73c7a7f..9ebfd4f 100644 --- a/cc/playback/display_list_raster_source.h +++ b/cc/playback/display_list_raster_source.h @@ -36,7 +36,11 @@ class CC_EXPORT DisplayListRasterSource // rasterizing to the stats if the respective pointer is not nullptr. // It is assumed that the canvas passed here will only be rasterized by // this raster source via this call. - // virtual for testing. + // + // Virtual for testing. + // + // Note that this should only be called after the image decode controller has + // been set, which happens during commit. virtual void PlaybackToCanvas(SkCanvas* canvas, const gfx::Rect& canvas_bitmap_rect, const gfx::Rect& canvas_playback_rect, -- cgit v1.1