diff options
author | scottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-04 23:48:21 +0000 |
---|---|---|
committer | scottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-04 23:48:21 +0000 |
commit | 600b6e8ac2f7f755bf0a618513a1c9d303715fe9 (patch) | |
tree | 36df33b1f4903d8236f7f74d1e822081f02b47b9 /cc | |
parent | be6dedf67bfdaf94c64e3a853e8491582905dd19 (diff) | |
download | chromium_src-600b6e8ac2f7f755bf0a618513a1c9d303715fe9.zip chromium_src-600b6e8ac2f7f755bf0a618513a1c9d303715fe9.tar.gz chromium_src-600b6e8ac2f7f755bf0a618513a1c9d303715fe9.tar.bz2 |
Revert 261914 "Revert 261906 "cc: Add picture recording modes fo..."
Shouldn't have been reverted, apologies for the noise.
> Revert 261906 "cc: Add picture recording modes for benchmarking"
>
> Suspected of causing gcm_unit_tests failures
>
> http://build.chromium.org/p/chromium.mac/buildstatus?builder=Mac10.7%20Tests%20%282%29&number=25118
>
> Will file a bug that gcm_unit_tests isn't in default tryjob set if this is actually the cause.
>
> > cc: Add picture recording modes for benchmarking
> >
> > This patch adds three different picture recording modes for benchmarking
> > purposes:
> >
> > 1. RECORD_NORMALLY. This is the default and produces a normal recording
> > as before.
> >
> > 2. RECORD_WITH_NULL_CANVAS. This mode uses SkNullCanvas to avoid (most
> > of) the Skia processing that happen during recording. Can be used to
> > estimate the recording workload inside Blink.
> >
> > 3. RECORD_WITH_PAINTING_DISABLED. Passes a NULL canvas to Blink, which
> > causes the GraphicsContext object to disable painting. This mode
> > gives an estimate of the recording workload of Blink excluding the
> > processing inside GraphicsContext.
> >
> > This patch also modifies the rasterize_and_record_micro benchmark to
> > report the recording time for each mode (record_time_ms,
> > record_time_null_canvas_ms and record_time_painting_disabled_ms
> > respectively).
> >
> > Anecdotally on a z600 and the key_silk_cases page set, SkNullCanvas cuts
> > recording time to 50% and disabling painting down to 19%.
> >
> > BUG=357572
> > TEST=PictureTest.RecordingModes
> > TEST=tools/perf/run_benchmark rasterize_and_record_micro.key_silk_cases --browser=release
> >
> > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=261543
> >
> > Review URL: https://codereview.chromium.org/216933002
>
> TBR=skyostil@chromium.org
>
> Review URL: https://codereview.chromium.org/226083007
TBR=skyostil@chromium.org
Review URL: https://codereview.chromium.org/226293003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@261915 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r-- | cc/debug/picture_record_benchmark.cc | 4 | ||||
-rw-r--r-- | cc/debug/rasterize_and_record_benchmark.cc | 47 | ||||
-rw-r--r-- | cc/debug/rasterize_and_record_benchmark.h | 3 | ||||
-rw-r--r-- | cc/layers/picture_image_layer.cc | 2 | ||||
-rw-r--r-- | cc/resources/bitmap_skpicture_content_layer_updater.cc | 2 | ||||
-rw-r--r-- | cc/resources/content_layer_updater.cc | 2 | ||||
-rw-r--r-- | cc/resources/picture.cc | 68 | ||||
-rw-r--r-- | cc/resources/picture.h | 13 | ||||
-rw-r--r-- | cc/resources/picture_pile.cc | 3 | ||||
-rw-r--r-- | cc/resources/picture_unittest.cc | 95 | ||||
-rw-r--r-- | cc/test/fake_content_layer_client.cc | 7 | ||||
-rw-r--r-- | cc/test/fake_content_layer_client.h | 3 | ||||
-rw-r--r-- | cc/test/fake_picture_pile_impl.cc | 4 | ||||
-rw-r--r-- | cc/test/solid_color_content_layer_client.cc | 2 |
14 files changed, 194 insertions, 61 deletions
diff --git a/cc/debug/picture_record_benchmark.cc b/cc/debug/picture_record_benchmark.cc index 220d8e7..3b372d2 100644 --- a/cc/debug/picture_record_benchmark.cc +++ b/cc/debug/picture_record_benchmark.cc @@ -110,8 +110,8 @@ void PictureRecordBenchmark::RunOnLayer(PictureLayer* layer) { base::TimeTicks start = base::TimeTicks::HighResNow(); - scoped_refptr<Picture> picture = - Picture::Create(rect, painter, tile_grid_info, false, 0); + scoped_refptr<Picture> picture = Picture::Create( + rect, painter, tile_grid_info, false, 0, Picture::RECORD_NORMALLY); base::TimeTicks end = base::TimeTicks::HighResNow(); base::TimeDelta duration = end - start; diff --git a/cc/debug/rasterize_and_record_benchmark.cc b/cc/debug/rasterize_and_record_benchmark.cc index ab8d1cb..e41c968 100644 --- a/cc/debug/rasterize_and_record_benchmark.cc +++ b/cc/debug/rasterize_and_record_benchmark.cc @@ -6,8 +6,10 @@ #include <algorithm> #include <limits> +#include <string> #include "base/basictypes.h" +#include "base/strings/stringprintf.h" #include "base/values.h" #include "cc/debug/rasterize_and_record_benchmark_impl.h" #include "cc/layers/layer.h" @@ -22,6 +24,9 @@ namespace { const int kDefaultRecordRepeatCount = 100; +const char* kModeSuffixes[Picture::RECORDING_MODE_COUNT] = { + "", "_sk_null_canvas", "_painting_disabled"}; + base::TimeTicks Now() { return base::TimeTicks::IsThreadNowSupported() ? base::TimeTicks::ThreadNow() @@ -61,8 +66,12 @@ void RasterizeAndRecordBenchmark::DidUpdateLayers(LayerTreeHost* host) { DCHECK(!results_.get()); results_ = make_scoped_ptr(new base::DictionaryValue); results_->SetInteger("pixels_recorded", record_results_.pixels_recorded); - results_->SetDouble("record_time_ms", - record_results_.total_best_time.InMillisecondsF()); + + for (int i = 0; i < Picture::RECORDING_MODE_COUNT; i++) { + std::string name = base::StringPrintf("record_time%s_ms", kModeSuffixes[i]); + results_->SetDouble(name, + record_results_.total_best_time[i].InMillisecondsF()); + } main_thread_benchmark_done_ = true; } @@ -107,21 +116,27 @@ void RasterizeAndRecordBenchmark::RunOnLayer(PictureLayer* layer) { if (visible_content_rect.IsEmpty()) return; - - base::TimeDelta min_time = base::TimeDelta::Max(); - for (int i = 0; i < record_repeat_count_; ++i) { - base::TimeTicks start = Now(); - scoped_refptr<Picture> picture = Picture::Create( - visible_content_rect, painter, tile_grid_info, false, 0); - base::TimeTicks end = Now(); - base::TimeDelta duration = end - start; - if (duration < min_time) - min_time = duration; + for (int mode_index = 0; mode_index < Picture::RECORDING_MODE_COUNT; + mode_index++) { + Picture::RecordingMode mode = + static_cast<Picture::RecordingMode>(mode_index); + base::TimeDelta min_time = base::TimeDelta::Max(); + for (int i = 0; i < record_repeat_count_; ++i) { + base::TimeTicks start = Now(); + scoped_refptr<Picture> picture = Picture::Create( + visible_content_rect, painter, tile_grid_info, false, 0, mode); + base::TimeTicks end = Now(); + base::TimeDelta duration = end - start; + if (duration < min_time) + min_time = duration; + } + + if (mode == Picture::RECORD_NORMALLY) { + record_results_.pixels_recorded += + visible_content_rect.width() * visible_content_rect.height(); + } + record_results_.total_best_time[mode_index] += min_time; } - - record_results_.pixels_recorded += - visible_content_rect.width() * visible_content_rect.height(); - record_results_.total_best_time += min_time; } RasterizeAndRecordBenchmark::RecordResults::RecordResults() diff --git a/cc/debug/rasterize_and_record_benchmark.h b/cc/debug/rasterize_and_record_benchmark.h index 2cea16a..e2942d4 100644 --- a/cc/debug/rasterize_and_record_benchmark.h +++ b/cc/debug/rasterize_and_record_benchmark.h @@ -12,6 +12,7 @@ #include "base/memory/weak_ptr.h" #include "base/time/time.h" #include "cc/debug/micro_benchmark_controller.h" +#include "cc/resources/picture.h" namespace base { class DictionaryValue; @@ -45,7 +46,7 @@ class RasterizeAndRecordBenchmark : public MicroBenchmark { ~RecordResults(); int pixels_recorded; - base::TimeDelta total_best_time; + base::TimeDelta total_best_time[Picture::RECORDING_MODE_COUNT]; }; RecordResults record_results_; diff --git a/cc/layers/picture_image_layer.cc b/cc/layers/picture_image_layer.cc index caf8c0b..c041936 100644 --- a/cc/layers/picture_image_layer.cc +++ b/cc/layers/picture_image_layer.cc @@ -43,7 +43,7 @@ void PictureImageLayer::SetBitmap(const SkBitmap& bitmap) { void PictureImageLayer::PaintContents(SkCanvas* canvas, const gfx::Rect& clip, gfx::RectF* opaque) { - if (!bitmap_.width() || !bitmap_.height()) + if (!canvas || !bitmap_.width() || !bitmap_.height()) return; SkScalar content_to_layer_scale_x = diff --git a/cc/resources/bitmap_skpicture_content_layer_updater.cc b/cc/resources/bitmap_skpicture_content_layer_updater.cc index f1c2219..21fdbbb 100644 --- a/cc/resources/bitmap_skpicture_content_layer_updater.cc +++ b/cc/resources/bitmap_skpicture_content_layer_updater.cc @@ -69,6 +69,8 @@ BitmapSkPictureContentLayerUpdater::CreateResource( void BitmapSkPictureContentLayerUpdater::PaintContentsRect( SkCanvas* canvas, const gfx::Rect& source_rect) { + if (!canvas) + return; // Translate the origin of content_rect to that of source_rect. canvas->translate(content_rect().x() - source_rect.x(), content_rect().y() - source_rect.y()); diff --git a/cc/resources/content_layer_updater.cc b/cc/resources/content_layer_updater.cc index 3c18d8a..6de0d73 100644 --- a/cc/resources/content_layer_updater.cc +++ b/cc/resources/content_layer_updater.cc @@ -40,6 +40,8 @@ void ContentLayerUpdater::PaintContents(SkCanvas* canvas, float contents_height_scale, gfx::Rect* resulting_opaque_rect) { TRACE_EVENT0("cc", "ContentLayerUpdater::PaintContents"); + if (!canvas) + return; canvas->save(); canvas->translate(SkFloatToScalar(-content_rect.x()), SkFloatToScalar(-content_rect.y())); diff --git a/cc/resources/picture.cc b/cc/resources/picture.cc index 3b90ac4..8080d22c 100644 --- a/cc/resources/picture.cc +++ b/cc/resources/picture.cc @@ -22,6 +22,7 @@ #include "third_party/skia/include/core/SkDrawFilter.h" #include "third_party/skia/include/core/SkPaint.h" #include "third_party/skia/include/core/SkStream.h" +#include "third_party/skia/include/utils/SkNullCanvas.h" #include "third_party/skia/include/utils/SkPictureUtils.h" #include "ui/gfx/codec/jpeg_codec.h" #include "ui/gfx/codec/png_codec.h" @@ -86,10 +87,11 @@ scoped_refptr<Picture> Picture::Create( ContentLayerClient* client, const SkTileGridPicture::TileGridInfo& tile_grid_info, bool gather_pixel_refs, - int num_raster_threads) { + int num_raster_threads, + RecordingMode recording_mode) { scoped_refptr<Picture> picture = make_scoped_refptr(new Picture(layer_rect)); - picture->Record(client, tile_grid_info); + picture->Record(client, tile_grid_info, recording_mode); if (gather_pixel_refs) picture->GatherPixelRefs(tile_grid_info); picture->CloneForDrawing(num_raster_threads); @@ -223,37 +225,59 @@ void Picture::CloneForDrawing(int num_threads) { } void Picture::Record(ContentLayerClient* painter, - const SkTileGridPicture::TileGridInfo& tile_grid_info) { - TRACE_EVENT1("cc", "Picture::Record", - "data", AsTraceableRecordData()); + const SkTileGridPicture::TileGridInfo& tile_grid_info, + RecordingMode recording_mode) { + TRACE_EVENT2("cc", + "Picture::Record", + "data", + AsTraceableRecordData(), + "recording_mode", + recording_mode); DCHECK(!picture_); DCHECK(!tile_grid_info.fTileInterval.isEmpty()); picture_ = skia::AdoptRef(new SkTileGridPicture( layer_rect_.width(), layer_rect_.height(), tile_grid_info)); - SkCanvas* canvas = picture_->beginRecording( - layer_rect_.width(), - layer_rect_.height(), - SkPicture::kUsePathBoundsForClip_RecordingFlag | - SkPicture::kOptimizeForClippedPlayback_RecordingFlag); + skia::RefPtr<SkCanvas> canvas; + switch (recording_mode) { + case RECORD_NORMALLY: + canvas = skia::SharePtr(picture_->beginRecording( + layer_rect_.width(), + layer_rect_.height(), + SkPicture::kUsePathBoundsForClip_RecordingFlag | + SkPicture::kOptimizeForClippedPlayback_RecordingFlag)); + break; + case RECORD_WITH_SK_NULL_CANVAS: + canvas = skia::AdoptRef(SkCreateNullCanvas()); + break; + case RECORD_WITH_PAINTING_DISABLED: + // Blink's GraphicsContext will disable painting when given a NULL + // canvas. + break; + default: + NOTREACHED(); + } - canvas->save(); - canvas->translate(SkFloatToScalar(-layer_rect_.x()), - SkFloatToScalar(-layer_rect_.y())); + if (canvas) { + canvas->save(); + canvas->translate(SkFloatToScalar(-layer_rect_.x()), + SkFloatToScalar(-layer_rect_.y())); - SkRect layer_skrect = SkRect::MakeXYWH(layer_rect_.x(), - layer_rect_.y(), - layer_rect_.width(), - layer_rect_.height()); - canvas->clipRect(layer_skrect); + SkRect layer_skrect = SkRect::MakeXYWH(layer_rect_.x(), + layer_rect_.y(), + layer_rect_.width(), + layer_rect_.height()); + canvas->clipRect(layer_skrect); + } gfx::RectF opaque_layer_rect; + painter->PaintContents(canvas.get(), layer_rect_, &opaque_layer_rect); - painter->PaintContents(canvas, layer_rect_, &opaque_layer_rect); - - canvas->restore(); - picture_->endRecording(); + if (canvas) + canvas->restore(); + if (picture_->getRecordingCanvas()) + picture_->endRecording(); opaque_rect_ = gfx::ToEnclosedRect(opaque_layer_rect); diff --git a/cc/resources/picture.h b/cc/resources/picture.h index 3ab17b5..aef6b95 100644 --- a/cc/resources/picture.h +++ b/cc/resources/picture.h @@ -44,12 +44,20 @@ class CC_EXPORT Picture typedef std::vector<SkPixelRef*> PixelRefs; typedef base::hash_map<PixelRefMapKey, PixelRefs> PixelRefMap; + enum RecordingMode { + RECORD_NORMALLY, + RECORD_WITH_SK_NULL_CANVAS, + RECORD_WITH_PAINTING_DISABLED, + RECORDING_MODE_COUNT, // Must be the last entry. + }; + static scoped_refptr<Picture> Create( const gfx::Rect& layer_rect, ContentLayerClient* client, const SkTileGridPicture::TileGridInfo& tile_grid_info, bool gather_pixels_refs, - int num_raster_threads); + int num_raster_threads, + RecordingMode recording_mode); static scoped_refptr<Picture> CreateFromValue(const base::Value* value); static scoped_refptr<Picture> CreateFromSkpValue(const base::Value* value); @@ -136,7 +144,8 @@ class CC_EXPORT Picture // Record a paint operation. To be able to safely use this SkPicture for // playback on a different thread this can only be called once. void Record(ContentLayerClient* client, - const SkTileGridPicture::TileGridInfo& tile_grid_info); + const SkTileGridPicture::TileGridInfo& tile_grid_info, + RecordingMode recording_mode); // Gather pixel refs from recording. void GatherPixelRefs(const SkTileGridPicture::TileGridInfo& tile_grid_info); diff --git a/cc/resources/picture_pile.cc b/cc/resources/picture_pile.cc index 1af8b4c..0e2e363 100644 --- a/cc/resources/picture_pile.cc +++ b/cc/resources/picture_pile.cc @@ -243,7 +243,8 @@ bool PicturePile::Update(ContentLayerClient* painter, painter, tile_grid_info_, gather_pixel_refs, - num_raster_threads); + num_raster_threads, + Picture::RECORD_NORMALLY); base::TimeDelta duration = stats_instrumentation->EndRecording(start_time); best_duration = std::min(duration, best_duration); diff --git a/cc/resources/picture_unittest.cc b/cc/resources/picture_unittest.cc index d9a1ff6..3edc94c 100644 --- a/cc/resources/picture_unittest.cc +++ b/cc/resources/picture_unittest.cc @@ -47,8 +47,13 @@ TEST(PictureTest, AsBase64String) { // Single full-size rect picture. content_layer_client.add_draw_rect(layer_rect, red_paint); - scoped_refptr<Picture> one_rect_picture = Picture::Create( - layer_rect, &content_layer_client, tile_grid_info, false, 0); + scoped_refptr<Picture> one_rect_picture = + Picture::Create(layer_rect, + &content_layer_client, + tile_grid_info, + false, + 0, + Picture::RECORD_NORMALLY); scoped_ptr<base::Value> serialized_one_rect( one_rect_picture->AsValue()); @@ -72,8 +77,13 @@ TEST(PictureTest, AsBase64String) { // Two rect picture. content_layer_client.add_draw_rect(gfx::Rect(25, 25, 50, 50), green_paint); - scoped_refptr<Picture> two_rect_picture = Picture::Create( - layer_rect, &content_layer_client, tile_grid_info, false, 0); + scoped_refptr<Picture> two_rect_picture = + Picture::Create(layer_rect, + &content_layer_client, + tile_grid_info, + false, + 0, + Picture::RECORD_NORMALLY); scoped_ptr<base::Value> serialized_two_rect( two_rect_picture->AsValue()); @@ -131,8 +141,12 @@ TEST(PictureTest, PixelRefIterator) { } } - scoped_refptr<Picture> picture = Picture::Create( - layer_rect, &content_layer_client, tile_grid_info, true, 0); + scoped_refptr<Picture> picture = Picture::Create(layer_rect, + &content_layer_client, + tile_grid_info, + true, + 0, + Picture::RECORD_NORMALLY); // Default iterator does not have any pixel refs { @@ -228,8 +242,12 @@ TEST(PictureTest, PixelRefIteratorNonZeroLayer) { } } - scoped_refptr<Picture> picture = Picture::Create( - layer_rect, &content_layer_client, tile_grid_info, true, 0); + scoped_refptr<Picture> picture = Picture::Create(layer_rect, + &content_layer_client, + tile_grid_info, + true, + 0, + Picture::RECORD_NORMALLY); // Default iterator does not have any pixel refs { @@ -348,8 +366,12 @@ TEST(PictureTest, PixelRefIteratorOnePixelQuery) { } } - scoped_refptr<Picture> picture = Picture::Create( - layer_rect, &content_layer_client, tile_grid_info, true, 0); + scoped_refptr<Picture> picture = Picture::Create(layer_rect, + &content_layer_client, + tile_grid_info, + true, + 0, + Picture::RECORD_NORMALLY); for (int y = 0; y < 4; ++y) { for (int x = 0; x < 4; ++x) { @@ -393,8 +415,13 @@ TEST(PictureTest, CreateFromSkpValue) { // Single full-size rect picture. content_layer_client.add_draw_rect(layer_rect, red_paint); - scoped_refptr<Picture> one_rect_picture = Picture::Create( - layer_rect, &content_layer_client, tile_grid_info, false, 0); + scoped_refptr<Picture> one_rect_picture = + Picture::Create(layer_rect, + &content_layer_client, + tile_grid_info, + false, + 0, + Picture::RECORD_NORMALLY); scoped_ptr<base::Value> serialized_one_rect( one_rect_picture->AsValue()); @@ -415,5 +442,49 @@ TEST(PictureTest, CreateFromSkpValue) { EXPECT_EQ(100, one_rect_picture_check->OpaqueRect().width()); EXPECT_EQ(200, one_rect_picture_check->OpaqueRect().height()); } + +TEST(PictureTest, RecordingModes) { + SkGraphics::Init(); + + gfx::Rect layer_rect(100, 200); + + SkTileGridPicture::TileGridInfo tile_grid_info; + tile_grid_info.fTileInterval = SkISize::Make(100, 200); + tile_grid_info.fMargin.setEmpty(); + tile_grid_info.fOffset.setZero(); + + FakeContentLayerClient content_layer_client; + EXPECT_EQ(NULL, content_layer_client.last_canvas()); + + scoped_refptr<Picture> picture = Picture::Create(layer_rect, + &content_layer_client, + tile_grid_info, + false, + 0, + Picture::RECORD_NORMALLY); + EXPECT_TRUE(content_layer_client.last_canvas() != NULL); + EXPECT_TRUE(picture); + + picture = Picture::Create(layer_rect, + &content_layer_client, + tile_grid_info, + false, + 0, + Picture::RECORD_WITH_SK_NULL_CANVAS); + EXPECT_TRUE(content_layer_client.last_canvas() != NULL); + EXPECT_TRUE(picture); + + picture = Picture::Create(layer_rect, + &content_layer_client, + tile_grid_info, + false, + 0, + Picture::RECORD_WITH_PAINTING_DISABLED); + EXPECT_EQ(NULL, content_layer_client.last_canvas()); + EXPECT_TRUE(picture); + + EXPECT_EQ(3, Picture::RECORDING_MODE_COUNT); +} + } // namespace } // namespace cc diff --git a/cc/test/fake_content_layer_client.cc b/cc/test/fake_content_layer_client.cc index 2d1c304..3996654 100644 --- a/cc/test/fake_content_layer_client.cc +++ b/cc/test/fake_content_layer_client.cc @@ -10,14 +10,17 @@ namespace cc { FakeContentLayerClient::FakeContentLayerClient() - : paint_all_opaque_(false) { -} + : paint_all_opaque_(false), last_canvas_(NULL) {} FakeContentLayerClient::~FakeContentLayerClient() { } void FakeContentLayerClient::PaintContents(SkCanvas* canvas, const gfx::Rect& paint_rect, gfx::RectF* opaque_rect) { + last_canvas_ = canvas; + if (!canvas) + return; + if (paint_all_opaque_) *opaque_rect = paint_rect; diff --git a/cc/test/fake_content_layer_client.h b/cc/test/fake_content_layer_client.h index 8410f3e..1a5221f 100644 --- a/cc/test/fake_content_layer_client.h +++ b/cc/test/fake_content_layer_client.h @@ -49,6 +49,8 @@ class FakeContentLayerClient : public ContentLayerClient { draw_bitmaps_.push_back(data); } + SkCanvas* last_canvas() const { return last_canvas_; } + private: typedef std::vector<std::pair<gfx::RectF, SkPaint> > RectPaintVector; typedef std::vector<BitmapData> BitmapVector; @@ -56,6 +58,7 @@ class FakeContentLayerClient : public ContentLayerClient { bool paint_all_opaque_; RectPaintVector draw_rects_; BitmapVector draw_bitmaps_; + SkCanvas* last_canvas_; }; } // namespace cc diff --git a/cc/test/fake_picture_pile_impl.cc b/cc/test/fake_picture_pile_impl.cc index 4bcf4b0..f2af98b 100644 --- a/cc/test/fake_picture_pile_impl.cc +++ b/cc/test/fake_picture_pile_impl.cc @@ -84,8 +84,8 @@ void FakePicturePileImpl::AddRecordingAt(int x, int y) { gfx::Rect bounds(tiling().TileBounds(x, y)); bounds.Inset(-buffer_pixels(), -buffer_pixels()); - scoped_refptr<Picture> picture( - Picture::Create(bounds, &client_, tile_grid_info_, true, 0)); + scoped_refptr<Picture> picture(Picture::Create( + bounds, &client_, tile_grid_info_, true, 0, Picture::RECORD_NORMALLY)); picture_map_[std::pair<int, int>(x, y)].SetPicture(picture); EXPECT_TRUE(HasRecordingAt(x, y)); diff --git a/cc/test/solid_color_content_layer_client.cc b/cc/test/solid_color_content_layer_client.cc index 5e9d37e..c61f855 100644 --- a/cc/test/solid_color_content_layer_client.cc +++ b/cc/test/solid_color_content_layer_client.cc @@ -13,6 +13,8 @@ namespace cc { void SolidColorContentLayerClient::PaintContents( SkCanvas* canvas, const gfx::Rect& rect, gfx::RectF* opaque_rect) { + if (!canvas) + return; SkPaint paint; paint.setStyle(SkPaint::kFill_Style); paint.setColor(color_); |