diff options
author | egraether@chromium.org <egraether@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-29 05:32:49 +0000 |
---|---|---|
committer | egraether@chromium.org <egraether@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-29 05:32:49 +0000 |
commit | d8411661bd40f4ff61ffe4508e2f75991f09465c (patch) | |
tree | 9b564f26bd2417675d3f77dd35723be0a496b70a | |
parent | f011d10ecb2bda677016685f16fa357a3f79e9b3 (diff) | |
download | chromium_src-d8411661bd40f4ff61ffe4508e2f75991f09465c.zip chromium_src-d8411661bd40f4ff61ffe4508e2f75991f09465c.tar.gz chromium_src-d8411661bd40f4ff61ffe4508e2f75991f09465c.tar.bz2 |
cc: Pass RenderingStatsInstrumentation to ContentLayerUpdater
This change adds an accessor for RenderingStatsInstrumentation to Layer and
passes RenderingStatsInstrumentation to ContentLayerUpdater and all it's
sub-classes on construction, currently unused.
BUG=181319
Review URL: https://chromiumcodereview.appspot.com/13266002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191307 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | cc/layers/content_layer.cc | 12 | ||||
-rw-r--r-- | cc/layers/content_layer_unittest.cc | 7 | ||||
-rw-r--r-- | cc/layers/layer.cc | 4 | ||||
-rw-r--r-- | cc/layers/layer.h | 3 | ||||
-rw-r--r-- | cc/layers/scrollbar_layer.cc | 9 | ||||
-rw-r--r-- | cc/layers/tiled_layer_unittest.cc | 5 | ||||
-rw-r--r-- | cc/resources/bitmap_content_layer_updater.cc | 14 | ||||
-rw-r--r-- | cc/resources/bitmap_content_layer_updater.h | 8 | ||||
-rw-r--r-- | cc/resources/bitmap_skpicture_content_layer_updater.cc | 14 | ||||
-rw-r--r-- | cc/resources/bitmap_skpicture_content_layer_updater.h | 7 | ||||
-rw-r--r-- | cc/resources/caching_bitmap_content_layer_updater.cc | 13 | ||||
-rw-r--r-- | cc/resources/caching_bitmap_content_layer_updater.h | 7 | ||||
-rw-r--r-- | cc/resources/content_layer_updater.cc | 9 | ||||
-rw-r--r-- | cc/resources/content_layer_updater.h | 6 | ||||
-rw-r--r-- | cc/resources/skpicture_content_layer_updater.cc | 13 | ||||
-rw-r--r-- | cc/resources/skpicture_content_layer_updater.h | 7 |
16 files changed, 99 insertions, 39 deletions
diff --git a/cc/layers/content_layer.cc b/cc/layers/content_layer.cc index c29d72e..a6aa5ba 100644 --- a/cc/layers/content_layer.cc +++ b/cc/layers/content_layer.cc @@ -96,11 +96,17 @@ void ContentLayer::CreateUpdaterIfNeeded() { scoped_ptr<LayerPainter> painter = ContentLayerPainter::Create(client_).PassAs<LayerPainter>(); if (layer_tree_host()->settings().accelerate_painting) - updater_ = SkPictureContentLayerUpdater::Create(painter.Pass()); + updater_ = SkPictureContentLayerUpdater::Create( + painter.Pass(), + rendering_stats_instrumentation()); else if (layer_tree_host()->settings().per_tile_painting_enabled) - updater_ = BitmapSkPictureContentLayerUpdater::Create(painter.Pass()); + updater_ = BitmapSkPictureContentLayerUpdater::Create( + painter.Pass(), + rendering_stats_instrumentation()); else - updater_ = BitmapContentLayerUpdater::Create(painter.Pass()); + updater_ = BitmapContentLayerUpdater::Create( + painter.Pass(), + rendering_stats_instrumentation()); updater_->SetOpaque(contents_opaque()); unsigned texture_format = diff --git a/cc/layers/content_layer_unittest.cc b/cc/layers/content_layer_unittest.cc index 25421e7..defb246 100644 --- a/cc/layers/content_layer_unittest.cc +++ b/cc/layers/content_layer_unittest.cc @@ -6,6 +6,7 @@ #include "cc/layers/content_layer_client.h" #include "cc/resources/bitmap_content_layer_updater.h" +#include "cc/test/fake_rendering_stats_instrumentation.h" #include "cc/test/geometry_test_utils.h" #include "skia/ext/platform_canvas.h" #include "testing/gtest/include/gtest/gtest.h" @@ -37,9 +38,11 @@ TEST(ContentLayerTest, ContentLayerPainterWithDeviceScale) { gfx::RectF opaque_rect_in_content_space = gfx::ScaleRect( opaque_rect_in_layer_space, contents_scale, contents_scale); MockContentLayerClient client(opaque_rect_in_layer_space); + FakeRenderingStatsInstrumentation stats_instrumentation; scoped_refptr<BitmapContentLayerUpdater> updater = - BitmapContentLayerUpdater::Create(ContentLayerPainter::Create(&client). - PassAs<LayerPainter>()); + BitmapContentLayerUpdater::Create( + ContentLayerPainter::Create(&client).PassAs<LayerPainter>(), + &stats_instrumentation); gfx::Rect resulting_opaque_rect; updater->PrepareToUpdate(content_rect, diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc index bdd2a4f..c5a2ad8 100644 --- a/cc/layers/layer.cc +++ b/cc/layers/layer.cc @@ -818,4 +818,8 @@ ScrollbarLayer* Layer::ToScrollbarLayer() { return NULL; } +RenderingStatsInstrumentation* Layer::rendering_stats_instrumentation() const { + return layer_tree_host_->rendering_stats_instrumentation(); +} + } // namespace cc diff --git a/cc/layers/layer.h b/cc/layers/layer.h index 2e72e63..9827f9b 100644 --- a/cc/layers/layer.h +++ b/cc/layers/layer.h @@ -40,6 +40,7 @@ class LayerImpl; class LayerTreeHost; class LayerTreeImpl; class PriorityCalculator; +class RenderingStatsInstrumentation; class ResourceUpdateQueue; class ScrollbarLayer; struct AnimationEvent; @@ -370,6 +371,8 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>, bool NeedsDisplayForTesting() const { return needs_display_; } void ResetNeedsDisplayForTesting() { needs_display_ = false; } + RenderingStatsInstrumentation* rendering_stats_instrumentation() const; + protected: friend class LayerImpl; friend class TreeSynchronizer; diff --git a/cc/layers/scrollbar_layer.cc b/cc/layers/scrollbar_layer.cc index c5f15b7..19a84dd 100644 --- a/cc/layers/scrollbar_layer.cc +++ b/cc/layers/scrollbar_layer.cc @@ -270,7 +270,8 @@ void ScrollbarLayer::CreateUpdaterIfNeeded() { scrollbar_.get(), painter_.get(), geometry_.get(), - WebKit::WebScrollbar::BackTrackPart).PassAs<LayerPainter>()); + WebKit::WebScrollbar::BackTrackPart).PassAs<LayerPainter>(), + rendering_stats_instrumentation()); } if (!back_track_) { back_track_ = back_track_updater_->CreateResource( @@ -286,7 +287,8 @@ void ScrollbarLayer::CreateUpdaterIfNeeded() { scrollbar_.get(), painter_.get(), geometry_.get(), - WebKit::WebScrollbar::ForwardTrackPart).PassAs<LayerPainter>()); + WebKit::WebScrollbar::ForwardTrackPart).PassAs<LayerPainter>(), + rendering_stats_instrumentation()); } if (!fore_track_) { fore_track_ = fore_track_updater_->CreateResource( @@ -298,7 +300,8 @@ void ScrollbarLayer::CreateUpdaterIfNeeded() { thumb_updater_ = CachingBitmapContentLayerUpdater::Create( ScrollbarThumbPainter::Create(scrollbar_.get(), painter_.get(), - geometry_.get()).PassAs<LayerPainter>()); + geometry_.get()).PassAs<LayerPainter>(), + rendering_stats_instrumentation()); } if (!thumb_) { thumb_ = thumb_updater_->CreateResource( diff --git a/cc/layers/tiled_layer_unittest.cc b/cc/layers/tiled_layer_unittest.cc index dd6c06e..dab98f56 100644 --- a/cc/layers/tiled_layer_unittest.cc +++ b/cc/layers/tiled_layer_unittest.cc @@ -17,6 +17,7 @@ #include "cc/test/fake_layer_tree_host_impl.h" #include "cc/test/fake_output_surface.h" #include "cc/test/fake_proxy.h" +#include "cc/test/fake_rendering_stats_instrumentation.h" #include "cc/test/geometry_test_utils.h" #include "cc/test/tiled_layer_test_common.h" #include "cc/trees/single_thread_proxy.h" @@ -1719,7 +1720,8 @@ class UpdateTrackingTiledLayer : public FakeTiledLayer { scoped_ptr<TrackingLayerPainter> painter(TrackingLayerPainter::Create()); tracking_layer_painter_ = painter.get(); layer_updater_ = - BitmapContentLayerUpdater::Create(painter.PassAs<LayerPainter>()); + BitmapContentLayerUpdater::Create(painter.PassAs<LayerPainter>(), + &stats_instrumentation_); } TrackingLayerPainter* tracking_layer_painter() const { @@ -1734,6 +1736,7 @@ class UpdateTrackingTiledLayer : public FakeTiledLayer { TrackingLayerPainter* tracking_layer_painter_; scoped_refptr<BitmapContentLayerUpdater> layer_updater_; + FakeRenderingStatsInstrumentation stats_instrumentation_; }; TEST_F(TiledLayerTest, NonIntegerContentsScaleIsNotDistortedDuringPaint) { diff --git a/cc/resources/bitmap_content_layer_updater.cc b/cc/resources/bitmap_content_layer_updater.cc index 5365c4c..35d3bb5 100644 --- a/cc/resources/bitmap_content_layer_updater.cc +++ b/cc/resources/bitmap_content_layer_updater.cc @@ -4,7 +4,7 @@ #include "cc/resources/bitmap_content_layer_updater.h" -#include "cc/debug/rendering_stats.h" +#include "cc/debug/rendering_stats_instrumentation.h" #include "cc/resources/layer_painter.h" #include "cc/resources/prioritized_resource.h" #include "cc/resources/resource_update.h" @@ -30,13 +30,17 @@ void BitmapContentLayerUpdater::Resource::Update(ResourceUpdateQueue* queue, } scoped_refptr<BitmapContentLayerUpdater> BitmapContentLayerUpdater::Create( - scoped_ptr<LayerPainter> painter) { - return make_scoped_refptr(new BitmapContentLayerUpdater(painter.Pass())); + scoped_ptr<LayerPainter> painter, + RenderingStatsInstrumentation* stats_instrumentation) { + return make_scoped_refptr( + new BitmapContentLayerUpdater(painter.Pass(), stats_instrumentation)); } BitmapContentLayerUpdater::BitmapContentLayerUpdater( - scoped_ptr<LayerPainter> painter) - : ContentLayerUpdater(painter.Pass()), opaque_(false) {} + scoped_ptr<LayerPainter> painter, + RenderingStatsInstrumentation* stats_instrumentation) + : ContentLayerUpdater(painter.Pass(), stats_instrumentation), + opaque_(false) {} BitmapContentLayerUpdater::~BitmapContentLayerUpdater() {} diff --git a/cc/resources/bitmap_content_layer_updater.h b/cc/resources/bitmap_content_layer_updater.h index 0597f82..5d45608 100644 --- a/cc/resources/bitmap_content_layer_updater.h +++ b/cc/resources/bitmap_content_layer_updater.h @@ -13,6 +13,7 @@ class SkCanvas; namespace cc { class LayerPainter; +class RenderingStatsInstrumenation; // This class rasterizes the content_rect into a skia bitmap canvas. It then // updates textures by copying from the canvas into the texture, using @@ -38,7 +39,8 @@ class CC_EXPORT BitmapContentLayerUpdater : public ContentLayerUpdater { }; static scoped_refptr<BitmapContentLayerUpdater> Create( - scoped_ptr<LayerPainter> painter); + scoped_ptr<LayerPainter> painter, + RenderingStatsInstrumentation* stats_instrumenation); virtual scoped_ptr<LayerUpdater::Resource> CreateResource( PrioritizedResourceManager* manager) OVERRIDE; @@ -57,7 +59,9 @@ class CC_EXPORT BitmapContentLayerUpdater : public ContentLayerUpdater { virtual void SetOpaque(bool opaque) OVERRIDE; protected: - explicit BitmapContentLayerUpdater(scoped_ptr<LayerPainter> painter); + BitmapContentLayerUpdater( + scoped_ptr<LayerPainter> painter, + RenderingStatsInstrumentation* stats_instrumenation); virtual ~BitmapContentLayerUpdater(); scoped_ptr<SkCanvas> canvas_; diff --git a/cc/resources/bitmap_skpicture_content_layer_updater.cc b/cc/resources/bitmap_skpicture_content_layer_updater.cc index e721891..1a2ebee 100644 --- a/cc/resources/bitmap_skpicture_content_layer_updater.cc +++ b/cc/resources/bitmap_skpicture_content_layer_updater.cc @@ -5,7 +5,7 @@ #include "cc/resources/bitmap_skpicture_content_layer_updater.h" #include "base/time.h" -#include "cc/debug/rendering_stats.h" +#include "cc/debug/rendering_stats_instrumentation.h" #include "cc/resources/layer_painter.h" #include "cc/resources/prioritized_resource.h" #include "cc/resources/resource_update_queue.h" @@ -47,14 +47,18 @@ void BitmapSkPictureContentLayerUpdater::Resource::Update( } scoped_refptr<BitmapSkPictureContentLayerUpdater> -BitmapSkPictureContentLayerUpdater::Create(scoped_ptr<LayerPainter> painter) { +BitmapSkPictureContentLayerUpdater::Create( + scoped_ptr<LayerPainter> painter, + RenderingStatsInstrumentation* stats_instrumentation) { return make_scoped_refptr( - new BitmapSkPictureContentLayerUpdater(painter.Pass())); + new BitmapSkPictureContentLayerUpdater(painter.Pass(), + stats_instrumentation)); } BitmapSkPictureContentLayerUpdater::BitmapSkPictureContentLayerUpdater( - scoped_ptr<LayerPainter> painter) - : SkPictureContentLayerUpdater(painter.Pass()) {} + scoped_ptr<LayerPainter> painter, + RenderingStatsInstrumentation* stats_instrumentation) + : SkPictureContentLayerUpdater(painter.Pass(), stats_instrumentation) {} BitmapSkPictureContentLayerUpdater::~BitmapSkPictureContentLayerUpdater() {} diff --git a/cc/resources/bitmap_skpicture_content_layer_updater.h b/cc/resources/bitmap_skpicture_content_layer_updater.h index 63ca4a1..144047b 100644 --- a/cc/resources/bitmap_skpicture_content_layer_updater.h +++ b/cc/resources/bitmap_skpicture_content_layer_updater.h @@ -34,7 +34,8 @@ class BitmapSkPictureContentLayerUpdater : public SkPictureContentLayerUpdater { }; static scoped_refptr<BitmapSkPictureContentLayerUpdater> Create( - scoped_ptr<LayerPainter> painter); + scoped_ptr<LayerPainter> painter, + RenderingStatsInstrumentation* stats_instrumentation); virtual scoped_ptr<LayerUpdater::Resource> CreateResource( PrioritizedResourceManager* manager) OVERRIDE; @@ -43,7 +44,9 @@ class BitmapSkPictureContentLayerUpdater : public SkPictureContentLayerUpdater { RenderingStats* stats); private: - explicit BitmapSkPictureContentLayerUpdater(scoped_ptr<LayerPainter> painter); + BitmapSkPictureContentLayerUpdater( + scoped_ptr<LayerPainter> painter, + RenderingStatsInstrumentation* stats_instrumentation); virtual ~BitmapSkPictureContentLayerUpdater(); DISALLOW_COPY_AND_ASSIGN(BitmapSkPictureContentLayerUpdater); diff --git a/cc/resources/caching_bitmap_content_layer_updater.cc b/cc/resources/caching_bitmap_content_layer_updater.cc index 78f6097..42e462b 100644 --- a/cc/resources/caching_bitmap_content_layer_updater.cc +++ b/cc/resources/caching_bitmap_content_layer_updater.cc @@ -11,14 +11,19 @@ namespace cc { scoped_refptr<CachingBitmapContentLayerUpdater> -CachingBitmapContentLayerUpdater::Create(scoped_ptr<LayerPainter> painter) { +CachingBitmapContentLayerUpdater::Create( + scoped_ptr<LayerPainter> painter, + RenderingStatsInstrumentation* stats_instrumentation) { return make_scoped_refptr( - new CachingBitmapContentLayerUpdater(painter.Pass())); + new CachingBitmapContentLayerUpdater(painter.Pass(), + stats_instrumentation)); } CachingBitmapContentLayerUpdater::CachingBitmapContentLayerUpdater( - scoped_ptr<LayerPainter> painter) - : BitmapContentLayerUpdater(painter.Pass()), pixels_did_change_(false) {} + scoped_ptr<LayerPainter> painter, + RenderingStatsInstrumentation* stats_instrumentation) + : BitmapContentLayerUpdater(painter.Pass(), stats_instrumentation), + pixels_did_change_(false) {} CachingBitmapContentLayerUpdater::~CachingBitmapContentLayerUpdater() {} diff --git a/cc/resources/caching_bitmap_content_layer_updater.h b/cc/resources/caching_bitmap_content_layer_updater.h index 420d6d5..657ea56 100644 --- a/cc/resources/caching_bitmap_content_layer_updater.h +++ b/cc/resources/caching_bitmap_content_layer_updater.h @@ -14,7 +14,8 @@ namespace cc { class CachingBitmapContentLayerUpdater : public BitmapContentLayerUpdater { public: static scoped_refptr<CachingBitmapContentLayerUpdater> Create( - scoped_ptr<LayerPainter>); + scoped_ptr<LayerPainter>, + RenderingStatsInstrumentation* stats_instrumentation); virtual void PrepareToUpdate(gfx::Rect content_rect, gfx::Size tile_size, @@ -28,7 +29,9 @@ class CachingBitmapContentLayerUpdater : public BitmapContentLayerUpdater { } private: - explicit CachingBitmapContentLayerUpdater(scoped_ptr<LayerPainter> painter); + CachingBitmapContentLayerUpdater( + scoped_ptr<LayerPainter> painter, + RenderingStatsInstrumentation* stats_instrumentation); virtual ~CachingBitmapContentLayerUpdater(); bool pixels_did_change_; diff --git a/cc/resources/content_layer_updater.cc b/cc/resources/content_layer_updater.cc index f11083b..0651e87 100644 --- a/cc/resources/content_layer_updater.cc +++ b/cc/resources/content_layer_updater.cc @@ -6,7 +6,7 @@ #include "base/debug/trace_event.h" #include "base/time.h" -#include "cc/debug/rendering_stats.h" +#include "cc/debug/rendering_stats_instrumentation.h" #include "cc/resources/layer_painter.h" #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkPaint.h" @@ -17,8 +17,11 @@ namespace cc { -ContentLayerUpdater::ContentLayerUpdater(scoped_ptr<LayerPainter> painter) - : painter_(painter.Pass()) {} +ContentLayerUpdater::ContentLayerUpdater( + scoped_ptr<LayerPainter> painter, + RenderingStatsInstrumentation* stats_instrumentation) + : painter_(painter.Pass()), + rendering_stats_instrumentation_(stats_instrumentation) {} ContentLayerUpdater::~ContentLayerUpdater() {} diff --git a/cc/resources/content_layer_updater.h b/cc/resources/content_layer_updater.h index 80b8a48..9176f2c 100644 --- a/cc/resources/content_layer_updater.h +++ b/cc/resources/content_layer_updater.h @@ -14,13 +14,15 @@ class SkCanvas; namespace cc { class LayerPainter; +class RenderingStatsInstrumentation; // Base class for BitmapContentLayerUpdater and // SkPictureContentLayerUpdater that reduces code duplication between // their respective PaintContents implementations. class CC_EXPORT ContentLayerUpdater : public LayerUpdater { protected: - explicit ContentLayerUpdater(scoped_ptr<LayerPainter> painter); + ContentLayerUpdater(scoped_ptr<LayerPainter> painter, + RenderingStatsInstrumentation* stats_instrumentation); virtual ~ContentLayerUpdater(); void PaintContents(SkCanvas* canvas, @@ -31,6 +33,8 @@ class CC_EXPORT ContentLayerUpdater : public LayerUpdater { RenderingStats* stats); gfx::Rect content_rect() const { return content_rect_; } + RenderingStatsInstrumentation* rendering_stats_instrumentation_; + private: gfx::Rect content_rect_; scoped_ptr<LayerPainter> painter_; diff --git a/cc/resources/skpicture_content_layer_updater.cc b/cc/resources/skpicture_content_layer_updater.cc index 6ce3df8..4276a1e 100644 --- a/cc/resources/skpicture_content_layer_updater.cc +++ b/cc/resources/skpicture_content_layer_updater.cc @@ -29,14 +29,19 @@ void SkPictureContentLayerUpdater::Resource::Update(ResourceUpdateQueue* queue, } SkPictureContentLayerUpdater::SkPictureContentLayerUpdater( - scoped_ptr<LayerPainter> painter) - : ContentLayerUpdater(painter.Pass()), layer_is_opaque_(false) {} + scoped_ptr<LayerPainter> painter, + RenderingStatsInstrumentation* stats_instrumentation) + : ContentLayerUpdater(painter.Pass(), stats_instrumentation), + layer_is_opaque_(false) {} SkPictureContentLayerUpdater::~SkPictureContentLayerUpdater() {} scoped_refptr<SkPictureContentLayerUpdater> -SkPictureContentLayerUpdater::Create(scoped_ptr<LayerPainter> painter) { - return make_scoped_refptr(new SkPictureContentLayerUpdater(painter.Pass())); +SkPictureContentLayerUpdater::Create( + scoped_ptr<LayerPainter> painter, + RenderingStatsInstrumentation* stats_instrumentation) { + return make_scoped_refptr( + new SkPictureContentLayerUpdater(painter.Pass(), stats_instrumentation)); } scoped_ptr<LayerUpdater::Resource> SkPictureContentLayerUpdater::CreateResource( diff --git a/cc/resources/skpicture_content_layer_updater.h b/cc/resources/skpicture_content_layer_updater.h index 218bbc9..b1ac917 100644 --- a/cc/resources/skpicture_content_layer_updater.h +++ b/cc/resources/skpicture_content_layer_updater.h @@ -40,14 +40,17 @@ class SkPictureContentLayerUpdater : public ContentLayerUpdater { }; static scoped_refptr<SkPictureContentLayerUpdater> Create( - scoped_ptr<LayerPainter> painter); + scoped_ptr<LayerPainter> painter, + RenderingStatsInstrumentation* stats_instrumentation); virtual scoped_ptr<LayerUpdater::Resource> CreateResource( PrioritizedResourceManager* manager) OVERRIDE; virtual void SetOpaque(bool opaque) OVERRIDE; protected: - explicit SkPictureContentLayerUpdater(scoped_ptr<LayerPainter> painter); + SkPictureContentLayerUpdater( + scoped_ptr<LayerPainter> painter, + RenderingStatsInstrumentation* stats_instrumentation); virtual ~SkPictureContentLayerUpdater(); virtual void PrepareToUpdate(gfx::Rect content_rect, |