Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 12426024: cc: Switch RenderingStats collection in Layer::Update() to RenderingStatsInstrumentation (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/layers/picture_layer_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include "cc/layers/picture_layer.h" 7 #include "cc/layers/picture_layer.h"
8 #include "cc/test/fake_content_layer_client.h" 8 #include "cc/test/fake_content_layer_client.h"
9 #include "cc/test/fake_impl_proxy.h" 9 #include "cc/test/fake_impl_proxy.h"
10 #include "cc/test/fake_layer_tree_host_impl.h" 10 #include "cc/test/fake_layer_tree_host_impl.h"
11 #include "cc/test/fake_output_surface.h" 11 #include "cc/test/fake_output_surface.h"
12 #include "cc/test/fake_rendering_stats_instrumentation.h"
12 #include "cc/trees/layer_tree_impl.h" 13 #include "cc/trees/layer_tree_impl.h"
13 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
14 #include "third_party/skia/include/core/SkDevice.h" 15 #include "third_party/skia/include/core/SkDevice.h"
15 #include "ui/gfx/rect_conversions.h" 16 #include "ui/gfx/rect_conversions.h"
16 17
17 namespace cc { 18 namespace cc {
18 namespace { 19 namespace {
19 20
20 class TestablePictureLayerImpl : public PictureLayerImpl { 21 class TestablePictureLayerImpl : public PictureLayerImpl {
21 public: 22 public:
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 void AddRecordingAt(int x, int y) { 94 void AddRecordingAt(int x, int y) {
94 EXPECT_GE(x, 0); 95 EXPECT_GE(x, 0);
95 EXPECT_GE(y, 0); 96 EXPECT_GE(y, 0);
96 EXPECT_LT(x, tiling_.num_tiles_x()); 97 EXPECT_LT(x, tiling_.num_tiles_x());
97 EXPECT_LT(y, tiling_.num_tiles_y()); 98 EXPECT_LT(y, tiling_.num_tiles_y());
98 99
99 if (HasRecordingAt(x, y)) 100 if (HasRecordingAt(x, y))
100 return; 101 return;
101 gfx::Rect bounds(tiling().TileBounds(x, y)); 102 gfx::Rect bounds(tiling().TileBounds(x, y));
102 scoped_refptr<Picture> picture(Picture::Create(bounds)); 103 scoped_refptr<Picture> picture(Picture::Create(bounds));
103 picture->Record(&client_, NULL, tile_grid_info_); 104 FakeRenderingStatsInstrumentation stats_instrumentation;
105 picture->Record(&client_, &stats_instrumentation, tile_grid_info_);
104 picture_list_map_[std::pair<int, int>(x, y)].push_back(picture); 106 picture_list_map_[std::pair<int, int>(x, y)].push_back(picture);
105 EXPECT_TRUE(HasRecordingAt(x, y)); 107 EXPECT_TRUE(HasRecordingAt(x, y));
106 108
107 UpdateRecordedRegion(); 109 UpdateRecordedRegion();
108 } 110 }
109 111
110 void RemoveRecordingAt(int x, int y) { 112 void RemoveRecordingAt(int x, int y) {
111 EXPECT_GE(x, 0); 113 EXPECT_GE(x, 0);
112 EXPECT_GE(y, 0); 114 EXPECT_GE(y, 0);
113 EXPECT_LT(x, tiling_.num_tiles_x()); 115 EXPECT_LT(x, tiling_.num_tiles_x());
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 used_tilings.push_back(active_layer_->tilings().tiling_at(1)); 695 used_tilings.push_back(active_layer_->tilings().tiling_at(1));
694 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); 696 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
695 ASSERT_EQ(3u, active_layer_->tilings().num_tilings()); 697 ASSERT_EQ(3u, active_layer_->tilings().num_tilings());
696 used_tilings.clear(); 698 used_tilings.clear();
697 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); 699 active_layer_->CleanUpTilingsOnActiveLayer(used_tilings);
698 ASSERT_EQ(2u, active_layer_->tilings().num_tilings()); 700 ASSERT_EQ(2u, active_layer_->tilings().num_tilings());
699 } 701 }
700 702
701 } // namespace 703 } // namespace
702 } // namespace cc 704 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698