diff options
author | egraether@chromium.org <egraether@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-21 16:38:43 +0000 |
---|---|---|
committer | egraether@chromium.org <egraether@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-21 16:38:43 +0000 |
commit | 372bad5f74bce22b5a09ecba66744079e64dc477 (patch) | |
tree | 28131cc00e2a26dd6c906448803f67b271bfaed6 /cc/test | |
parent | d4062c83ab5f22fad6a3ffc3f1945373106bf517 (diff) | |
download | chromium_src-372bad5f74bce22b5a09ecba66744079e64dc477.zip chromium_src-372bad5f74bce22b5a09ecba66744079e64dc477.tar.gz chromium_src-372bad5f74bce22b5a09ecba66744079e64dc477.tar.bz2 |
cc:: Add RenderingStatsInstrumentation to manage collection of RenderingStats
This change adds the class RenderingStatsInstrumentation that manages conditional
saving and thread-specific access to a private RenderingStats instance.
An instance of RenderingStatsRecorder is created on LayerTreeHost, which
passes references to LayerTreeHostImpl and TileManager. Access to reading
and writing on the internal RenderingStats instance is guarded by a lock.
All rendering stats saving in LayerTreeHost, Single-/ThreadProxy,
LayerTreeHostImpl and TileManager has been switched to use the
RenderingStatsInstrumentation. Stats collection within Layer::update() still
follows the original structure to keep this change small.
BUG=181319
NOTRY=true
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=189475
Review URL: https://chromiumcodereview.appspot.com/12519006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@189621 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test')
-rw-r--r-- | cc/test/fake_layer_tree_host_impl.cc | 12 | ||||
-rw-r--r-- | cc/test/fake_layer_tree_host_impl.h | 2 | ||||
-rw-r--r-- | cc/test/fake_picture_layer_tiling_client.cc | 8 | ||||
-rw-r--r-- | cc/test/fake_picture_layer_tiling_client.h | 2 | ||||
-rw-r--r-- | cc/test/fake_proxy.h | 1 | ||||
-rw-r--r-- | cc/test/fake_rendering_stats_instrumentation.h | 20 | ||||
-rw-r--r-- | cc/test/layer_tree_test.cc | 31 |
7 files changed, 61 insertions, 15 deletions
diff --git a/cc/test/fake_layer_tree_host_impl.cc b/cc/test/fake_layer_tree_host_impl.cc index 334ff9f..f393f1d 100644 --- a/cc/test/fake_layer_tree_host_impl.cc +++ b/cc/test/fake_layer_tree_host_impl.cc @@ -7,7 +7,11 @@ namespace cc { FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(Proxy* proxy) - : LayerTreeHostImpl(LayerTreeSettings(), &client_, proxy) { + : LayerTreeHostImpl(LayerTreeSettings(), + &client_, + proxy, + &stats_instrumentation_) +{ // Explicitly clear all debug settings. SetDebugState(LayerTreeDebugState()); } @@ -15,7 +19,11 @@ FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(Proxy* proxy) FakeLayerTreeHostImpl::FakeLayerTreeHostImpl( const LayerTreeSettings& settings, Proxy* proxy) - : LayerTreeHostImpl(settings, &client_, proxy) { + : LayerTreeHostImpl(settings, + &client_, + proxy, + &stats_instrumentation_) +{ // Explicitly clear all debug settings. SetDebugState(LayerTreeDebugState()); } diff --git a/cc/test/fake_layer_tree_host_impl.h b/cc/test/fake_layer_tree_host_impl.h index 2023411..8ed07e8 100644 --- a/cc/test/fake_layer_tree_host_impl.h +++ b/cc/test/fake_layer_tree_host_impl.h @@ -6,6 +6,7 @@ #define CC_TEST_FAKE_LAYER_TREE_HOST_IMPL_H_ #include "cc/test/fake_layer_tree_host_impl_client.h" +#include "cc/test/fake_rendering_stats_instrumentation.h" #include "cc/trees/layer_tree_host_impl.h" #include "cc/trees/single_thread_proxy.h" @@ -27,6 +28,7 @@ class FakeLayerTreeHostImpl : public LayerTreeHostImpl { private: FakeLayerTreeHostImplClient client_; + FakeRenderingStatsInstrumentation stats_instrumentation_; }; } // namespace cc diff --git a/cc/test/fake_picture_layer_tiling_client.cc b/cc/test/fake_picture_layer_tiling_client.cc index 45c2640..2e96de6 100644 --- a/cc/test/fake_picture_layer_tiling_client.cc +++ b/cc/test/fake_picture_layer_tiling_client.cc @@ -20,7 +20,13 @@ class FakeInfinitePicturePileImpl : public PicturePileImpl { }; FakePictureLayerTilingClient::FakePictureLayerTilingClient() - : tile_manager_(&tile_manager_client_, NULL, 1, false, false, false), + : tile_manager_(&tile_manager_client_, + NULL, + 1, + false, + false, + false, + &stats_instrumentation_), pile_(new FakeInfinitePicturePileImpl()) { } diff --git a/cc/test/fake_picture_layer_tiling_client.h b/cc/test/fake_picture_layer_tiling_client.h index 9f2e77d..0dd9717 100644 --- a/cc/test/fake_picture_layer_tiling_client.h +++ b/cc/test/fake_picture_layer_tiling_client.h @@ -9,6 +9,7 @@ #include "cc/resources/picture_pile_impl.h" #include "cc/resources/tile.h" #include "cc/resources/tile_manager.h" +#include "cc/test/fake_rendering_stats_instrumentation.h" #include "cc/test/fake_tile_manager_client.h" #include "ui/gfx/rect.h" @@ -32,6 +33,7 @@ class FakePictureLayerTilingClient : public PictureLayerTilingClient { protected: FakeTileManagerClient tile_manager_client_; + FakeRenderingStatsInstrumentation stats_instrumentation_; TileManager tile_manager_; scoped_refptr<PicturePileImpl> pile_; gfx::Size tile_size_; diff --git a/cc/test/fake_proxy.h b/cc/test/fake_proxy.h index 3b84723..3be3f46 100644 --- a/cc/test/fake_proxy.h +++ b/cc/test/fake_proxy.h @@ -28,7 +28,6 @@ class FakeProxy : public Proxy { virtual void SetVisible(bool visible) OVERRIDE {} virtual bool InitializeRenderer() OVERRIDE; virtual bool RecreateOutputSurface() OVERRIDE; - virtual void CollectRenderingStats(RenderingStats* stats) OVERRIDE {} virtual const RendererCapabilities& GetRendererCapabilities() const OVERRIDE; virtual void SetNeedsAnimate() OVERRIDE {} virtual void SetNeedsCommit() OVERRIDE {} diff --git a/cc/test/fake_rendering_stats_instrumentation.h b/cc/test/fake_rendering_stats_instrumentation.h new file mode 100644 index 0000000..d32e4a0 --- /dev/null +++ b/cc/test/fake_rendering_stats_instrumentation.h @@ -0,0 +1,20 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CC_TEST_FAKE_RENDERING_STATS_INSTRUMENTATION_H_ +#define CC_TEST_FAKE_RENDERING_STATS_INSTRUMENTATION_H_ + +#include "cc/debug/rendering_stats_instrumentation.h" + +namespace cc { + +class FakeRenderingStatsInstrumentation : public RenderingStatsInstrumentation { + public: + FakeRenderingStatsInstrumentation() {} + virtual ~FakeRenderingStatsInstrumentation() {} +}; + +} // namespace cc + +#endif // CC_TEST_FAKE_RENDERING_STATS_INSTRUMENTATION_H_ diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc index bd281bc..f4f421d 100644 --- a/cc/test/layer_tree_test.cc +++ b/cc/test/layer_tree_test.cc @@ -69,19 +69,27 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl { TestHooks* test_hooks, const LayerTreeSettings& settings, LayerTreeHostImplClient* host_impl_client, - Proxy* proxy) { - return make_scoped_ptr(new LayerTreeHostImplForTesting(test_hooks, - settings, - host_impl_client, - proxy)); + Proxy* proxy, + RenderingStatsInstrumentation* stats_instrumentation) { + return make_scoped_ptr( + new LayerTreeHostImplForTesting(test_hooks, + settings, + host_impl_client, + proxy, + stats_instrumentation)); } protected: - LayerTreeHostImplForTesting(TestHooks* test_hooks, - const LayerTreeSettings& settings, - LayerTreeHostImplClient* host_impl_client, - Proxy* proxy) - : LayerTreeHostImpl(settings, host_impl_client, proxy), + LayerTreeHostImplForTesting( + TestHooks* test_hooks, + const LayerTreeSettings& settings, + LayerTreeHostImplClient* host_impl_client, + Proxy* proxy, + RenderingStatsInstrumentation* stats_instrumentation) + : LayerTreeHostImpl(settings, + host_impl_client, + proxy, + stats_instrumentation), test_hooks_(test_hooks) {} virtual void BeginCommit() OVERRIDE { @@ -191,7 +199,8 @@ class LayerTreeHostForTesting : public cc::LayerTreeHost { test_hooks_, settings(), host_impl_client, - proxy()).PassAs<cc::LayerTreeHostImpl>(); + proxy(), + rendering_stats_instrumentation()).PassAs<cc::LayerTreeHostImpl>(); } virtual void SetNeedsCommit() OVERRIDE { |