summaryrefslogtreecommitdiffstats
path: root/cc/test/fake_picture_layer.h
diff options
context:
space:
mode:
authordanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-17 22:53:03 +0000
committerdanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-17 22:53:03 +0000
commit232576862622e4327e996e34faf684b29d8d4ed6 (patch)
treeea01b04569eaa856228579249742d6e1b3ec433f /cc/test/fake_picture_layer.h
parente7370aeb6fe2b18fa3e46f5e87196cc1563f4d97 (diff)
downloadchromium_src-232576862622e4327e996e34faf684b29d8d4ed6.zip
chromium_src-232576862622e4327e996e34faf684b29d8d4ed6.tar.gz
chromium_src-232576862622e4327e996e34faf684b29d8d4ed6.tar.bz2
cc: Cache the twin tree's layer in PictureLayerImpl.
The PictureLayerImpl uses its twin layer to do various things and every time it wants to find its twin, it has to go through the LayerTreeImpl and its hash map. Specifically, every time we create a Tile, we check make use of the layer's twin, so we do this same lookup hundreds of times per layer in order to UpdateTilePriorities. This change makes PictureLayerImpl compute the twin layer once and save it. The ImplSidePaintingPerfTest.HeavyPage perf test shows the improvement with a 10% reduction in time. Before: *RESULT heavy_layer_tree: commit_cost= 0.97 ms/commit After: *RESULT heavy_layer_tree: commit_cost= 0.89 ms/commit Tests: LayerTreeHostPictureTestTwinLayer R=enne BUG=239684 NOTRY=true Review URL: https://chromiumcodereview.appspot.com/15115004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@200914 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test/fake_picture_layer.h')
-rw-r--r--cc/test/fake_picture_layer.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/cc/test/fake_picture_layer.h b/cc/test/fake_picture_layer.h
new file mode 100644
index 0000000..b1a9eab
--- /dev/null
+++ b/cc/test/fake_picture_layer.h
@@ -0,0 +1,40 @@
+// Copyright 2012 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_PICTURE_LAYER_H_
+#define CC_TEST_FAKE_PICTURE_LAYER_H_
+
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "cc/layers/picture_layer.h"
+
+namespace cc {
+
+class FakePictureLayer : public PictureLayer {
+ public:
+ static scoped_refptr<FakePictureLayer> Create(ContentLayerClient* client) {
+ return make_scoped_refptr(new FakePictureLayer(client));
+ }
+
+ virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl)
+ OVERRIDE;
+
+ size_t update_count() const { return update_count_; }
+ void reset_update_count() { update_count_ = 0; }
+
+ virtual void Update(
+ ResourceUpdateQueue* queue,
+ const OcclusionTracker* occlusion,
+ RenderingStats* stats) OVERRIDE;
+
+ private:
+ explicit FakePictureLayer(ContentLayerClient* client);
+ virtual ~FakePictureLayer();
+
+ size_t update_count_;
+};
+
+} // namespace cc
+
+#endif // CC_TEST_FAKE_PICTURE_LAYER_H_