Commit 6abc838b authored by vmpstr's avatar vmpstr Committed by Commit bot

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}
parent b36e0d5d
......@@ -387,8 +387,11 @@ skia::RefPtr<SkPicture> 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<SkPicture> picture =
skia::AdoptRef(recorder.endRecordingAsPicture());
......
......@@ -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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment