diff options
author | Bartosz Fabianowski <bartfab@chromium.org> | 2015-04-16 12:10:58 +0200 |
---|---|---|
committer | Bartosz Fabianowski <bartfab@chromium.org> | 2015-04-16 10:12:18 +0000 |
commit | 919dce4400651813d5ff6e8a85b944a5987adcb7 (patch) | |
tree | 0fa9f186e1cb84404489c0a626bbd641c2db2ad1 /cc/resources | |
parent | 57d761013f14bc09f47d45d6ef36114a97401b3b (diff) | |
download | chromium_src-919dce4400651813d5ff6e8a85b944a5987adcb7.zip chromium_src-919dce4400651813d5ff6e8a85b944a5987adcb7.tar.gz chromium_src-919dce4400651813d5ff6e8a85b944a5987adcb7.tar.bz2 |
Speculative revert by sheriff
I am reverting all CLs that could have caused this failure:
http://build.chromium.org/p/chromium.linux/builders/
Android%20Tests%20%28dbg%29/builds/27276
I will start re-landing vindicated CLs shortly.
Revert "Convert a11y_page.css to a11y_page_style.html. See http://goo.gl/vIGSCO for more information."
This reverts commit eb48d65705e44b80d1d7a3b4f21c567802c102bb.
Revert "Supply build properties to run-bisect-perf regression for android bisects."
This reverts commit 9d70bb94984b02c17678ccf482d1a7b7c760a43f.
Revert "[cros New-GAIA] Webview login and new GAIA endpoint enabled by default"
This reverts commit 29061783f8b59f1e78286a87a3bb7d18129f639a.
Revert "Prime the landing pad for the new video rendering pipeline."
This reverts commit 45a3c93f745eabf6c1b1cbdac87ed4350a919e76.
Revert "Implement separate error dialog for cws widget container"
This reverts commit 7ed1f876f6f4d79ac074b25f2066d514603aa18d.
Revert "Create device_bluetooth watchlist; add scheib."
This reverts commit 40514c99cd45d1c8e9caef3245d42533d9810179.
Revert "Convert checkbox.css to checkbox_style.html. See http://goo.gl/vIGSCO for more information."
This reverts commit a687f31a786645508622482e9033f497364a43cd.
Revert "Created new URLRequestContext for secure proxy check."
This reverts commit 652eabf1141c00594aa6e9ed81beb980aec89198.
Revert "Revert of Fix scroll regression when specifying an extension id. (patchset #4 id:60001 of https://codereview.chromium.org/1064573003/)"
This reverts commit 488846cd562f444831982d82ef0bc9ca0dd79028.
Revert "Sync: Add Android test for downloading a bookmark"
This reverts commit 9c052713563111ac3d6cc64d4b5cfdfa27c202f4.
Revert "ScreenOrientationController to start observing even without an internal display."
This reverts commit 31fed68a524d49f99cebf02dca6ad49019e9900c.
Revert "Fix MB configurations for Mac and Win GN bots."
This reverts commit 31a66f3e705d20a39033a7b7d7f09a60517e6b9d.
Revert "Add tool/perf/measurements path to check for CQ jobs."
This reverts commit 99e1ac1d217174dad7a862f6a0fc44950d503737.
Revert "Implement Notification.data for persistent notifications."
This reverts commit 539f51d6af62097059c34b1c19dfbc4352413ad7.
Revert "Fix playback rate calculations for WallClockTimeSource."
This reverts commit 3ec02d642465872d9ab7d7db600d0480a57b3cab.
Revert "Roll src/third_party/pdfium eddab44:b330016"
This reverts commit 81d51e253cfacd5648cca9f12b605e63971a9ab1.
Revert "cc: Make DisplayItemList::Append replay into an SkPicture"
This reverts commit ec7c07e57bc5f91e3ba0bdeba8b6f534978615b0.
Revert "Clean up URLFetcher unit tests, part 5."
This reverts commit 8eeb3bf4a02be612cacb3cdbb5c223d909939527.
BUG=None
TBR=akuegel
Review URL: https://codereview.chromium.org/1083683003
Cr-Commit-Position: refs/heads/master@{#325411}
Diffstat (limited to 'cc/resources')
-rw-r--r-- | cc/resources/display_item.cc | 4 | ||||
-rw-r--r-- | cc/resources/display_item.h | 1 | ||||
-rw-r--r-- | cc/resources/display_item_list.cc | 63 | ||||
-rw-r--r-- | cc/resources/display_item_list.h | 14 | ||||
-rw-r--r-- | cc/resources/display_item_list_unittest.cc | 40 | ||||
-rw-r--r-- | cc/resources/display_list_recording_source.cc | 13 | ||||
-rw-r--r-- | cc/resources/drawing_display_item.cc | 11 | ||||
-rw-r--r-- | cc/resources/drawing_display_item.h | 1 |
8 files changed, 60 insertions, 87 deletions
diff --git a/cc/resources/display_item.cc b/cc/resources/display_item.cc index 33069a53..52bdec1 100644 --- a/cc/resources/display_item.cc +++ b/cc/resources/display_item.cc @@ -9,4 +9,8 @@ namespace cc { DisplayItem::DisplayItem() { } +void DisplayItem::RasterForTracing(SkCanvas* canvas) const { + Raster(canvas, nullptr); +} + } // namespace cc diff --git a/cc/resources/display_item.h b/cc/resources/display_item.h index d065958..ba4e733 100644 --- a/cc/resources/display_item.h +++ b/cc/resources/display_item.h @@ -21,6 +21,7 @@ class CC_EXPORT DisplayItem { virtual void Raster(SkCanvas* canvas, SkDrawPictureCallback* callback) const = 0; + virtual void RasterForTracing(SkCanvas* canvas) const; virtual bool IsSuitableForGpuRasterization() const = 0; virtual int ApproximateOpCount() const = 0; diff --git a/cc/resources/display_item_list.cc b/cc/resources/display_item_list.cc index 0b2e12e..b541c5f 100644 --- a/cc/resources/display_item_list.cc +++ b/cc/resources/display_item_list.cc @@ -20,36 +20,12 @@ namespace cc { -DisplayItemList::DisplayItemList(gfx::Rect layer_rect, bool use_cached_picture) - : recorder_(new SkPictureRecorder()), - use_cached_picture_(use_cached_picture), - retain_individual_display_items_(!use_cached_picture), - layer_rect_(layer_rect), - is_suitable_for_gpu_rasterization_(true), - approximate_op_count_(0) { - if (use_cached_picture_) { - SkRTreeFactory factory; - recorder_.reset(new SkPictureRecorder()); - canvas_ = skia::SharePtr(recorder_->beginRecording( - layer_rect_.width(), layer_rect_.height(), &factory)); - canvas_->translate(-layer_rect_.x(), -layer_rect_.y()); - canvas_->clipRect(gfx::RectToSkRect(layer_rect_)); - - bool tracing_enabled; - TRACE_EVENT_CATEGORY_GROUP_ENABLED( - TRACE_DISABLED_BY_DEFAULT("cc.debug.picture") "," - TRACE_DISABLED_BY_DEFAULT("devtools.timeline.picture"), - &tracing_enabled); - if (tracing_enabled) - retain_individual_display_items_ = true; - } +DisplayItemList::DisplayItemList() + : is_suitable_for_gpu_rasterization_(true), approximate_op_count_(0) { } -scoped_refptr<DisplayItemList> DisplayItemList::Create( - gfx::Rect layer_rect, - bool use_cached_picture) { - return make_scoped_refptr( - new DisplayItemList(layer_rect, use_cached_picture)); +scoped_refptr<DisplayItemList> DisplayItemList::Create() { + return make_scoped_refptr(new DisplayItemList()); } DisplayItemList::~DisplayItemList() { @@ -58,7 +34,7 @@ DisplayItemList::~DisplayItemList() { void DisplayItemList::Raster(SkCanvas* canvas, SkDrawPictureCallback* callback, float contents_scale) const { - if (!use_cached_picture_) { + if (!picture_) { canvas->save(); canvas->scale(contents_scale, contents_scale); for (size_t i = 0; i < items_.size(); ++i) { @@ -86,25 +62,25 @@ void DisplayItemList::Raster(SkCanvas* canvas, } void DisplayItemList::CreateAndCacheSkPicture() { - // Convert to an SkPicture for faster rasterization. - DCHECK(use_cached_picture_); - picture_ = skia::AdoptRef(recorder_->endRecordingAsPicture()); + // Convert to an SkPicture for faster rasterization. Code is identical to + // that in Picture::Record. + SkRTreeFactory factory; + SkPictureRecorder recorder; + skia::RefPtr<SkCanvas> canvas; + canvas = skia::SharePtr(recorder.beginRecording( + layer_rect_.width(), layer_rect_.height(), &factory)); + canvas->translate(-layer_rect_.x(), -layer_rect_.y()); + canvas->clipRect(gfx::RectToSkRect(layer_rect_)); + for (size_t i = 0; i < items_.size(); ++i) + items_[i]->Raster(canvas.get(), NULL); + picture_ = skia::AdoptRef(recorder.endRecordingAsPicture()); DCHECK(picture_); - recorder_.reset(); - canvas_.clear(); } void DisplayItemList::AppendItem(scoped_ptr<DisplayItem> item) { is_suitable_for_gpu_rasterization_ &= item->IsSuitableForGpuRasterization(); approximate_op_count_ += item->ApproximateOpCount(); - - if (use_cached_picture_) { - DCHECK(canvas_); - item->Raster(canvas_.get(), NULL); - } - - if (retain_individual_display_items_) - items_.push_back(item.Pass()); + items_.push_back(item.Pass()); } bool DisplayItemList::IsSuitableForGpuRasterization() const { @@ -150,7 +126,8 @@ DisplayItemList::AsValue() const { recorder.beginRecording(layer_rect_.width(), layer_rect_.height()); canvas->translate(-layer_rect_.x(), -layer_rect_.y()); canvas->clipRect(gfx::RectToSkRect(layer_rect_)); - Raster(canvas, NULL, 1.f); + for (size_t i = 0; i < items_.size(); ++i) + items_[i]->RasterForTracing(canvas); skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecordingAsPicture()); diff --git a/cc/resources/display_item_list.h b/cc/resources/display_item_list.h index 0a5d468..f490552 100644 --- a/cc/resources/display_item_list.h +++ b/cc/resources/display_item_list.h @@ -18,15 +18,13 @@ class SkCanvas; class SkDrawPictureCallback; -class SkPictureRecorder; namespace cc { class CC_EXPORT DisplayItemList : public base::RefCountedThreadSafe<DisplayItemList> { public: - static scoped_refptr<DisplayItemList> Create(gfx::Rect layer_rect, - bool use_cached_picture); + static scoped_refptr<DisplayItemList> Create(); void Raster(SkCanvas* canvas, SkDrawPictureCallback* callback, @@ -34,6 +32,9 @@ class CC_EXPORT DisplayItemList void AppendItem(scoped_ptr<DisplayItem> item); + void set_layer_rect(gfx::Rect layer_rect) { layer_rect_ = layer_rect; } + gfx::Rect layer_rect() const { return layer_rect_; } + void CreateAndCacheSkPicture(); bool IsSuitableForGpuRasterization() const; @@ -47,16 +48,11 @@ class CC_EXPORT DisplayItemList void GatherPixelRefs(const gfx::Size& grid_cell_size); private: - DisplayItemList(gfx::Rect layer_rect, bool use_cached_picture); + DisplayItemList(); ~DisplayItemList(); ScopedPtrVector<DisplayItem> items_; skia::RefPtr<SkPicture> picture_; - scoped_ptr<SkPictureRecorder> recorder_; - skia::RefPtr<SkCanvas> canvas_; - bool use_cached_picture_; - bool retain_individual_display_items_; - gfx::Rect layer_rect_; bool is_suitable_for_gpu_rasterization_; int approximate_op_count_; diff --git a/cc/resources/display_item_list_unittest.cc b/cc/resources/display_item_list_unittest.cc index 290b25b..b53b84a 100644 --- a/cc/resources/display_item_list_unittest.cc +++ b/cc/resources/display_item_list_unittest.cc @@ -36,9 +36,7 @@ TEST(DisplayItemListTest, SingleDrawingItem) { SkPaint red_paint; red_paint.setColor(SK_ColorRED); unsigned char pixels[4 * 100 * 100] = {0}; - const bool use_cached_picture = true; - scoped_refptr<DisplayItemList> list = - DisplayItemList::Create(layer_rect, use_cached_picture); + scoped_refptr<DisplayItemList> list = DisplayItemList::Create(); gfx::PointF offset(8.f, 9.f); gfx::RectF recording_rect(offset, layer_rect.size()); @@ -49,7 +47,6 @@ TEST(DisplayItemListTest, SingleDrawingItem) { canvas->drawRectCoords(50.f, 50.f, 75.f, 75.f, blue_paint); picture = skia::AdoptRef(recorder.endRecordingAsPicture()); list->AppendItem(DrawingDisplayItem::Create(picture)); - list->CreateAndCacheSkPicture(); DrawDisplayList(pixels, layer_rect, list); SkBitmap expected_bitmap; @@ -79,9 +76,7 @@ TEST(DisplayItemListTest, ClipItem) { SkPaint red_paint; red_paint.setColor(SK_ColorRED); unsigned char pixels[4 * 100 * 100] = {0}; - const bool use_cached_picture = true; - scoped_refptr<DisplayItemList> list = - DisplayItemList::Create(layer_rect, use_cached_picture); + scoped_refptr<DisplayItemList> list = DisplayItemList::Create(); gfx::PointF first_offset(8.f, 9.f); gfx::RectF first_recording_rect(first_offset, layer_rect.size()); @@ -105,7 +100,6 @@ TEST(DisplayItemListTest, ClipItem) { list->AppendItem(DrawingDisplayItem::Create(picture)); list->AppendItem(EndClipDisplayItem::Create()); - list->CreateAndCacheSkPicture(); DrawDisplayList(pixels, layer_rect, list); @@ -137,9 +131,7 @@ TEST(DisplayItemListTest, TransformItem) { SkPaint red_paint; red_paint.setColor(SK_ColorRED); unsigned char pixels[4 * 100 * 100] = {0}; - const bool use_cached_picture = true; - scoped_refptr<DisplayItemList> list = - DisplayItemList::Create(layer_rect, use_cached_picture); + scoped_refptr<DisplayItemList> list = DisplayItemList::Create(); gfx::PointF first_offset(8.f, 9.f); gfx::RectF first_recording_rect(first_offset, layer_rect.size()); @@ -164,7 +156,6 @@ TEST(DisplayItemListTest, TransformItem) { list->AppendItem(DrawingDisplayItem::Create(picture)); list->AppendItem(EndTransformDisplayItem::Create()); - list->CreateAndCacheSkPicture(); DrawDisplayList(pixels, layer_rect, list); @@ -186,13 +177,11 @@ TEST(DisplayItemListTest, TransformItem) { EXPECT_EQ(0, memcmp(pixels, expected_pixels, 4 * 100 * 100)); } -TEST(DisplayItemListTest, FilterItem) { +TEST(DisplayItemList, FilterItem) { gfx::Rect layer_rect(100, 100); FilterOperations filters; unsigned char pixels[4 * 100 * 100] = {0}; - const bool use_cached_picture = true; - scoped_refptr<DisplayItemList> list = - DisplayItemList::Create(layer_rect, use_cached_picture); + scoped_refptr<DisplayItemList> list = DisplayItemList::Create(); SkBitmap source_bitmap; source_bitmap.allocN32Pixels(50, 50); @@ -217,7 +206,6 @@ TEST(DisplayItemListTest, FilterItem) { gfx::RectF filter_bounds(10.f, 10.f, 50.f, 50.f); list->AppendItem(FilterDisplayItem::Create(filters, filter_bounds)); list->AppendItem(EndFilterDisplayItem::Create()); - list->CreateAndCacheSkPicture(); DrawDisplayList(pixels, layer_rect, list); @@ -248,9 +236,8 @@ TEST(DisplayItemListTest, CompactingItems) { gfx::PointF offset(8.f, 9.f); gfx::RectF recording_rect(offset, layer_rect.size()); - bool use_cached_picture = false; - scoped_refptr<DisplayItemList> list_without_caching = - DisplayItemList::Create(layer_rect, use_cached_picture); + scoped_refptr<DisplayItemList> list = DisplayItemList::Create(); + list->set_layer_rect(ToEnclosingRect(recording_rect)); canvas = skia::SharePtr( recorder.beginRecording(gfx::RectFToSkRect(recording_rect))); @@ -258,16 +245,13 @@ TEST(DisplayItemListTest, CompactingItems) { canvas->drawRectCoords(0.f, 0.f, 60.f, 60.f, red_paint); canvas->drawRectCoords(50.f, 50.f, 75.f, 75.f, blue_paint); picture = skia::AdoptRef(recorder.endRecordingAsPicture()); - list_without_caching->AppendItem(DrawingDisplayItem::Create(picture)); - DrawDisplayList(pixels, layer_rect, list_without_caching); + list->AppendItem(DrawingDisplayItem::Create(picture)); + DrawDisplayList(pixels, layer_rect, list); + + list->CreateAndCacheSkPicture(); unsigned char expected_pixels[4 * 100 * 100] = {0}; - use_cached_picture = true; - scoped_refptr<DisplayItemList> list_with_caching = - DisplayItemList::Create(layer_rect, use_cached_picture); - list_with_caching->AppendItem(DrawingDisplayItem::Create(picture)); - list_with_caching->CreateAndCacheSkPicture(); - DrawDisplayList(expected_pixels, layer_rect, list_with_caching); + DrawDisplayList(expected_pixels, layer_rect, list); EXPECT_EQ(0, memcmp(pixels, expected_pixels, 4 * 100 * 100)); } diff --git a/cc/resources/display_list_recording_source.cc b/cc/resources/display_list_recording_source.cc index 701db9b..7ada580 100644 --- a/cc/resources/display_list_recording_source.cc +++ b/cc/resources/display_list_recording_source.cc @@ -119,18 +119,17 @@ bool DisplayListRecordingSource::UpdateAndExpandInvalidation( } } for (int i = 0; i < repeat_count; ++i) { - const bool use_cached_picture = true; - display_list_ = - DisplayItemList::Create(recorded_viewport_, use_cached_picture); - painter->PaintContentsToDisplayList(display_list_.get(), recorded_viewport_, - painting_control); + display_list_ = painter->PaintContentsToDisplayList(recorded_viewport_, + painting_control); } - display_list_->CreateAndCacheSkPicture(); - + display_list_->set_layer_rect(recorded_viewport_); is_suitable_for_gpu_rasterization_ = display_list_->IsSuitableForGpuRasterization(); + DetermineIfSolidColor(); display_list_->EmitTraceSnapshot(); + + display_list_->CreateAndCacheSkPicture(); if (gather_pixel_refs_) display_list_->GatherPixelRefs(grid_cell_size_); diff --git a/cc/resources/drawing_display_item.cc b/cc/resources/drawing_display_item.cc index 91ab3fb..648f9de 100644 --- a/cc/resources/drawing_display_item.cc +++ b/cc/resources/drawing_display_item.cc @@ -34,6 +34,17 @@ void DrawingDisplayItem::Raster(SkCanvas* canvas, canvas->restore(); } +void DrawingDisplayItem::RasterForTracing(SkCanvas* canvas) const { + canvas->save(); + // The picture debugger in about:tracing doesn't drill down into |drawPicture| + // operations. Calling |playback()| rather than |drawPicture()| causes the + // skia operations in |picture_| to appear individually in the picture + // produced for tracing rather than being hidden inside a drawPicture + // operation. + picture_->playback(canvas); + canvas->restore(); +} + bool DrawingDisplayItem::IsSuitableForGpuRasterization() const { return picture_->suitableForGpuRasterization(NULL); } diff --git a/cc/resources/drawing_display_item.h b/cc/resources/drawing_display_item.h index a3eef77..b45a039 100644 --- a/cc/resources/drawing_display_item.h +++ b/cc/resources/drawing_display_item.h @@ -27,6 +27,7 @@ class CC_EXPORT DrawingDisplayItem : public DisplayItem { } void Raster(SkCanvas* canvas, SkDrawPictureCallback* callback) const override; + void RasterForTracing(SkCanvas* canvas) const override; bool IsSuitableForGpuRasterization() const override; int ApproximateOpCount() const override; |