summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-27 06:15:21 +0000
committerhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-27 06:15:21 +0000
commitd5e16c0ce64a8e86df9a3a576e0b26b3622f014a (patch)
tree4caa46dad5b493b65a136818b7eaebf1f1b830ea /cc
parentc600f5c6c9d3e9fb4b82dfc41b9ec000c9cb284d (diff)
downloadchromium_src-d5e16c0ce64a8e86df9a3a576e0b26b3622f014a.zip
chromium_src-d5e16c0ce64a8e86df9a3a576e0b26b3622f014a.tar.gz
chromium_src-d5e16c0ce64a8e86df9a3a576e0b26b3622f014a.tar.bz2
Revert 190817 "cc: Switch RenderingStats collection in Layer::Up..."
> cc: Switch RenderingStats collection in Layer::Update() to RenderingStatsInstrumentation > > This change switches all of the remaining RenderingStats collection in > composited mode to use RenderinStatsInstrumentation. > > BUG=181319 > > > Review URL: https://chromiumcodereview.appspot.com/12426024 TBR=egraether@chromium.org Review URL: https://codereview.chromium.org/13117002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@190826 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r--cc/debug/rendering_stats_instrumentation.cc8
-rw-r--r--cc/debug/rendering_stats_instrumentation.h4
-rw-r--r--cc/layers/content_layer.cc17
-rw-r--r--cc/layers/content_layer.h3
-rw-r--r--cc/layers/content_layer_unittest.cc10
-rw-r--r--cc/layers/contents_scaling_layer.cc3
-rw-r--r--cc/layers/contents_scaling_layer.h3
-rw-r--r--cc/layers/heads_up_display_layer.cc3
-rw-r--r--cc/layers/heads_up_display_layer.h3
-rw-r--r--cc/layers/image_layer.cc5
-rw-r--r--cc/layers/image_layer.h3
-rw-r--r--cc/layers/layer.cc4
-rw-r--r--cc/layers/layer.h7
-rw-r--r--cc/layers/nine_patch_layer.cc3
-rw-r--r--cc/layers/nine_patch_layer.h3
-rw-r--r--cc/layers/nine_patch_layer_unittest.cc10
-rw-r--r--cc/layers/picture_layer.cc5
-rw-r--r--cc/layers/picture_layer.h4
-rw-r--r--cc/layers/picture_layer_impl_unittest.cc4
-rw-r--r--cc/layers/scrollbar_layer.cc31
-rw-r--r--cc/layers/scrollbar_layer.h6
-rw-r--r--cc/layers/scrollbar_layer_unittest.cc2
-rw-r--r--cc/layers/texture_layer.cc3
-rw-r--r--cc/layers/texture_layer.h3
-rw-r--r--cc/layers/tiled_layer.cc30
-rw-r--r--cc/layers/tiled_layer.h7
-rw-r--r--cc/layers/tiled_layer_unittest.cc75
-rw-r--r--cc/resources/bitmap_content_layer_updater.cc32
-rw-r--r--cc/resources/bitmap_content_layer_updater.h14
-rw-r--r--cc/resources/bitmap_skpicture_content_layer_updater.cc51
-rw-r--r--cc/resources/bitmap_skpicture_content_layer_updater.h13
-rw-r--r--cc/resources/caching_bitmap_content_layer_updater.cc19
-rw-r--r--cc/resources/caching_bitmap_content_layer_updater.h10
-rw-r--r--cc/resources/content_layer_updater.cc30
-rw-r--r--cc/resources/content_layer_updater.h9
-rw-r--r--cc/resources/image_layer_updater.cc3
-rw-r--r--cc/resources/image_layer_updater.h3
-rw-r--r--cc/resources/layer_updater.h7
-rw-r--r--cc/resources/picture.cc18
-rw-r--r--cc/resources/picture.h7
-rw-r--r--cc/resources/picture_pile.cc4
-rw-r--r--cc/resources/picture_pile.h4
-rw-r--r--cc/resources/picture_pile_impl.cc1
-rw-r--r--cc/resources/picture_pile_impl.h1
-rw-r--r--cc/resources/skpicture_content_layer_updater.cc22
-rw-r--r--cc/resources/skpicture_content_layer_updater.h13
-rw-r--r--cc/test/fake_content_layer.cc5
-rw-r--r--cc/test/fake_content_layer.h3
-rw-r--r--cc/test/fake_scrollbar_layer.cc5
-rw-r--r--cc/test/fake_scrollbar_layer.h3
-rw-r--r--cc/test/tiled_layer_test_common.cc6
-rw-r--r--cc/test/tiled_layer_test_common.h6
-rw-r--r--cc/trees/layer_tree_host.cc18
-rw-r--r--cc/trees/layer_tree_host.h3
-rw-r--r--cc/trees/layer_tree_host_impl.h7
-rw-r--r--cc/trees/layer_tree_host_unittest.cc11
-rw-r--r--cc/trees/layer_tree_host_unittest_occlusion.cc3
-rw-r--r--cc/trees/single_thread_proxy.cc3
-rw-r--r--cc/trees/single_thread_proxy.h3
59 files changed, 316 insertions, 280 deletions
diff --git a/cc/debug/rendering_stats_instrumentation.cc b/cc/debug/rendering_stats_instrumentation.cc
index b1968f3..f19daae 100644
--- a/cc/debug/rendering_stats_instrumentation.cc
+++ b/cc/debug/rendering_stats_instrumentation.cc
@@ -36,6 +36,14 @@ base::TimeDelta RenderingStatsInstrumentation::EndRecording(
return base::TimeDelta();
}
+void RenderingStatsInstrumentation::AddStats(const RenderingStats& other) {
+ if (!record_rendering_stats_)
+ return;
+
+ base::AutoLock scoped_lock(lock_);
+ rendering_stats_.Add(other);
+}
+
void RenderingStatsInstrumentation::IncrementAnimationFrameCount() {
if (!record_rendering_stats_)
return;
diff --git a/cc/debug/rendering_stats_instrumentation.h b/cc/debug/rendering_stats_instrumentation.h
index 6d26857..c3ec320 100644
--- a/cc/debug/rendering_stats_instrumentation.h
+++ b/cc/debug/rendering_stats_instrumentation.h
@@ -32,6 +32,10 @@ class CC_EXPORT RenderingStatsInstrumentation {
base::TimeTicks StartRecording() const;
base::TimeDelta EndRecording(base::TimeTicks start_time) const;
+ // TODO(egraether): Remove after switching Layer::update() to use this class.
+ // Used in LayerTreeHost::paintLayerContents().
+ void AddStats(const RenderingStats& other);
+
void IncrementAnimationFrameCount();
void SetScreenFrameCount(int64 count);
void SetDroppedFrameCount(int64 count);
diff --git a/cc/layers/content_layer.cc b/cc/layers/content_layer.cc
index 4ad1bc7..c29d72e 100644
--- a/cc/layers/content_layer.cc
+++ b/cc/layers/content_layer.cc
@@ -68,7 +68,8 @@ void ContentLayer::SetTexturePriorities(
}
void ContentLayer::Update(ResourceUpdateQueue* queue,
- const OcclusionTracker* occlusion) {
+ const OcclusionTracker* occlusion,
+ RenderingStats* stats) {
{
base::AutoReset<bool> ignore_set_needs_commit(&ignore_set_needs_commit_,
true);
@@ -77,7 +78,7 @@ void ContentLayer::Update(ResourceUpdateQueue* queue,
UpdateCanUseLCDText();
}
- TiledLayer::Update(queue, occlusion);
+ TiledLayer::Update(queue, occlusion, stats);
needs_display_ = false;
}
@@ -95,17 +96,11 @@ void ContentLayer::CreateUpdaterIfNeeded() {
scoped_ptr<LayerPainter> painter =
ContentLayerPainter::Create(client_).PassAs<LayerPainter>();
if (layer_tree_host()->settings().accelerate_painting)
- updater_ = SkPictureContentLayerUpdater::Create(
- painter.Pass(),
- rendering_stats_instrumentation());
+ updater_ = SkPictureContentLayerUpdater::Create(painter.Pass());
else if (layer_tree_host()->settings().per_tile_painting_enabled)
- updater_ = BitmapSkPictureContentLayerUpdater::Create(
- painter.Pass(),
- rendering_stats_instrumentation());
+ updater_ = BitmapSkPictureContentLayerUpdater::Create(painter.Pass());
else
- updater_ = BitmapContentLayerUpdater::Create(
- painter.Pass(),
- rendering_stats_instrumentation());
+ updater_ = BitmapContentLayerUpdater::Create(painter.Pass());
updater_->SetOpaque(contents_opaque());
unsigned texture_format =
diff --git a/cc/layers/content_layer.h b/cc/layers/content_layer.h
index 0f00cfd..79394de 100644
--- a/cc/layers/content_layer.h
+++ b/cc/layers/content_layer.h
@@ -44,7 +44,8 @@ class CC_EXPORT ContentLayer : public TiledLayer {
virtual void SetTexturePriorities(const PriorityCalculator& priority_calc)
OVERRIDE;
virtual void Update(ResourceUpdateQueue* queue,
- const OcclusionTracker* occlusion) OVERRIDE;
+ const OcclusionTracker* occlusion,
+ RenderingStats* stats) OVERRIDE;
virtual bool NeedMoreUpdates() OVERRIDE;
virtual void SetContentsOpaque(bool contents_opaque) OVERRIDE;
diff --git a/cc/layers/content_layer_unittest.cc b/cc/layers/content_layer_unittest.cc
index b1c6a11..25421e7 100644
--- a/cc/layers/content_layer_unittest.cc
+++ b/cc/layers/content_layer_unittest.cc
@@ -6,7 +6,6 @@
#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"
@@ -38,18 +37,17 @@ 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>(),
- &stats_instrumentation);
+ BitmapContentLayerUpdater::Create(ContentLayerPainter::Create(&client).
+ PassAs<LayerPainter>());
gfx::Rect resulting_opaque_rect;
updater->PrepareToUpdate(content_rect,
gfx::Size(256, 256),
contents_scale,
contents_scale,
- &resulting_opaque_rect);
+ &resulting_opaque_rect,
+ NULL);
EXPECT_RECT_EQ(gfx::ToEnclosingRect(opaque_rect_in_content_space),
resulting_opaque_rect);
diff --git a/cc/layers/contents_scaling_layer.cc b/cc/layers/contents_scaling_layer.cc
index 01abcfe..d602e88 100644
--- a/cc/layers/contents_scaling_layer.cc
+++ b/cc/layers/contents_scaling_layer.cc
@@ -35,7 +35,8 @@ void ContentsScalingLayer::CalculateContentsScale(
void ContentsScalingLayer::Update(
ResourceUpdateQueue* queue,
- const OcclusionTracker* occlusion) {
+ const OcclusionTracker* occlusion,
+ RenderingStats* stats) {
if (draw_properties().contents_scale_x == last_update_contents_scale_x_ &&
draw_properties().contents_scale_y == last_update_contents_scale_y_)
return;
diff --git a/cc/layers/contents_scaling_layer.h b/cc/layers/contents_scaling_layer.h
index df853ec..a550c26 100644
--- a/cc/layers/contents_scaling_layer.h
+++ b/cc/layers/contents_scaling_layer.h
@@ -23,7 +23,8 @@ class CC_EXPORT ContentsScalingLayer : public Layer {
virtual void Update(
ResourceUpdateQueue* queue,
- const OcclusionTracker* occlusion) OVERRIDE;
+ const OcclusionTracker* occlusion,
+ RenderingStats* stats) OVERRIDE;
protected:
ContentsScalingLayer();
diff --git a/cc/layers/heads_up_display_layer.cc b/cc/layers/heads_up_display_layer.cc
index 9945178..76016b5 100644
--- a/cc/layers/heads_up_display_layer.cc
+++ b/cc/layers/heads_up_display_layer.cc
@@ -23,7 +23,8 @@ HeadsUpDisplayLayer::HeadsUpDisplayLayer() : Layer() {
HeadsUpDisplayLayer::~HeadsUpDisplayLayer() {}
void HeadsUpDisplayLayer::Update(ResourceUpdateQueue*,
- const OcclusionTracker*) {
+ const OcclusionTracker*,
+ RenderingStats*) {
const LayerTreeDebugState& debug_state = layer_tree_host()->debug_state();
int max_texture_size =
layer_tree_host()->GetRendererCapabilities().max_texture_size;
diff --git a/cc/layers/heads_up_display_layer.h b/cc/layers/heads_up_display_layer.h
index 03d29a02..d7656c5 100644
--- a/cc/layers/heads_up_display_layer.h
+++ b/cc/layers/heads_up_display_layer.h
@@ -16,7 +16,8 @@ class CC_EXPORT HeadsUpDisplayLayer : public Layer {
static scoped_refptr<HeadsUpDisplayLayer> Create();
virtual void Update(ResourceUpdateQueue* queue,
- const OcclusionTracker* tracker) OVERRIDE;
+ const OcclusionTracker* tracker,
+ RenderingStats* stats) OVERRIDE;
virtual bool DrawsContent() const OVERRIDE;
virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl)
diff --git a/cc/layers/image_layer.cc b/cc/layers/image_layer.cc
index 59cf913..4f5e105 100644
--- a/cc/layers/image_layer.cc
+++ b/cc/layers/image_layer.cc
@@ -41,7 +41,8 @@ void ImageLayer::SetTexturePriorities(const PriorityCalculator& priority_calc) {
}
void ImageLayer::Update(ResourceUpdateQueue* queue,
- const OcclusionTracker* occlusion) {
+ const OcclusionTracker* occlusion,
+ RenderingStats* stats) {
CreateUpdaterIfNeeded();
if (needs_display_) {
updater_->set_bitmap(bitmap_);
@@ -49,7 +50,7 @@ void ImageLayer::Update(ResourceUpdateQueue* queue,
InvalidateContentRect(gfx::Rect(content_bounds()));
needs_display_ = false;
}
- TiledLayer::Update(queue, occlusion);
+ TiledLayer::Update(queue, occlusion, stats);
}
void ImageLayer::CreateUpdaterIfNeeded() {
diff --git a/cc/layers/image_layer.h b/cc/layers/image_layer.h
index 25ddf12..8ba5b78 100644
--- a/cc/layers/image_layer.h
+++ b/cc/layers/image_layer.h
@@ -23,7 +23,8 @@ class CC_EXPORT ImageLayer : public TiledLayer {
virtual void SetTexturePriorities(const PriorityCalculator& priority_calc)
OVERRIDE;
virtual void Update(ResourceUpdateQueue* queue,
- const OcclusionTracker* occlusion) OVERRIDE;
+ const OcclusionTracker* occlusion,
+ RenderingStats* stats) OVERRIDE;
virtual void CalculateContentsScale(float ideal_contents_scale,
bool animating_transform_to_screen,
float* contents_scale_x,
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc
index c5a2ad8..bdd2a4f 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -818,8 +818,4 @@ 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 6a1f3b2..2e72e63 100644
--- a/cc/layers/layer.h
+++ b/cc/layers/layer.h
@@ -43,7 +43,7 @@ class PriorityCalculator;
class ResourceUpdateQueue;
class ScrollbarLayer;
struct AnimationEvent;
-class RenderingStatsInstrumentation;
+struct RenderingStats;
// Base class for composited layers. Special layer types are derived from
// this class.
@@ -267,7 +267,8 @@ class CC_EXPORT Layer : public base::RefCounted<Layer>,
// These methods typically need to be overwritten by derived classes.
virtual bool DrawsContent() const;
virtual void Update(ResourceUpdateQueue* queue,
- const OcclusionTracker* occlusion) {}
+ const OcclusionTracker* occlusion,
+ RenderingStats* stats) {}
virtual bool NeedMoreUpdates();
virtual void SetIsMask(bool is_mask) {}
@@ -369,8 +370,6 @@ 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/nine_patch_layer.cc b/cc/layers/nine_patch_layer.cc
index 9a5022d..45c69eb 100644
--- a/cc/layers/nine_patch_layer.cc
+++ b/cc/layers/nine_patch_layer.cc
@@ -57,7 +57,8 @@ void NinePatchLayer::SetBitmap(const SkBitmap& bitmap, gfx::Rect aperture) {
}
void NinePatchLayer::Update(ResourceUpdateQueue* queue,
- const OcclusionTracker* occlusion) {
+ const OcclusionTracker* occlusion,
+ RenderingStats* stats) {
CreateUpdaterIfNeeded();
if (resource_ &&
diff --git a/cc/layers/nine_patch_layer.h b/cc/layers/nine_patch_layer.h
index eaa7a1a6..21b8cb9 100644
--- a/cc/layers/nine_patch_layer.h
+++ b/cc/layers/nine_patch_layer.h
@@ -24,7 +24,8 @@ class CC_EXPORT NinePatchLayer : public Layer {
virtual void SetTexturePriorities(const PriorityCalculator& priority_calc)
OVERRIDE;
virtual void Update(ResourceUpdateQueue* queue,
- const OcclusionTracker* occlusion) OVERRIDE;
+ const OcclusionTracker* occlusion,
+ RenderingStats* stats) OVERRIDE;
virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE;
// aperture is in the pixel space of the bitmap resource and refers to
diff --git a/cc/layers/nine_patch_layer_unittest.cc b/cc/layers/nine_patch_layer_unittest.cc
index 84c5348..a274100 100644
--- a/cc/layers/nine_patch_layer_unittest.cc
+++ b/cc/layers/nine_patch_layer_unittest.cc
@@ -73,7 +73,7 @@ TEST_F(NinePatchLayerTest, TriggerFullUploadOnceWhenChangingBitmap) {
// No bitmap set should not trigger any uploads.
test_layer->SetTexturePriorities(calculator);
- test_layer->Update(&queue, &occlusion_tracker);
+ test_layer->Update(&queue, &occlusion_tracker, NULL);
EXPECT_EQ(queue.FullUploadSize(), 0);
EXPECT_EQ(queue.PartialUploadSize(), 0);
@@ -83,7 +83,7 @@ TEST_F(NinePatchLayerTest, TriggerFullUploadOnceWhenChangingBitmap) {
bitmap.allocPixels();
test_layer->SetBitmap(bitmap, gfx::Rect(5, 5, 1, 1));
test_layer->SetTexturePriorities(calculator);
- test_layer->Update(&queue, &occlusion_tracker);
+ test_layer->Update(&queue, &occlusion_tracker, NULL);
EXPECT_EQ(queue.FullUploadSize(), 1);
EXPECT_EQ(queue.PartialUploadSize(), 0);
ResourceUpdate params = queue.TakeFirstFullUpload();
@@ -107,7 +107,7 @@ TEST_F(NinePatchLayerTest, TriggerFullUploadOnceWhenChangingBitmap) {
// Nothing changed, so no repeated upload.
test_layer->SetTexturePriorities(calculator);
- test_layer->Update(&queue, &occlusion_tracker);
+ test_layer->Update(&queue, &occlusion_tracker, NULL);
EXPECT_EQ(queue.FullUploadSize(), 0);
EXPECT_EQ(queue.PartialUploadSize(), 0);
{
@@ -119,7 +119,7 @@ TEST_F(NinePatchLayerTest, TriggerFullUploadOnceWhenChangingBitmap) {
// Reupload after eviction
test_layer->SetTexturePriorities(calculator);
- test_layer->Update(&queue, &occlusion_tracker);
+ test_layer->Update(&queue, &occlusion_tracker, NULL);
EXPECT_EQ(queue.FullUploadSize(), 1);
EXPECT_EQ(queue.PartialUploadSize(), 0);
@@ -129,7 +129,7 @@ TEST_F(NinePatchLayerTest, TriggerFullUploadOnceWhenChangingBitmap) {
EXPECT_EQ(NULL, params.texture->resource_manager());
test_layer->SetTexturePriorities(calculator);
ResourceUpdateQueue queue2;
- test_layer->Update(&queue2, &occlusion_tracker);
+ test_layer->Update(&queue2, &occlusion_tracker, NULL);
EXPECT_EQ(queue2.FullUploadSize(), 1);
EXPECT_EQ(queue2.PartialUploadSize(), 0);
params = queue2.TakeFirstFullUpload();
diff --git a/cc/layers/picture_layer.cc b/cc/layers/picture_layer.cc
index 732f811..c6f341a 100644
--- a/cc/layers/picture_layer.cc
+++ b/cc/layers/picture_layer.cc
@@ -68,7 +68,8 @@ void PictureLayer::SetNeedsDisplayRect(const gfx::RectF& layer_rect) {
}
void PictureLayer::Update(ResourceUpdateQueue*,
- const OcclusionTracker*) {
+ const OcclusionTracker*,
+ RenderingStats* stats) {
// Do not early-out of this function so that PicturePile::Update has a chance
// to record pictures due to changing visibility of this layer.
@@ -86,7 +87,7 @@ void PictureLayer::Update(ResourceUpdateQueue*,
background_color(),
pile_invalidation_,
visible_layer_rect,
- rendering_stats_instrumentation());
+ stats);
}
void PictureLayer::SetIsMask(bool is_mask) {
diff --git a/cc/layers/picture_layer.h b/cc/layers/picture_layer.h
index 7dde9bc..0ba4031 100644
--- a/cc/layers/picture_layer.h
+++ b/cc/layers/picture_layer.h
@@ -15,6 +15,7 @@ namespace cc {
class ContentLayerClient;
class ResourceUpdateQueue;
+struct RenderingStats;
class CC_EXPORT PictureLayer : public ContentsScalingLayer {
public:
@@ -31,7 +32,8 @@ class CC_EXPORT PictureLayer : public ContentsScalingLayer {
virtual void SetNeedsDisplayRect(const gfx::RectF& layer_rect) OVERRIDE;
virtual void Update(
ResourceUpdateQueue* queue,
- const OcclusionTracker* occlusion) OVERRIDE;
+ const OcclusionTracker* occlusion,
+ RenderingStats* stats) OVERRIDE;
virtual void SetIsMask(bool is_mask) OVERRIDE;
protected:
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc
index afbb597..962d927 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -11,7 +11,6 @@
#include "cc/test/fake_impl_proxy.h"
#include "cc/test/fake_layer_tree_host_impl.h"
#include "cc/test/fake_output_surface.h"
-#include "cc/test/fake_rendering_stats_instrumentation.h"
#include "cc/test/impl_side_painting_settings.h"
#include "cc/trees/layer_tree_impl.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -96,8 +95,7 @@ class TestablePicturePileImpl : public PicturePileImpl {
return;
gfx::Rect bounds(tiling().TileBounds(x, y));
scoped_refptr<Picture> picture(Picture::Create(bounds));
- FakeRenderingStatsInstrumentation stats_instrumentation;
- picture->Record(&client_, &stats_instrumentation, tile_grid_info_);
+ picture->Record(&client_, NULL, tile_grid_info_);
picture_list_map_[std::pair<int, int>(x, y)].push_back(picture);
EXPECT_TRUE(HasRecordingAt(x, y));
diff --git a/cc/layers/scrollbar_layer.cc b/cc/layers/scrollbar_layer.cc
index 1bf71e6..c5f15b7 100644
--- a/cc/layers/scrollbar_layer.cc
+++ b/cc/layers/scrollbar_layer.cc
@@ -270,8 +270,7 @@ void ScrollbarLayer::CreateUpdaterIfNeeded() {
scrollbar_.get(),
painter_.get(),
geometry_.get(),
- WebKit::WebScrollbar::BackTrackPart).PassAs<LayerPainter>(),
- rendering_stats_instrumentation());
+ WebKit::WebScrollbar::BackTrackPart).PassAs<LayerPainter>());
}
if (!back_track_) {
back_track_ = back_track_updater_->CreateResource(
@@ -287,8 +286,7 @@ void ScrollbarLayer::CreateUpdaterIfNeeded() {
scrollbar_.get(),
painter_.get(),
geometry_.get(),
- WebKit::WebScrollbar::ForwardTrackPart).PassAs<LayerPainter>(),
- rendering_stats_instrumentation());
+ WebKit::WebScrollbar::ForwardTrackPart).PassAs<LayerPainter>());
}
if (!fore_track_) {
fore_track_ = fore_track_updater_->CreateResource(
@@ -300,8 +298,7 @@ void ScrollbarLayer::CreateUpdaterIfNeeded() {
thumb_updater_ = CachingBitmapContentLayerUpdater::Create(
ScrollbarThumbPainter::Create(scrollbar_.get(),
painter_.get(),
- geometry_.get()).PassAs<LayerPainter>(),
- rendering_stats_instrumentation());
+ geometry_.get()).PassAs<LayerPainter>());
}
if (!thumb_) {
thumb_ = thumb_updater_->CreateResource(
@@ -312,7 +309,8 @@ void ScrollbarLayer::CreateUpdaterIfNeeded() {
void ScrollbarLayer::UpdatePart(CachingBitmapContentLayerUpdater* painter,
LayerUpdater::Resource* resource,
gfx::Rect rect,
- ResourceUpdateQueue* queue) {
+ ResourceUpdateQueue* queue,
+ RenderingStats* stats) {
if (layer_tree_host()->settings().solid_color_scrollbars)
return;
@@ -334,7 +332,8 @@ void ScrollbarLayer::UpdatePart(CachingBitmapContentLayerUpdater* painter,
rect.size(),
contents_scale_x(),
contents_scale_y(),
- &painted_opaque_rect);
+ &painted_opaque_rect,
+ stats);
if (!painter->pixels_did_change() &&
resource->texture()->have_backing_texture()) {
TRACE_EVENT_INSTANT0("cc",
@@ -349,7 +348,7 @@ void ScrollbarLayer::UpdatePart(CachingBitmapContentLayerUpdater* painter,
resource->texture()->ReturnBackingTexture();
gfx::Vector2d dest_offset(0, 0);
- resource->Update(queue, rect, dest_offset, partial_updates_allowed);
+ resource->Update(queue, rect, dest_offset, partial_updates_allowed, stats);
}
gfx::Rect ScrollbarLayer::ScrollbarLayerRectToContentRect(
@@ -396,8 +395,9 @@ void ScrollbarLayer::SetTexturePriorities(
}
void ScrollbarLayer::Update(ResourceUpdateQueue* queue,
- const OcclusionTracker* occlusion) {
- ContentsScalingLayer::Update(queue, occlusion);
+ const OcclusionTracker* occlusion,
+ RenderingStats* stats) {
+ ContentsScalingLayer::Update(queue, occlusion, stats);
dirty_rect_.Union(update_rect_);
if (content_bounds().IsEmpty())
@@ -412,12 +412,14 @@ void ScrollbarLayer::Update(ResourceUpdateQueue* queue,
UpdatePart(back_track_updater_.get(),
back_track_.get(),
content_rect,
- queue);
+ queue,
+ stats);
if (fore_track_ && fore_track_updater_) {
UpdatePart(fore_track_updater_.get(),
fore_track_.get(),
content_rect,
- queue);
+ queue,
+ stats);
}
// Consider the thumb to be at the origin when painting.
@@ -429,7 +431,8 @@ void ScrollbarLayer::Update(ResourceUpdateQueue* queue,
UpdatePart(thumb_updater_.get(),
thumb_.get(),
origin_thumb_rect,
- queue);
+ queue,
+ stats);
}
dirty_rect_ = gfx::RectF();
diff --git a/cc/layers/scrollbar_layer.h b/cc/layers/scrollbar_layer.h
index 7920964..db97272 100644
--- a/cc/layers/scrollbar_layer.h
+++ b/cc/layers/scrollbar_layer.h
@@ -40,7 +40,8 @@ class CC_EXPORT ScrollbarLayer : public ContentsScalingLayer {
virtual void SetTexturePriorities(const PriorityCalculator& priority_calc)
OVERRIDE;
virtual void Update(ResourceUpdateQueue* queue,
- const OcclusionTracker* occlusion) OVERRIDE;
+ const OcclusionTracker* occlusion,
+ RenderingStats* stats) OVERRIDE;
virtual void SetLayerTreeHost(LayerTreeHost* host) OVERRIDE;
virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE;
virtual void CalculateContentsScale(float ideal_contents_scale,
@@ -63,7 +64,8 @@ class CC_EXPORT ScrollbarLayer : public ContentsScalingLayer {
void UpdatePart(CachingBitmapContentLayerUpdater* painter,
LayerUpdater::Resource* resource,
gfx::Rect rect,
- ResourceUpdateQueue* queue);
+ ResourceUpdateQueue* queue,
+ RenderingStats* stats);
void CreateUpdaterIfNeeded();
gfx::Rect ScrollbarLayerRectToContentRect(gfx::Rect layer_rect) const;
diff --git a/cc/layers/scrollbar_layer_unittest.cc b/cc/layers/scrollbar_layer_unittest.cc
index 1258a8c..779abf1 100644
--- a/cc/layers/scrollbar_layer_unittest.cc
+++ b/cc/layers/scrollbar_layer_unittest.cc
@@ -392,7 +392,7 @@ class ScrollbarLayerTestResourceCreation : public testing::Test {
scrollbar_layer->SetTexturePriorities(calculator);
layer_tree_host_->contents_texture_manager()->PrioritizeTextures();
- scrollbar_layer->Update(&queue, &occlusion_tracker);
+ scrollbar_layer->Update(&queue, &occlusion_tracker, NULL);
EXPECT_EQ(0, queue.FullUploadSize());
EXPECT_EQ(expected_resources, queue.PartialUploadSize());
diff --git a/cc/layers/texture_layer.cc b/cc/layers/texture_layer.cc
index 4d63f72..acabc87 100644
--- a/cc/layers/texture_layer.cc
+++ b/cc/layers/texture_layer.cc
@@ -155,7 +155,8 @@ bool TextureLayer::DrawsContent() const {
}
void TextureLayer::Update(ResourceUpdateQueue* queue,
- const OcclusionTracker* occlusion) {
+ const OcclusionTracker* occlusion,
+ RenderingStats* stats) {
if (client_) {
texture_id_ = client_->PrepareTexture(queue);
context_lost_ =
diff --git a/cc/layers/texture_layer.h b/cc/layers/texture_layer.h
index 28994f3..1e7b31b 100644
--- a/cc/layers/texture_layer.h
+++ b/cc/layers/texture_layer.h
@@ -70,7 +70,8 @@ class CC_EXPORT TextureLayer : public Layer {
virtual void SetLayerTreeHost(LayerTreeHost* layer_tree_host) OVERRIDE;
virtual bool DrawsContent() const OVERRIDE;
virtual void Update(ResourceUpdateQueue* queue,
- const OcclusionTracker* occlusion) OVERRIDE;
+ const OcclusionTracker* occlusion,
+ RenderingStats* stats) OVERRIDE;
virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE;
virtual bool BlocksPendingCommit() const OVERRIDE;
diff --git a/cc/layers/tiled_layer.cc b/cc/layers/tiled_layer.cc
index 7afb0d7..99b44ce 100644
--- a/cc/layers/tiled_layer.cc
+++ b/cc/layers/tiled_layer.cc
@@ -317,6 +317,7 @@ bool TiledLayer::UpdateTiles(int left,
int bottom,
ResourceUpdateQueue* queue,
const OcclusionTracker* occlusion,
+ RenderingStats* stats,
bool* did_paint) {
*did_paint = false;
CreateUpdaterIfNeeded();
@@ -338,7 +339,7 @@ bool TiledLayer::UpdateTiles(int left,
*did_paint = true;
UpdateTileTextures(
- paint_rect, left, top, right, bottom, queue, occlusion);
+ paint_rect, left, top, right, bottom, queue, occlusion, stats);
return true;
}
@@ -464,7 +465,8 @@ void TiledLayer::UpdateTileTextures(gfx::Rect paint_rect,
int right,
int bottom,
ResourceUpdateQueue* queue,
- const OcclusionTracker* occlusion) {
+ const OcclusionTracker* occlusion,
+ RenderingStats* stats) {
// The update_rect should be in layer space. So we have to convert the
// paint_rect from content space to layer space.
float width_scale =
@@ -484,7 +486,8 @@ void TiledLayer::UpdateTileTextures(gfx::Rect paint_rect,
tiler_->tile_size(),
1.f / width_scale,
1.f / height_scale,
- &painted_opaque_rect);
+ &painted_opaque_rect,
+ stats);
for (int j = top; j <= bottom; ++j) {
for (int i = left; i <= right; ++i) {
@@ -549,7 +552,7 @@ void TiledLayer::UpdateTileTextures(gfx::Rect paint_rect,
CHECK_LE(paint_offset.y() + source_rect.height(), paint_rect.height());
tile->updater_resource()->Update(
- queue, source_rect, dest_offset, tile->partial_update);
+ queue, source_rect, dest_offset, tile->partial_update, stats);
if (occlusion) {
occlusion->overdraw_metrics()->
DidUpload(gfx::Transform(), source_rect, tile->opaque_rect());
@@ -716,13 +719,14 @@ void TiledLayer::UpdateScrollPrediction() {
}
void TiledLayer::Update(ResourceUpdateQueue* queue,
- const OcclusionTracker* occlusion) {
+ const OcclusionTracker* occlusion,
+ RenderingStats* stats) {
DCHECK(!skips_draw_ && !failed_update_); // Did ResetUpdateState get skipped?
{
base::AutoReset<bool> ignore_set_needs_commit(&ignore_set_needs_commit_,
true);
- ContentsScalingLayer::Update(queue, occlusion);
+ ContentsScalingLayer::Update(queue, occlusion, stats);
UpdateBounds();
}
@@ -741,7 +745,7 @@ void TiledLayer::Update(ResourceUpdateQueue* queue,
&top,
&right,
&bottom);
- UpdateTiles(left, top, right, bottom, queue, NULL, &did_paint);
+ UpdateTiles(left, top, right, bottom, queue, NULL, stats, &did_paint);
if (did_paint)
return;
// This was an attempt to paint the entire layer so if we fail it's okay,
@@ -759,7 +763,7 @@ void TiledLayer::Update(ResourceUpdateQueue* queue,
predicted_visible_rect_, &left, &top, &right, &bottom);
MarkOcclusionsAndRequestTextures(left, top, right, bottom, occlusion);
skips_draw_ = !UpdateTiles(
- left, top, right, bottom, queue, occlusion, &did_paint);
+ left, top, right, bottom, queue, occlusion, stats, &did_paint);
if (skips_draw_)
tiler_->reset();
if (skips_draw_ || did_paint)
@@ -772,7 +776,7 @@ void TiledLayer::Update(ResourceUpdateQueue* queue,
return;
// Prepaint anything that was occluded but inside the layer's visible region.
- if (!UpdateTiles(left, top, right, bottom, queue, NULL, &did_paint) ||
+ if (!UpdateTiles(left, top, right, bottom, queue, NULL, stats, &did_paint) ||
did_paint)
return;
@@ -802,7 +806,7 @@ void TiledLayer::Update(ResourceUpdateQueue* queue,
while (bottom < prepaint_bottom) {
++bottom;
if (!UpdateTiles(
- left, bottom, right, bottom, queue, NULL, &did_paint) ||
+ left, bottom, right, bottom, queue, NULL, stats, &did_paint) ||
did_paint)
return;
}
@@ -811,7 +815,7 @@ void TiledLayer::Update(ResourceUpdateQueue* queue,
while (top > prepaint_top) {
--top;
if (!UpdateTiles(
- left, top, right, top, queue, NULL, &did_paint) ||
+ left, top, right, top, queue, NULL, stats, &did_paint) ||
did_paint)
return;
}
@@ -820,7 +824,7 @@ void TiledLayer::Update(ResourceUpdateQueue* queue,
while (left > prepaint_left) {
--left;
if (!UpdateTiles(
- left, top, left, bottom, queue, NULL, &did_paint) ||
+ left, top, left, bottom, queue, NULL, stats, &did_paint) ||
did_paint)
return;
}
@@ -829,7 +833,7 @@ void TiledLayer::Update(ResourceUpdateQueue* queue,
while (right < prepaint_right) {
++right;
if (!UpdateTiles(
- right, top, right, bottom, queue, NULL, &did_paint) ||
+ right, top, right, bottom, queue, NULL, stats, &did_paint) ||
did_paint)
return;
}
diff --git a/cc/layers/tiled_layer.h b/cc/layers/tiled_layer.h
index a2d1ecb..e6112d0 100644
--- a/cc/layers/tiled_layer.h
+++ b/cc/layers/tiled_layer.h
@@ -34,7 +34,8 @@ class CC_EXPORT TiledLayer : public ContentsScalingLayer {
OVERRIDE;
virtual Region VisibleContentOpaqueRegion() const OVERRIDE;
virtual void Update(ResourceUpdateQueue* queue,
- const OcclusionTracker* occlusion) OVERRIDE;
+ const OcclusionTracker* occlusion,
+ RenderingStats* stats) OVERRIDE;
protected:
TiledLayer();
@@ -95,6 +96,7 @@ class CC_EXPORT TiledLayer : public ContentsScalingLayer {
int bottom,
ResourceUpdateQueue* queue,
const OcclusionTracker* occlusion,
+ RenderingStats* stats,
bool* did_paint);
bool HaveTexturesForTiles(int left,
int top,
@@ -112,7 +114,8 @@ class CC_EXPORT TiledLayer : public ContentsScalingLayer {
int right,
int bottom,
ResourceUpdateQueue* queue,
- const OcclusionTracker* occlusion);
+ const OcclusionTracker* occlusion,
+ RenderingStats* stats);
void UpdateScrollPrediction();
UpdatableTile* TileAt(int i, int j) const;
diff --git a/cc/layers/tiled_layer_unittest.cc b/cc/layers/tiled_layer_unittest.cc
index 42b22b0..dd6c06e 100644
--- a/cc/layers/tiled_layer_unittest.cc
+++ b/cc/layers/tiled_layer_unittest.cc
@@ -17,7 +17,6 @@
#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"
@@ -113,7 +112,7 @@ class TiledLayerTest : public testing::Test {
void LayerUpdate(FakeTiledLayer* layer, TestOcclusionTracker* occluded) {
DebugScopedSetMainThread main_thread(proxy_);
- layer->Update(queue_.get(), occluded);
+ layer->Update(queue_.get(), occluded, NULL);
}
void CalcDrawProps(const scoped_refptr<FakeTiledLayer>& layer1) {
@@ -162,9 +161,9 @@ class TiledLayerTest : public testing::Test {
// Update content
if (layer1)
- layer1->Update(queue_.get(), occlusion_);
+ layer1->Update(queue_.get(), occlusion_, NULL);
if (layer2)
- layer2->Update(queue_.get(), occlusion_);
+ layer2->Update(queue_.get(), occlusion_, NULL);
bool needs_update = false;
if (layer1)
@@ -606,7 +605,7 @@ TEST_F(TiledLayerTest, PaintSmallAnimatedLayersImmediately) {
// if it is close to the viewport size and has the available memory.
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), NULL);
+ layer->Update(queue_.get(), 0, NULL);
UpdateTextures();
LayerPushPropertiesTo(layer.get(), layer_impl.get());
@@ -773,7 +772,7 @@ TEST_F(TiledLayerTest, VerifyUpdateRectWhenContentBoundsAreScaled) {
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), NULL);
+ layer->Update(queue_.get(), 0, NULL);
EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 300, 300 * 0.8), layer->update_rect());
UpdateTextures();
@@ -782,7 +781,7 @@ TEST_F(TiledLayerTest, VerifyUpdateRectWhenContentBoundsAreScaled) {
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
layer->InvalidateContentRect(content_bounds);
- layer->Update(queue_.get(), NULL);
+ layer->Update(queue_.get(), 0, NULL);
EXPECT_FLOAT_RECT_EQ(gfx::RectF(layer_bounds), layer->update_rect());
UpdateTextures();
@@ -792,7 +791,7 @@ TEST_F(TiledLayerTest, VerifyUpdateRectWhenContentBoundsAreScaled) {
layer->InvalidateContentRect(partial_damage);
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), NULL);
+ layer->Update(queue_.get(), 0, NULL);
EXPECT_FLOAT_RECT_EQ(gfx::RectF(45, 80, 15, 8), layer->update_rect());
}
@@ -812,7 +811,7 @@ TEST_F(TiledLayerTest, VerifyInvalidationWhenContentsScaleChanges) {
// Push the tiles to the impl side and check that there is exactly one.
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), NULL);
+ layer->Update(queue_.get(), 0, NULL);
UpdateTextures();
LayerPushPropertiesTo(layer.get(), layer_impl.get());
EXPECT_TRUE(layer_impl->HasResourceIdForTileAt(0, 0));
@@ -830,7 +829,7 @@ TEST_F(TiledLayerTest, VerifyInvalidationWhenContentsScaleChanges) {
// The impl side should get 2x2 tiles now.
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), NULL);
+ layer->Update(queue_.get(), 0, NULL);
UpdateTextures();
LayerPushPropertiesTo(layer.get(), layer_impl.get());
EXPECT_TRUE(layer_impl->HasResourceIdForTileAt(0, 0));
@@ -911,7 +910,7 @@ TEST_F(TiledLayerTest, ResizeToSmaller) {
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), NULL);
+ layer->Update(queue_.get(), 0, NULL);
layer->SetBounds(gfx::Size(200, 200));
layer->InvalidateContentRect(gfx::Rect(0, 0, 200, 200));
@@ -929,7 +928,7 @@ TEST_F(TiledLayerTest, HugeLayerUpdateCrash) {
// Ensure no crash for bounds where size * size would overflow an int.
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), NULL);
+ layer->Update(queue_.get(), 0, NULL);
}
class TiledLayerPartialUpdateTest : public TiledLayerTest {
@@ -1060,7 +1059,7 @@ TEST_F(TiledLayerTest, TilesPaintedWithoutOcclusion) {
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), NULL);
+ layer->Update(queue_.get(), 0, NULL);
EXPECT_EQ(2, layer->fake_layer_updater()->update_count());
}
@@ -1085,7 +1084,7 @@ TEST_F(TiledLayerTest, TilesPaintedWithOcclusion) {
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), &occluded);
+ layer->Update(queue_.get(), &occluded, NULL);
EXPECT_EQ(36 - 3, layer->fake_layer_updater()->update_count());
EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1);
@@ -1099,7 +1098,7 @@ TEST_F(TiledLayerTest, TilesPaintedWithOcclusion) {
occluded.SetOcclusion(gfx::Rect(250, 200, 300, 100));
layer->InvalidateContentRect(gfx::Rect(0, 0, 600, 600));
- layer->Update(queue_.get(), &occluded);
+ layer->Update(queue_.get(), &occluded, NULL);
EXPECT_EQ(36 - 2, layer->fake_layer_updater()->update_count());
EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1);
@@ -1114,7 +1113,7 @@ TEST_F(TiledLayerTest, TilesPaintedWithOcclusion) {
occluded.SetOcclusion(gfx::Rect(250, 250, 300, 100));
layer->InvalidateContentRect(gfx::Rect(0, 0, 600, 600));
- layer->Update(queue_.get(), &occluded);
+ layer->Update(queue_.get(), &occluded, NULL);
EXPECT_EQ(36, layer->fake_layer_updater()->update_count());
EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1);
@@ -1145,7 +1144,7 @@ TEST_F(TiledLayerTest, TilesPaintedWithOcclusionAndVisiblityConstraints) {
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), &occluded);
+ layer->Update(queue_.get(), &occluded, NULL);
EXPECT_EQ(24 - 3, layer->fake_layer_updater()->update_count());
EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1);
@@ -1163,7 +1162,7 @@ TEST_F(TiledLayerTest, TilesPaintedWithOcclusionAndVisiblityConstraints) {
layer->InvalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), &occluded);
+ layer->Update(queue_.get(), &occluded, NULL);
EXPECT_EQ(24 - 6, layer->fake_layer_updater()->update_count());
EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1);
@@ -1182,7 +1181,7 @@ TEST_F(TiledLayerTest, TilesPaintedWithOcclusionAndVisiblityConstraints) {
layer->InvalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), &occluded);
+ layer->Update(queue_.get(), &occluded, NULL);
EXPECT_EQ(24 - 6, layer->fake_layer_updater()->update_count());
EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1);
@@ -1210,7 +1209,7 @@ TEST_F(TiledLayerTest, TilesNotPaintedWithoutInvalidation) {
layer->InvalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), &occluded);
+ layer->Update(queue_.get(), &occluded, NULL);
EXPECT_EQ(36 - 3, layer->fake_layer_updater()->update_count());
{ UpdateTextures(); }
@@ -1225,7 +1224,7 @@ TEST_F(TiledLayerTest, TilesNotPaintedWithoutInvalidation) {
// Repaint without marking it dirty. The 3 culled tiles will be pre-painted
// now.
- layer->Update(queue_.get(), &occluded);
+ layer->Update(queue_.get(), &occluded, NULL);
EXPECT_EQ(3, layer->fake_layer_updater()->update_count());
EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1);
@@ -1260,7 +1259,7 @@ TEST_F(TiledLayerTest, TilesPaintedWithOcclusionAndTransforms) {
layer->InvalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), &occluded);
+ layer->Update(queue_.get(), &occluded, NULL);
EXPECT_EQ(36 - 3, layer->fake_layer_updater()->update_count());
EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1);
@@ -1299,7 +1298,7 @@ TEST_F(TiledLayerTest, TilesPaintedWithOcclusionAndScaling) {
layer->InvalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), &occluded);
+ layer->Update(queue_.get(), &occluded, NULL);
// The content is half the size of the layer (so the number of tiles is
// fewer). In this case, the content is 300x300, and since the tile size is
// 100, the number of tiles 3x3.
@@ -1323,7 +1322,7 @@ TEST_F(TiledLayerTest, TilesPaintedWithOcclusionAndScaling) {
layer->InvalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), &occluded);
+ layer->Update(queue_.get(), &occluded, NULL);
EXPECT_EQ(9 - 1, layer->fake_layer_updater()->update_count());
EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1);
@@ -1350,7 +1349,7 @@ TEST_F(TiledLayerTest, TilesPaintedWithOcclusionAndScaling) {
layer->InvalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), &occluded);
+ layer->Update(queue_.get(), &occluded, NULL);
EXPECT_EQ(9 - 1, layer->fake_layer_updater()->update_count());
EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1);
@@ -1388,7 +1387,7 @@ TEST_F(TiledLayerTest, VisibleContentOpaqueRegion) {
layer->InvalidateContentRect(content_bounds);
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), &occluded);
+ layer->Update(queue_.get(), &occluded, NULL);
opaque_contents = layer->VisibleContentOpaqueRegion();
EXPECT_TRUE(opaque_contents.IsEmpty());
@@ -1405,7 +1404,7 @@ TEST_F(TiledLayerTest, VisibleContentOpaqueRegion) {
layer->InvalidateContentRect(content_bounds);
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), &occluded);
+ layer->Update(queue_.get(), &occluded, NULL);
UpdateTextures();
opaque_contents = layer->VisibleContentOpaqueRegion();
EXPECT_EQ(gfx::IntersectRects(opaque_paint_rect, visible_bounds).ToString(),
@@ -1422,7 +1421,7 @@ TEST_F(TiledLayerTest, VisibleContentOpaqueRegion) {
layer->fake_layer_updater()->SetOpaquePaintRect(gfx::Rect());
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), &occluded);
+ layer->Update(queue_.get(), &occluded, NULL);
UpdateTextures();
opaque_contents = layer->VisibleContentOpaqueRegion();
EXPECT_EQ(gfx::IntersectRects(opaque_paint_rect, visible_bounds).ToString(),
@@ -1441,7 +1440,7 @@ TEST_F(TiledLayerTest, VisibleContentOpaqueRegion) {
layer->InvalidateContentRect(gfx::Rect(0, 0, 1, 1));
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), &occluded);
+ layer->Update(queue_.get(), &occluded, NULL);
UpdateTextures();
opaque_contents = layer->VisibleContentOpaqueRegion();
EXPECT_EQ(gfx::IntersectRects(opaque_paint_rect, visible_bounds).ToString(),
@@ -1460,7 +1459,7 @@ TEST_F(TiledLayerTest, VisibleContentOpaqueRegion) {
layer->InvalidateContentRect(gfx::Rect(10, 10, 1, 1));
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), &occluded);
+ layer->Update(queue_.get(), &occluded, NULL);
UpdateTextures();
opaque_contents = layer->VisibleContentOpaqueRegion();
EXPECT_EQ(gfx::IntersectRects(gfx::Rect(10, 100, 90, 100),
@@ -1499,7 +1498,7 @@ TEST_F(TiledLayerTest, Pixels_paintedMetrics) {
layer->InvalidateContentRect(content_bounds);
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), &occluded);
+ layer->Update(queue_.get(), &occluded, NULL);
UpdateTextures();
opaque_contents = layer->VisibleContentOpaqueRegion();
EXPECT_TRUE(opaque_contents.IsEmpty());
@@ -1518,7 +1517,7 @@ TEST_F(TiledLayerTest, Pixels_paintedMetrics) {
layer->InvalidateContentRect(gfx::Rect(50, 200, 10, 10));
layer->SetTexturePriorities(priority_calculator_);
resource_manager_->PrioritizeTextures();
- layer->Update(queue_.get(), &occluded);
+ layer->Update(queue_.get(), &occluded, NULL);
UpdateTextures();
opaque_contents = layer->VisibleContentOpaqueRegion();
EXPECT_TRUE(opaque_contents.IsEmpty());
@@ -1720,8 +1719,7 @@ class UpdateTrackingTiledLayer : public FakeTiledLayer {
scoped_ptr<TrackingLayerPainter> painter(TrackingLayerPainter::Create());
tracking_layer_painter_ = painter.get();
layer_updater_ =
- BitmapContentLayerUpdater::Create(painter.PassAs<LayerPainter>(),
- &stats_instrumentation_);
+ BitmapContentLayerUpdater::Create(painter.PassAs<LayerPainter>());
}
TrackingLayerPainter* tracking_layer_painter() const {
@@ -1736,7 +1734,6 @@ class UpdateTrackingTiledLayer : public FakeTiledLayer {
TrackingLayerPainter* tracking_layer_painter_;
scoped_refptr<BitmapContentLayerUpdater> layer_updater_;
- FakeRenderingStatsInstrumentation stats_instrumentation_;
};
TEST_F(TiledLayerTest, NonIntegerContentsScaleIsNotDistortedDuringPaint) {
@@ -1757,7 +1754,7 @@ TEST_F(TiledLayerTest, NonIntegerContentsScaleIsNotDistortedDuringPaint) {
resource_manager_->PrioritizeTextures();
// Update the whole tile.
- layer->Update(queue_.get(), NULL);
+ layer->Update(queue_.get(), 0, NULL);
layer->tracking_layer_painter()->ResetPaintedRect();
EXPECT_RECT_EQ(gfx::Rect(), layer->tracking_layer_painter()->PaintedRect());
@@ -1766,7 +1763,7 @@ TEST_F(TiledLayerTest, NonIntegerContentsScaleIsNotDistortedDuringPaint) {
// Invalidate the entire layer in content space. When painting, the rect given
// to webkit should match the layer's bounds.
layer->InvalidateContentRect(content_rect);
- layer->Update(queue_.get(), NULL);
+ layer->Update(queue_.get(), 0, NULL);
EXPECT_RECT_EQ(layer_rect, layer->tracking_layer_painter()->PaintedRect());
}
@@ -1789,7 +1786,7 @@ TEST_F(TiledLayerTest,
resource_manager_->PrioritizeTextures();
// Update the whole tile.
- layer->Update(queue_.get(), NULL);
+ layer->Update(queue_.get(), 0, NULL);
layer->tracking_layer_painter()->ResetPaintedRect();
EXPECT_RECT_EQ(gfx::Rect(), layer->tracking_layer_painter()->PaintedRect());
@@ -1798,7 +1795,7 @@ TEST_F(TiledLayerTest,
// Invalidate the entire layer in layer space. When painting, the rect given
// to webkit should match the layer's bounds.
layer->SetNeedsDisplayRect(layer_rect);
- layer->Update(queue_.get(), NULL);
+ layer->Update(queue_.get(), 0, NULL);
EXPECT_RECT_EQ(layer_rect, layer->tracking_layer_painter()->PaintedRect());
}
diff --git a/cc/resources/bitmap_content_layer_updater.cc b/cc/resources/bitmap_content_layer_updater.cc
index 93f5807..5365c4c 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_instrumentation.h"
+#include "cc/debug/rendering_stats.h"
#include "cc/resources/layer_painter.h"
#include "cc/resources/prioritized_resource.h"
#include "cc/resources/resource_update.h"
@@ -23,23 +23,20 @@ BitmapContentLayerUpdater::Resource::~Resource() {}
void BitmapContentLayerUpdater::Resource::Update(ResourceUpdateQueue* queue,
gfx::Rect source_rect,
gfx::Vector2d dest_offset,
- bool partial_update) {
+ bool partial_update,
+ RenderingStats* stats) {
updater_->UpdateTexture(
queue, texture(), source_rect, dest_offset, partial_update);
}
scoped_refptr<BitmapContentLayerUpdater> BitmapContentLayerUpdater::Create(
- scoped_ptr<LayerPainter> painter,
- RenderingStatsInstrumentation* stats_instrumentation) {
- return make_scoped_refptr(
- new BitmapContentLayerUpdater(painter.Pass(), stats_instrumentation));
+ scoped_ptr<LayerPainter> painter) {
+ return make_scoped_refptr(new BitmapContentLayerUpdater(painter.Pass()));
}
BitmapContentLayerUpdater::BitmapContentLayerUpdater(
- scoped_ptr<LayerPainter> painter,
- RenderingStatsInstrumentation* stats_instrumentation)
- : ContentLayerUpdater(painter.Pass(), stats_instrumentation),
- opaque_(false) {}
+ scoped_ptr<LayerPainter> painter)
+ : ContentLayerUpdater(painter.Pass()), opaque_(false) {}
BitmapContentLayerUpdater::~BitmapContentLayerUpdater() {}
@@ -54,24 +51,25 @@ void BitmapContentLayerUpdater::PrepareToUpdate(
gfx::Size tile_size,
float contents_width_scale,
float contents_height_scale,
- gfx::Rect* resulting_opaque_rect) {
+ gfx::Rect* resulting_opaque_rect,
+ RenderingStats* stats) {
if (canvas_size_ != content_rect.size()) {
canvas_size_ = content_rect.size();
canvas_ = make_scoped_ptr(skia::CreateBitmapCanvas(
canvas_size_.width(), canvas_size_.height(), opaque_));
}
- // TODO: Clarify if this needs to be saved here. crbug.com/223693
- rendering_stats_instrumentation_->AddRaster(
- base::TimeDelta(),
- content_rect.width() * content_rect.height(),
- false);
+ if (stats) {
+ stats->total_pixels_rasterized +=
+ content_rect.width() * content_rect.height();
+ }
PaintContents(canvas_.get(),
content_rect,
contents_width_scale,
contents_height_scale,
- resulting_opaque_rect);
+ resulting_opaque_rect,
+ stats);
}
void BitmapContentLayerUpdater::UpdateTexture(ResourceUpdateQueue* queue,
diff --git a/cc/resources/bitmap_content_layer_updater.h b/cc/resources/bitmap_content_layer_updater.h
index 9f62204..0597f82 100644
--- a/cc/resources/bitmap_content_layer_updater.h
+++ b/cc/resources/bitmap_content_layer_updater.h
@@ -13,7 +13,6 @@ 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
@@ -29,7 +28,8 @@ class CC_EXPORT BitmapContentLayerUpdater : public ContentLayerUpdater {
virtual void Update(ResourceUpdateQueue* queue,
gfx::Rect source_rect,
gfx::Vector2d dest_offset,
- bool partial_update) OVERRIDE;
+ bool partial_update,
+ RenderingStats* stats) OVERRIDE;
private:
BitmapContentLayerUpdater* updater_;
@@ -38,8 +38,7 @@ class CC_EXPORT BitmapContentLayerUpdater : public ContentLayerUpdater {
};
static scoped_refptr<BitmapContentLayerUpdater> Create(
- scoped_ptr<LayerPainter> painter,
- RenderingStatsInstrumentation* stats_instrumenation);
+ scoped_ptr<LayerPainter> painter);
virtual scoped_ptr<LayerUpdater::Resource> CreateResource(
PrioritizedResourceManager* manager) OVERRIDE;
@@ -47,7 +46,8 @@ class CC_EXPORT BitmapContentLayerUpdater : public ContentLayerUpdater {
gfx::Size tile_size,
float contents_width_scale,
float contents_height_scale,
- gfx::Rect* resulting_opaque_rect) OVERRIDE;
+ gfx::Rect* resulting_opaque_rect,
+ RenderingStats* stats) OVERRIDE;
void UpdateTexture(ResourceUpdateQueue* queue,
PrioritizedResource* resource,
gfx::Rect source_rect,
@@ -57,9 +57,7 @@ class CC_EXPORT BitmapContentLayerUpdater : public ContentLayerUpdater {
virtual void SetOpaque(bool opaque) OVERRIDE;
protected:
- BitmapContentLayerUpdater(
- scoped_ptr<LayerPainter> painter,
- RenderingStatsInstrumentation* stats_instrumenation);
+ explicit BitmapContentLayerUpdater(scoped_ptr<LayerPainter> painter);
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 455d7c9..e721891 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_instrumentation.h"
+#include "cc/debug/rendering_stats.h"
#include "cc/resources/layer_painter.h"
#include "cc/resources/prioritized_resource.h"
#include "cc/resources/resource_update_queue.h"
@@ -23,15 +23,20 @@ void BitmapSkPictureContentLayerUpdater::Resource::Update(
ResourceUpdateQueue* queue,
gfx::Rect source_rect,
gfx::Vector2d dest_offset,
- bool partial_update) {
+ bool partial_update,
+ RenderingStats* stats) {
bitmap_.setConfig(
SkBitmap::kARGB_8888_Config, source_rect.width(), source_rect.height());
bitmap_.allocPixels();
bitmap_.setIsOpaque(updater_->layer_is_opaque());
SkDevice device(bitmap_);
SkCanvas canvas(&device);
-
- updater_->PaintContentsRect(&canvas, source_rect);
+ base::TimeTicks paint_begin_time;
+ if (stats)
+ paint_begin_time = base::TimeTicks::Now();
+ updater_->PaintContentsRect(&canvas, source_rect, stats);
+ if (stats)
+ stats->total_paint_time += base::TimeTicks::Now() - paint_begin_time;
ResourceUpdate upload = ResourceUpdate::Create(
texture(), &bitmap_, source_rect, source_rect, dest_offset);
@@ -42,18 +47,14 @@ void BitmapSkPictureContentLayerUpdater::Resource::Update(
}
scoped_refptr<BitmapSkPictureContentLayerUpdater>
-BitmapSkPictureContentLayerUpdater::Create(
- scoped_ptr<LayerPainter> painter,
- RenderingStatsInstrumentation* stats_instrumentation) {
+BitmapSkPictureContentLayerUpdater::Create(scoped_ptr<LayerPainter> painter) {
return make_scoped_refptr(
- new BitmapSkPictureContentLayerUpdater(painter.Pass(),
- stats_instrumentation));
+ new BitmapSkPictureContentLayerUpdater(painter.Pass()));
}
BitmapSkPictureContentLayerUpdater::BitmapSkPictureContentLayerUpdater(
- scoped_ptr<LayerPainter> painter,
- RenderingStatsInstrumentation* stats_instrumentation)
- : SkPictureContentLayerUpdater(painter.Pass(), stats_instrumentation) {}
+ scoped_ptr<LayerPainter> painter)
+ : SkPictureContentLayerUpdater(painter.Pass()) {}
BitmapSkPictureContentLayerUpdater::~BitmapSkPictureContentLayerUpdater() {}
@@ -66,25 +67,21 @@ BitmapSkPictureContentLayerUpdater::CreateResource(
void BitmapSkPictureContentLayerUpdater::PaintContentsRect(
SkCanvas* canvas,
- gfx::Rect source_rect) {
+ gfx::Rect source_rect,
+ RenderingStats* stats) {
// 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());
-
- base::TimeTicks start_time =
- rendering_stats_instrumentation_->StartRecording();
-
+ base::TimeTicks rasterize_begin_time;
+ if (stats)
+ rasterize_begin_time = base::TimeTicks::Now();
DrawPicture(canvas);
-
- base::TimeDelta duration =
- rendering_stats_instrumentation_->EndRecording(start_time);
- rendering_stats_instrumentation_->AddRaster(
- duration,
- source_rect.width() * source_rect.height(),
- false);
-
- // TODO: Clarify if this needs to be saved here. crbug.com/223693
- rendering_stats_instrumentation_->AddPaint(duration, 0);
+ if (stats) {
+ stats->total_rasterize_time +=
+ base::TimeTicks::Now() - rasterize_begin_time;
+ stats->total_pixels_rasterized +=
+ source_rect.width() * source_rect.height();
+ }
}
} // namespace cc
diff --git a/cc/resources/bitmap_skpicture_content_layer_updater.h b/cc/resources/bitmap_skpicture_content_layer_updater.h
index 19458c1..63ca4a1 100644
--- a/cc/resources/bitmap_skpicture_content_layer_updater.h
+++ b/cc/resources/bitmap_skpicture_content_layer_updater.h
@@ -23,7 +23,8 @@ class BitmapSkPictureContentLayerUpdater : public SkPictureContentLayerUpdater {
virtual void Update(ResourceUpdateQueue* queue,
gfx::Rect source_rect,
gfx::Vector2d dest_offset,
- bool partial_update) OVERRIDE;
+ bool partial_update,
+ RenderingStats* stats) OVERRIDE;
private:
SkBitmap bitmap_;
@@ -33,18 +34,16 @@ class BitmapSkPictureContentLayerUpdater : public SkPictureContentLayerUpdater {
};
static scoped_refptr<BitmapSkPictureContentLayerUpdater> Create(
- scoped_ptr<LayerPainter> painter,
- RenderingStatsInstrumentation* stats_instrumentation);
+ scoped_ptr<LayerPainter> painter);
virtual scoped_ptr<LayerUpdater::Resource> CreateResource(
PrioritizedResourceManager* manager) OVERRIDE;
void PaintContentsRect(SkCanvas* canvas,
- gfx::Rect source_rect);
+ gfx::Rect source_rect,
+ RenderingStats* stats);
private:
- BitmapSkPictureContentLayerUpdater(
- scoped_ptr<LayerPainter> painter,
- RenderingStatsInstrumentation* stats_instrumentation);
+ explicit BitmapSkPictureContentLayerUpdater(scoped_ptr<LayerPainter> painter);
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 252388e..78f6097 100644
--- a/cc/resources/caching_bitmap_content_layer_updater.cc
+++ b/cc/resources/caching_bitmap_content_layer_updater.cc
@@ -11,19 +11,14 @@
namespace cc {
scoped_refptr<CachingBitmapContentLayerUpdater>
-CachingBitmapContentLayerUpdater::Create(
- scoped_ptr<LayerPainter> painter,
- RenderingStatsInstrumentation* stats_instrumentation) {
+CachingBitmapContentLayerUpdater::Create(scoped_ptr<LayerPainter> painter) {
return make_scoped_refptr(
- new CachingBitmapContentLayerUpdater(painter.Pass(),
- stats_instrumentation));
+ new CachingBitmapContentLayerUpdater(painter.Pass()));
}
CachingBitmapContentLayerUpdater::CachingBitmapContentLayerUpdater(
- scoped_ptr<LayerPainter> painter,
- RenderingStatsInstrumentation* stats_instrumentation)
- : BitmapContentLayerUpdater(painter.Pass(), stats_instrumentation),
- pixels_did_change_(false) {}
+ scoped_ptr<LayerPainter> painter)
+ : BitmapContentLayerUpdater(painter.Pass()), pixels_did_change_(false) {}
CachingBitmapContentLayerUpdater::~CachingBitmapContentLayerUpdater() {}
@@ -32,12 +27,14 @@ void CachingBitmapContentLayerUpdater::PrepareToUpdate(
gfx::Size tile_size,
float contents_width_scale,
float contents_height_scale,
- gfx::Rect* resulting_opaque_rect) {
+ gfx::Rect* resulting_opaque_rect,
+ RenderingStats* stats) {
BitmapContentLayerUpdater::PrepareToUpdate(content_rect,
tile_size,
contents_width_scale,
contents_height_scale,
- resulting_opaque_rect);
+ resulting_opaque_rect,
+ stats);
const SkBitmap& new_bitmap = canvas_->getDevice()->accessBitmap(false);
SkAutoLockPixels lock(new_bitmap);
diff --git a/cc/resources/caching_bitmap_content_layer_updater.h b/cc/resources/caching_bitmap_content_layer_updater.h
index e77ce0c..420d6d5 100644
--- a/cc/resources/caching_bitmap_content_layer_updater.h
+++ b/cc/resources/caching_bitmap_content_layer_updater.h
@@ -14,23 +14,21 @@ namespace cc {
class CachingBitmapContentLayerUpdater : public BitmapContentLayerUpdater {
public:
static scoped_refptr<CachingBitmapContentLayerUpdater> Create(
- scoped_ptr<LayerPainter>,
- RenderingStatsInstrumentation* stats_instrumentation);
+ scoped_ptr<LayerPainter>);
virtual void PrepareToUpdate(gfx::Rect content_rect,
gfx::Size tile_size,
float contents_width_scale,
float contents_height_scale,
- gfx::Rect* resulting_opaque_rect) OVERRIDE;
+ gfx::Rect* resulting_opaque_rect,
+ RenderingStats* stats) OVERRIDE;
bool pixels_did_change() const {
return pixels_did_change_;
}
private:
- CachingBitmapContentLayerUpdater(
- scoped_ptr<LayerPainter> painter,
- RenderingStatsInstrumentation* stats_instrumentation);
+ explicit CachingBitmapContentLayerUpdater(scoped_ptr<LayerPainter> painter);
virtual ~CachingBitmapContentLayerUpdater();
bool pixels_did_change_;
diff --git a/cc/resources/content_layer_updater.cc b/cc/resources/content_layer_updater.cc
index a1d9fdf..f11083b 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_instrumentation.h"
+#include "cc/debug/rendering_stats.h"
#include "cc/resources/layer_painter.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkPaint.h"
@@ -17,11 +17,8 @@
namespace cc {
-ContentLayerUpdater::ContentLayerUpdater(
- scoped_ptr<LayerPainter> painter,
- RenderingStatsInstrumentation* stats_instrumentation)
- : painter_(painter.Pass()),
- rendering_stats_instrumentation_(stats_instrumentation) {}
+ContentLayerUpdater::ContentLayerUpdater(scoped_ptr<LayerPainter> painter)
+ : painter_(painter.Pass()) {}
ContentLayerUpdater::~ContentLayerUpdater() {}
@@ -29,7 +26,8 @@ void ContentLayerUpdater::PaintContents(SkCanvas* canvas,
gfx::Rect content_rect,
float contents_width_scale,
float contents_height_scale,
- gfx::Rect* resulting_opaque_rect) {
+ gfx::Rect* resulting_opaque_rect,
+ RenderingStats* stats) {
TRACE_EVENT0("cc", "ContentLayerUpdater::PaintContents");
canvas->save();
canvas->translate(SkFloatToScalar(-content_rect.x()),
@@ -55,18 +53,14 @@ void ContentLayerUpdater::PaintContents(SkCanvas* canvas,
canvas->clipRect(layer_sk_rect);
gfx::RectF opaque_layer_rect;
-
- base::TimeTicks start_time =
- rendering_stats_instrumentation_->StartRecording();
-
+ base::TimeTicks paint_begin_time;
+ if (stats)
+ paint_begin_time = base::TimeTicks::Now();
painter_->Paint(canvas, layer_rect, &opaque_layer_rect);
-
- base::TimeDelta duration =
- rendering_stats_instrumentation_->EndRecording(start_time);
- rendering_stats_instrumentation_->AddPaint(
- duration,
- content_rect.width() * content_rect.height());
-
+ if (stats) {
+ stats->total_paint_time += base::TimeTicks::Now() - paint_begin_time;
+ stats->total_pixels_painted += content_rect.width() * content_rect.height();
+ }
canvas->restore();
gfx::RectF opaque_content_rect = gfx::ScaleRect(
diff --git a/cc/resources/content_layer_updater.h b/cc/resources/content_layer_updater.h
index ca1f6e4..80b8a48 100644
--- a/cc/resources/content_layer_updater.h
+++ b/cc/resources/content_layer_updater.h
@@ -14,26 +14,23 @@ 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:
- ContentLayerUpdater(scoped_ptr<LayerPainter> painter,
- RenderingStatsInstrumentation* stats_instrumentation);
+ explicit ContentLayerUpdater(scoped_ptr<LayerPainter> painter);
virtual ~ContentLayerUpdater();
void PaintContents(SkCanvas* canvas,
gfx::Rect content_rect,
float contents_width_scale,
float contents_height_scale,
- gfx::Rect* resulting_opaque_rect);
+ gfx::Rect* resulting_opaque_rect,
+ 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/image_layer_updater.cc b/cc/resources/image_layer_updater.cc
index 6e9cdfea..378490d 100644
--- a/cc/resources/image_layer_updater.cc
+++ b/cc/resources/image_layer_updater.cc
@@ -17,7 +17,8 @@ ImageLayerUpdater::Resource::~Resource() {}
void ImageLayerUpdater::Resource::Update(ResourceUpdateQueue* queue,
gfx::Rect source_rect,
gfx::Vector2d dest_offset,
- bool partial_update) {
+ bool partial_update,
+ RenderingStats*) {
updater_->UpdateTexture(
queue, texture(), source_rect, dest_offset, partial_update);
}
diff --git a/cc/resources/image_layer_updater.h b/cc/resources/image_layer_updater.h
index 6a47643..f9fca00 100644
--- a/cc/resources/image_layer_updater.h
+++ b/cc/resources/image_layer_updater.h
@@ -23,7 +23,8 @@ class ImageLayerUpdater : public LayerUpdater {
virtual void Update(ResourceUpdateQueue* queue,
gfx::Rect source_rect,
gfx::Vector2d dest_offset,
- bool partial_update) OVERRIDE;
+ bool partial_update,
+ RenderingStats* stats) OVERRIDE;
private:
ImageLayerUpdater* updater_;
diff --git a/cc/resources/layer_updater.h b/cc/resources/layer_updater.h
index 13359ff..a8b7657 100644
--- a/cc/resources/layer_updater.h
+++ b/cc/resources/layer_updater.h
@@ -17,6 +17,7 @@ class PrioritizedResource;
class PrioritizedResourceManager;
class ResourceUpdateQueue;
class TextureManager;
+struct RenderingStats;
class CC_EXPORT LayerUpdater : public base::RefCounted<LayerUpdater> {
public:
@@ -31,7 +32,8 @@ class CC_EXPORT LayerUpdater : public base::RefCounted<LayerUpdater> {
virtual void Update(ResourceUpdateQueue* queue,
gfx::Rect source_rect,
gfx::Vector2d dest_offset,
- bool partial_update) = 0;
+ bool partial_update,
+ RenderingStats* stats) = 0;
protected:
explicit Resource(scoped_ptr<PrioritizedResource> texture);
@@ -52,7 +54,8 @@ class CC_EXPORT LayerUpdater : public base::RefCounted<LayerUpdater> {
gfx::Size tile_size,
float contents_width_scale,
float contents_height_scale,
- gfx::Rect* resulting_opaque_rect) {}
+ gfx::Rect* resulting_opaque_rect,
+ RenderingStats* stats) {}
// Set true by the layer when it is known that the entire output is going to
// be opaque.
diff --git a/cc/resources/picture.cc b/cc/resources/picture.cc
index 9ace4d4..d3ddc53 100644
--- a/cc/resources/picture.cc
+++ b/cc/resources/picture.cc
@@ -3,7 +3,7 @@
// found in the LICENSE file.
#include "base/debug/trace_event.h"
-#include "cc/debug/rendering_stats_instrumentation.h"
+#include "cc/debug/rendering_stats.h"
#include "cc/layers/content_layer_client.h"
#include "cc/resources/picture.h"
#include "skia/ext/analysis_canvas.h"
@@ -79,7 +79,7 @@ void Picture::CloneForDrawing(int num_threads) {
}
void Picture::Record(ContentLayerClient* painter,
- RenderingStatsInstrumentation* stats_instrumentation,
+ RenderingStats* stats,
const SkTileGridPicture::TileGridInfo& tile_grid_info) {
TRACE_EVENT2("cc", "Picture::Record",
"width", layer_rect_.width(), "height", layer_rect_.height());
@@ -111,13 +111,15 @@ void Picture::Record(ContentLayerClient* painter,
canvas->drawRect(layer_skrect, paint);
gfx::RectF opaque_layer_rect;
- base::TimeTicks start_time = stats_instrumentation->StartRecording();
-
+ base::TimeTicks begin_paint_time;
+ if (stats)
+ begin_paint_time = base::TimeTicks::Now();
painter->PaintContents(canvas, layer_rect_, &opaque_layer_rect);
-
- base::TimeDelta duration = stats_instrumentation->EndRecording(start_time);
- stats_instrumentation->AddPaint(duration,
- layer_rect_.width() * layer_rect_.height());
+ if (stats) {
+ stats->total_paint_time += base::TimeTicks::Now() - begin_paint_time;
+ stats->total_pixels_painted +=
+ layer_rect_.width() * layer_rect_.height();
+ }
canvas->restore();
picture_->endRecording();
diff --git a/cc/resources/picture.h b/cc/resources/picture.h
index bb1a988..8598fbf 100644
--- a/cc/resources/picture.h
+++ b/cc/resources/picture.h
@@ -24,7 +24,7 @@ class AnalysisCanvas;
namespace cc {
class ContentLayerClient;
-class RenderingStatsInstrumentation;
+struct RenderingStats;
class CC_EXPORT Picture
: public base::RefCountedThreadSafe<Picture> {
@@ -43,9 +43,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* painter,
- RenderingStatsInstrumentation* stats_instrumentation,
- const SkTileGridPicture::TileGridInfo& tile_grid_info);
+ void Record(ContentLayerClient*, RenderingStats*,
+ const SkTileGridPicture::TileGridInfo& tile_grid_info);
// Has Record() been called yet?
bool HasRecording() const { return picture_.get() != NULL; }
diff --git a/cc/resources/picture_pile.cc b/cc/resources/picture_pile.cc
index bbb8f3d..85a2e9b 100644
--- a/cc/resources/picture_pile.cc
+++ b/cc/resources/picture_pile.cc
@@ -36,7 +36,7 @@ void PicturePile::Update(
SkColor background_color,
const Region& invalidation,
gfx::Rect visible_layer_rect,
- RenderingStatsInstrumentation* stats_instrumentation) {
+ RenderingStats* stats) {
background_color_ = background_color;
gfx::Rect interest_rect = visible_layer_rect;
@@ -103,7 +103,7 @@ void PicturePile::Update(
for (PictureList::iterator pic = pic_list.begin();
pic != pic_list.end(); ++pic) {
if (!(*pic)->HasRecording()) {
- (*pic)->Record(painter, stats_instrumentation, tile_grid_info_);
+ (*pic)->Record(painter, stats, tile_grid_info_);
(*pic)->CloneForDrawing(num_raster_threads_);
}
}
diff --git a/cc/resources/picture_pile.h b/cc/resources/picture_pile.h
index bfd88f8..cc92bf8 100644
--- a/cc/resources/picture_pile.h
+++ b/cc/resources/picture_pile.h
@@ -11,7 +11,7 @@
namespace cc {
class PicturePileImpl;
class Region;
-class RenderingStatsInstrumentation;
+struct RenderingStats;
class CC_EXPORT PicturePile : public PicturePileBase {
public:
@@ -24,7 +24,7 @@ class CC_EXPORT PicturePile : public PicturePileBase {
SkColor background_color,
const Region& invalidation,
gfx::Rect visible_layer_rect,
- RenderingStatsInstrumentation* stats_instrumentation);
+ RenderingStats* stats);
void set_num_raster_threads(int num_raster_threads) {
num_raster_threads_ = num_raster_threads;
diff --git a/cc/resources/picture_pile_impl.cc b/cc/resources/picture_pile_impl.cc
index 8b54c8a..4e425e5 100644
--- a/cc/resources/picture_pile_impl.cc
+++ b/cc/resources/picture_pile_impl.cc
@@ -5,6 +5,7 @@
#include "base/debug/trace_event.h"
#include "cc/base/region.h"
#include "cc/debug/debug_colors.h"
+#include "cc/debug/rendering_stats.h"
#include "cc/resources/picture_pile_impl.h"
#include "skia/ext/analysis_canvas.h"
#include "third_party/skia/include/core/SkCanvas.h"
diff --git a/cc/resources/picture_pile_impl.h b/cc/resources/picture_pile_impl.h
index a1a3c70..34364bd 100644
--- a/cc/resources/picture_pile_impl.h
+++ b/cc/resources/picture_pile_impl.h
@@ -16,6 +16,7 @@
#include "third_party/skia/include/core/SkPicture.h"
namespace cc {
+struct RenderingStats;
class CC_EXPORT PicturePileImpl : public PicturePileBase {
public:
diff --git a/cc/resources/skpicture_content_layer_updater.cc b/cc/resources/skpicture_content_layer_updater.cc
index 41b17b7..6ce3df8 100644
--- a/cc/resources/skpicture_content_layer_updater.cc
+++ b/cc/resources/skpicture_content_layer_updater.cc
@@ -22,25 +22,21 @@ SkPictureContentLayerUpdater::Resource::~Resource() {}
void SkPictureContentLayerUpdater::Resource::Update(ResourceUpdateQueue* queue,
gfx::Rect source_rect,
gfx::Vector2d dest_offset,
- bool partial_update) {
+ bool partial_update,
+ RenderingStats*) {
updater_->UpdateTexture(
queue, texture(), source_rect, dest_offset, partial_update);
}
SkPictureContentLayerUpdater::SkPictureContentLayerUpdater(
- scoped_ptr<LayerPainter> painter,
- RenderingStatsInstrumentation* stats_instrumentation)
- : ContentLayerUpdater(painter.Pass(), stats_instrumentation),
- layer_is_opaque_(false) {}
+ scoped_ptr<LayerPainter> painter)
+ : ContentLayerUpdater(painter.Pass()), layer_is_opaque_(false) {}
SkPictureContentLayerUpdater::~SkPictureContentLayerUpdater() {}
scoped_refptr<SkPictureContentLayerUpdater>
-SkPictureContentLayerUpdater::Create(
- scoped_ptr<LayerPainter> painter,
- RenderingStatsInstrumentation* stats_instrumentation) {
- return make_scoped_refptr(
- new SkPictureContentLayerUpdater(painter.Pass(), stats_instrumentation));
+SkPictureContentLayerUpdater::Create(scoped_ptr<LayerPainter> painter) {
+ return make_scoped_refptr(new SkPictureContentLayerUpdater(painter.Pass()));
}
scoped_ptr<LayerUpdater::Resource> SkPictureContentLayerUpdater::CreateResource(
@@ -54,14 +50,16 @@ void SkPictureContentLayerUpdater::PrepareToUpdate(
gfx::Size,
float contents_width_scale,
float contents_height_scale,
- gfx::Rect* resulting_opaque_rect) {
+ gfx::Rect* resulting_opaque_rect,
+ RenderingStats* stats) {
SkCanvas* canvas =
picture_.beginRecording(content_rect.width(), content_rect.height());
PaintContents(canvas,
content_rect,
contents_width_scale,
contents_height_scale,
- resulting_opaque_rect);
+ resulting_opaque_rect,
+ stats);
picture_.endRecording();
}
diff --git a/cc/resources/skpicture_content_layer_updater.h b/cc/resources/skpicture_content_layer_updater.h
index 3422b96..218bbc9 100644
--- a/cc/resources/skpicture_content_layer_updater.h
+++ b/cc/resources/skpicture_content_layer_updater.h
@@ -30,7 +30,8 @@ class SkPictureContentLayerUpdater : public ContentLayerUpdater {
virtual void Update(ResourceUpdateQueue* queue,
gfx::Rect source_rect,
gfx::Vector2d dest_offset,
- bool partial_update) OVERRIDE;
+ bool partial_update,
+ RenderingStats* stats) OVERRIDE;
private:
SkPictureContentLayerUpdater* updater_;
@@ -39,24 +40,22 @@ class SkPictureContentLayerUpdater : public ContentLayerUpdater {
};
static scoped_refptr<SkPictureContentLayerUpdater> Create(
- scoped_ptr<LayerPainter> painter,
- RenderingStatsInstrumentation* stats_instrumentation);
+ scoped_ptr<LayerPainter> painter);
virtual scoped_ptr<LayerUpdater::Resource> CreateResource(
PrioritizedResourceManager* manager) OVERRIDE;
virtual void SetOpaque(bool opaque) OVERRIDE;
protected:
- SkPictureContentLayerUpdater(
- scoped_ptr<LayerPainter> painter,
- RenderingStatsInstrumentation* stats_instrumentation);
+ explicit SkPictureContentLayerUpdater(scoped_ptr<LayerPainter> painter);
virtual ~SkPictureContentLayerUpdater();
virtual void PrepareToUpdate(gfx::Rect content_rect,
gfx::Size tile_size,
float contents_width_scale,
float contents_height_scale,
- gfx::Rect* resulting_opaque_rect) OVERRIDE;
+ gfx::Rect* resulting_opaque_rect,
+ RenderingStats* stats) OVERRIDE;
void DrawPicture(SkCanvas* canvas);
void UpdateTexture(ResourceUpdateQueue* queue,
PrioritizedResource* texture,
diff --git a/cc/test/fake_content_layer.cc b/cc/test/fake_content_layer.cc
index a30ea95..384521c 100644
--- a/cc/test/fake_content_layer.cc
+++ b/cc/test/fake_content_layer.cc
@@ -25,8 +25,9 @@ scoped_ptr<LayerImpl> FakeContentLayer::CreateLayerImpl(
}
void FakeContentLayer::Update(ResourceUpdateQueue* queue,
- const OcclusionTracker* occlusion) {
- ContentLayer::Update(queue, occlusion);
+ const OcclusionTracker* occlusion,
+ RenderingStats* stats) {
+ ContentLayer::Update(queue, occlusion, stats);
update_count_++;
}
diff --git a/cc/test/fake_content_layer.h b/cc/test/fake_content_layer.h
index cf8066a..52fea8f 100644
--- a/cc/test/fake_content_layer.h
+++ b/cc/test/fake_content_layer.h
@@ -24,7 +24,8 @@ class FakeContentLayer : public ContentLayer {
virtual void Update(
ResourceUpdateQueue* queue,
- const OcclusionTracker* occlusion) OVERRIDE;
+ const OcclusionTracker* occlusion,
+ RenderingStats* stats) OVERRIDE;
bool HaveBackingAt(int i, int j);
diff --git a/cc/test/fake_scrollbar_layer.cc b/cc/test/fake_scrollbar_layer.cc
index 457a5d1..96fbeec 100644
--- a/cc/test/fake_scrollbar_layer.cc
+++ b/cc/test/fake_scrollbar_layer.cc
@@ -31,10 +31,11 @@ FakeScrollbarLayer::FakeScrollbarLayer(bool paint_during_update,
FakeScrollbarLayer::~FakeScrollbarLayer() {}
void FakeScrollbarLayer::Update(ResourceUpdateQueue* queue,
- const OcclusionTracker* occlusion) {
+ const OcclusionTracker* occlusion,
+ RenderingStats* stats) {
size_t full = queue->FullUploadSize();
size_t partial = queue->PartialUploadSize();
- ScrollbarLayer::Update(queue, occlusion);
+ ScrollbarLayer::Update(queue, occlusion, stats);
update_count_++;
last_update_full_upload_size_ = queue->FullUploadSize() - full;
last_update_partial_upload_size_ = queue->PartialUploadSize() - partial;
diff --git a/cc/test/fake_scrollbar_layer.h b/cc/test/fake_scrollbar_layer.h
index 8d0d624..f06f752 100644
--- a/cc/test/fake_scrollbar_layer.h
+++ b/cc/test/fake_scrollbar_layer.h
@@ -29,7 +29,8 @@ class FakeScrollbarLayer : public ScrollbarLayer {
}
virtual void Update(ResourceUpdateQueue* queue,
- const OcclusionTracker* occlusion) OVERRIDE;
+ const OcclusionTracker* occlusion,
+ RenderingStats* stats) OVERRIDE;
private:
FakeScrollbarLayer(bool paint_during_update,
diff --git a/cc/test/tiled_layer_test_common.cc b/cc/test/tiled_layer_test_common.cc
index ece1ec6..ce3d365 100644
--- a/cc/test/tiled_layer_test_common.cc
+++ b/cc/test/tiled_layer_test_common.cc
@@ -18,7 +18,8 @@ FakeLayerUpdater::Resource::~Resource() {}
void FakeLayerUpdater::Resource::Update(ResourceUpdateQueue* queue,
gfx::Rect source_rect,
gfx::Vector2d dest_offset,
- bool partial_update) {
+ bool partial_update,
+ RenderingStats* stats) {
const gfx::Rect kRect(0, 0, 10, 10);
ResourceUpdate upload = ResourceUpdate::Create(
texture(), &bitmap_, kRect, kRect, gfx::Vector2d());
@@ -38,7 +39,8 @@ void FakeLayerUpdater::PrepareToUpdate(gfx::Rect content_rect,
gfx::Size tile_size,
float contents_width_scale,
float contents_height_scale,
- gfx::Rect* resulting_opaque_rect) {
+ gfx::Rect* resulting_opaque_rect,
+ RenderingStats* stats) {
prepare_count_++;
last_update_rect_ = content_rect;
if (!rect_to_invalidate_.IsEmpty()) {
diff --git a/cc/test/tiled_layer_test_common.h b/cc/test/tiled_layer_test_common.h
index 9e84e6e..11666d3 100644
--- a/cc/test/tiled_layer_test_common.h
+++ b/cc/test/tiled_layer_test_common.h
@@ -32,7 +32,8 @@ class FakeLayerUpdater : public LayerUpdater {
virtual void Update(ResourceUpdateQueue* queue,
gfx::Rect source_rect,
gfx::Vector2d dest_offset,
- bool partial_update) OVERRIDE;
+ bool partial_update,
+ RenderingStats* stats) OVERRIDE;
private:
FakeLayerUpdater* layer_;
@@ -50,7 +51,8 @@ class FakeLayerUpdater : public LayerUpdater {
gfx::Size tile_size,
float contents_width_scale,
float contents_height_scale,
- gfx::Rect* resulting_opaque_rect) OVERRIDE;
+ gfx::Rect* resulting_opaque_rect,
+ RenderingStats* stats) OVERRIDE;
// Sets the rect to invalidate during the next call to PrepareToUpdate().
// After the next call to PrepareToUpdate() the rect is reset.
void SetRectToInvalidate(gfx::Rect rect, FakeTiledLayer* layer);
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index 2ba6da2..16f6be7 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -829,7 +829,8 @@ size_t LayerTreeHost::CalculateMemoryForRenderSurfaces(
}
bool LayerTreeHost::PaintMasksForRenderSurface(Layer* render_surface_layer,
- ResourceUpdateQueue* queue) {
+ ResourceUpdateQueue* queue,
+ RenderingStats* stats) {
// Note: Masks and replicas only exist for layers that own render surfaces. If
// we reach this point in code, we already know that at least something will
// be drawn into this render surface, so the mask and replica should be
@@ -838,7 +839,7 @@ bool LayerTreeHost::PaintMasksForRenderSurface(Layer* render_surface_layer,
bool need_more_updates = false;
Layer* mask_layer = render_surface_layer->mask_layer();
if (mask_layer) {
- mask_layer->Update(queue, NULL);
+ mask_layer->Update(queue, NULL, stats);
need_more_updates |= mask_layer->NeedMoreUpdates();
}
@@ -846,7 +847,7 @@ bool LayerTreeHost::PaintMasksForRenderSurface(Layer* render_surface_layer,
render_surface_layer->replica_layer() ?
render_surface_layer->replica_layer()->mask_layer() : NULL;
if (replica_mask_layer) {
- replica_mask_layer->Update(queue, NULL);
+ replica_mask_layer->Update(queue, NULL, stats);
need_more_updates |= replica_mask_layer->NeedMoreUpdates();
}
return need_more_updates;
@@ -874,6 +875,11 @@ bool LayerTreeHost::PaintLayerContents(
PrioritizeTextures(render_surface_layer_list,
occlusion_tracker.overdraw_metrics());
+ // TODO(egraether): Use RenderingStatsInstrumentation in Layer::update()
+ RenderingStats stats;
+ RenderingStats* stats_ptr =
+ debug_state_.RecordRenderingStats() ? &stats : NULL;
+
LayerIteratorType end = LayerIteratorType::End(&render_surface_layer_list);
for (LayerIteratorType it =
LayerIteratorType::Begin(&render_surface_layer_list);
@@ -884,16 +890,18 @@ bool LayerTreeHost::PaintLayerContents(
if (it.represents_target_render_surface()) {
DCHECK(it->render_surface()->draw_opacity() ||
it->render_surface()->draw_opacity_is_animating());
- need_more_updates |= PaintMasksForRenderSurface(*it, queue);
+ need_more_updates |= PaintMasksForRenderSurface(*it, queue, stats_ptr);
} else if (it.represents_itself()) {
DCHECK(!it->bounds().IsEmpty());
- it->Update(queue, &occlusion_tracker);
+ it->Update(queue, &occlusion_tracker, stats_ptr);
need_more_updates |= it->NeedMoreUpdates();
}
occlusion_tracker.LeaveLayer(it);
}
+ rendering_stats_instrumentation_->AddStats(stats);
+
occlusion_tracker.overdraw_metrics()->RecordMetrics(this);
return need_more_updates;
diff --git a/cc/trees/layer_tree_host.h b/cc/trees/layer_tree_host.h
index 8f39439..220cbb5 100644
--- a/cc/trees/layer_tree_host.h
+++ b/cc/trees/layer_tree_host.h
@@ -255,7 +255,8 @@ class CC_EXPORT LayerTreeHost : NON_EXPORTED_BASE(public RateLimiterClient) {
bool PaintLayerContents(const LayerList& render_surface_layer_list,
ResourceUpdateQueue* quue);
bool PaintMasksForRenderSurface(Layer* render_surface_layer,
- ResourceUpdateQueue* queue);
+ ResourceUpdateQueue* queue,
+ RenderingStats* stats);
void UpdateLayers(Layer* root_layer, ResourceUpdateQueue* queue);
void UpdateHudLayer();
diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h
index 9a19950..3025832 100644
--- a/cc/trees/layer_tree_host_impl.h
+++ b/cc/trees/layer_tree_host_impl.h
@@ -449,6 +449,13 @@ class CC_EXPORT LayerTreeHostImpl : public InputHandlerClient,
scoped_ptr<MemoryHistory> memory_history_;
scoped_ptr<DebugRectHistory> debug_rect_history_;
+ int64 num_impl_thread_scrolls_;
+ int64 num_main_thread_scrolls_;
+
+ int64 cumulative_num_layers_drawn_;
+
+ int64 cumulative_num_missing_tiles_;
+
size_t last_sent_memory_visible_bytes_;
size_t last_sent_memory_visible_and_nearby_bytes_;
size_t last_sent_memory_use_bytes_;
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index 812297f..28a0ba7 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -563,8 +563,9 @@ class ContentLayerWithUpdateTracking : public ContentLayer {
void ResetPaintContentsCount() { paint_contents_count_ = 0; }
virtual void Update(ResourceUpdateQueue* queue,
- const OcclusionTracker* occlusion) OVERRIDE {
- ContentLayer::Update(queue, occlusion);
+ const OcclusionTracker* occlusion,
+ RenderingStats* stats) OVERRIDE {
+ ContentLayer::Update(queue, occlusion, stats);
paint_contents_count_++;
}
@@ -1229,7 +1230,8 @@ class EvictionTestLayer : public Layer {
}
virtual void Update(ResourceUpdateQueue*,
- const OcclusionTracker*) OVERRIDE;
+ const OcclusionTracker*,
+ RenderingStats*) OVERRIDE;
virtual bool DrawsContent() const OVERRIDE { return true; }
virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl)
@@ -1289,7 +1291,8 @@ void EvictionTestLayer::SetTexturePriorities(const PriorityCalculator&) {
}
void EvictionTestLayer::Update(ResourceUpdateQueue* queue,
- const OcclusionTracker*) {
+ const OcclusionTracker*,
+ RenderingStats*) {
CreateTextureIfNeeded();
if (!texture_.get())
return;
diff --git a/cc/trees/layer_tree_host_unittest_occlusion.cc b/cc/trees/layer_tree_host_unittest_occlusion.cc
index ced520c..8be65f1 100644
--- a/cc/trees/layer_tree_host_unittest_occlusion.cc
+++ b/cc/trees/layer_tree_host_unittest_occlusion.cc
@@ -19,7 +19,8 @@ class TestLayer : public Layer {
virtual void Update(
ResourceUpdateQueue* update_queue,
- const OcclusionTracker* occlusion) OVERRIDE {
+ const OcclusionTracker* occlusion,
+ RenderingStats* stats) OVERRIDE {
if (!occlusion)
return;
diff --git a/cc/trees/single_thread_proxy.cc b/cc/trees/single_thread_proxy.cc
index 8cde4fa..e63a8fc 100644
--- a/cc/trees/single_thread_proxy.cc
+++ b/cc/trees/single_thread_proxy.cc
@@ -29,7 +29,8 @@ SingleThreadProxy::SingleThreadProxy(LayerTreeHost* layer_tree_host)
created_offscreen_context_provider_(false),
renderer_initialized_(false),
next_frame_is_newly_committed_frame_(false),
- inside_draw_(false) {
+ inside_draw_(false),
+ total_commit_count_(0) {
TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy");
DCHECK(Proxy::IsMainThread());
DCHECK(layer_tree_host);
diff --git a/cc/trees/single_thread_proxy.h b/cc/trees/single_thread_proxy.h
index 140ef20..ff8a9d3 100644
--- a/cc/trees/single_thread_proxy.h
+++ b/cc/trees/single_thread_proxy.h
@@ -104,6 +104,9 @@ class SingleThreadProxy : public Proxy, LayerTreeHostImplClient {
bool inside_draw_;
+ base::TimeDelta total_commit_time_;
+ size_t total_commit_count_;
+
DISALLOW_COPY_AND_ASSIGN(SingleThreadProxy);
};