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

Side by Side Diff: cc/trees/occlusion_tracker_perftest.cc

Issue 202763002: Switch to use SharedBitmapManager all the time in cc_unittests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « cc/trees/layer_tree_host_unittest_scroll.cc ('k') | cc/trees/quad_culler_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/trees/occlusion_tracker.h" 5 #include "cc/trees/occlusion_tracker.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "cc/layers/layer_iterator.h" 8 #include "cc/layers/layer_iterator.h"
9 #include "cc/layers/solid_color_layer_impl.h" 9 #include "cc/layers/solid_color_layer_impl.h"
10 #include "cc/test/fake_layer_tree_host_impl_client.h" 10 #include "cc/test/fake_layer_tree_host_impl_client.h"
11 #include "cc/test/fake_output_surface.h" 11 #include "cc/test/fake_output_surface.h"
12 #include "cc/test/fake_proxy.h" 12 #include "cc/test/fake_proxy.h"
13 #include "cc/test/fake_rendering_stats_instrumentation.h" 13 #include "cc/test/fake_rendering_stats_instrumentation.h"
14 #include "cc/test/lap_timer.h" 14 #include "cc/test/lap_timer.h"
15 #include "cc/test/test_shared_bitmap_manager.h"
15 #include "cc/trees/layer_tree_host_impl.h" 16 #include "cc/trees/layer_tree_host_impl.h"
16 #include "cc/trees/layer_tree_impl.h" 17 #include "cc/trees/layer_tree_impl.h"
17 #include "cc/trees/single_thread_proxy.h" 18 #include "cc/trees/single_thread_proxy.h"
18 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
19 #include "testing/perf/perf_test.h" 20 #include "testing/perf/perf_test.h"
20 21
21 namespace cc { 22 namespace cc {
22 namespace { 23 namespace {
23 24
24 static const int kTimeLimitMillis = 2000; 25 static const int kTimeLimitMillis = 2000;
25 static const int kWarmupRuns = 5; 26 static const int kWarmupRuns = 5;
26 static const int kTimeCheckInterval = 10; 27 static const int kTimeCheckInterval = 10;
27 28
28 class OcclusionTrackerPerfTest : public testing::Test { 29 class OcclusionTrackerPerfTest : public testing::Test {
29 public: 30 public:
30 OcclusionTrackerPerfTest() 31 OcclusionTrackerPerfTest()
31 : timer_(kWarmupRuns, 32 : timer_(kWarmupRuns,
32 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), 33 base::TimeDelta::FromMilliseconds(kTimeLimitMillis),
33 kTimeCheckInterval), 34 kTimeCheckInterval),
34 impl_(&proxy_) {} 35 impl_(&proxy_) {}
35 void CreateHost() { 36 void CreateHost() {
36 LayerTreeSettings settings; 37 LayerTreeSettings settings;
38 shared_bitmap_manager_.reset(new TestSharedBitmapManager());
37 host_impl_ = LayerTreeHostImpl::Create( 39 host_impl_ = LayerTreeHostImpl::Create(
38 settings, &client_, &proxy_, &stats_, NULL, 1); 40 settings, &client_, &proxy_, &stats_, shared_bitmap_manager_.get(), 1);
39 host_impl_->InitializeRenderer( 41 host_impl_->InitializeRenderer(
40 FakeOutputSurface::Create3d().PassAs<OutputSurface>()); 42 FakeOutputSurface::Create3d().PassAs<OutputSurface>());
41 43
42 scoped_ptr<LayerImpl> root_layer = LayerImpl::Create(active_tree(), 1); 44 scoped_ptr<LayerImpl> root_layer = LayerImpl::Create(active_tree(), 1);
43 active_tree()->SetRootLayer(root_layer.Pass()); 45 active_tree()->SetRootLayer(root_layer.Pass());
44 } 46 }
45 47
46 LayerTreeImpl* active_tree() { return host_impl_->active_tree(); } 48 LayerTreeImpl* active_tree() { return host_impl_->active_tree(); }
47 49
48 void SetTestName(const std::string& name) { test_name_ = name; } 50 void SetTestName(const std::string& name) { test_name_ = name; }
49 51
50 void PrintResults() { 52 void PrintResults() {
51 CHECK(!test_name_.empty()) << "Must SetTestName() before AfterTest()."; 53 CHECK(!test_name_.empty()) << "Must SetTestName() before AfterTest().";
52 perf_test::PrintResult("occlusion_tracker_time", 54 perf_test::PrintResult("occlusion_tracker_time",
53 "", 55 "",
54 test_name_, 56 test_name_,
55 1000 * timer_.MsPerLap(), 57 1000 * timer_.MsPerLap(),
56 "us", 58 "us",
57 true); 59 true);
58 } 60 }
59 61
60 protected: 62 protected:
61 LapTimer timer_; 63 LapTimer timer_;
62 std::string test_name_; 64 std::string test_name_;
63 FakeLayerTreeHostImplClient client_; 65 FakeLayerTreeHostImplClient client_;
64 FakeProxy proxy_; 66 FakeProxy proxy_;
65 DebugScopedSetImplThread impl_; 67 DebugScopedSetImplThread impl_;
66 FakeRenderingStatsInstrumentation stats_; 68 FakeRenderingStatsInstrumentation stats_;
69 scoped_ptr<SharedBitmapManager> shared_bitmap_manager_;
67 scoped_ptr<LayerTreeHostImpl> host_impl_; 70 scoped_ptr<LayerTreeHostImpl> host_impl_;
68 }; 71 };
69 72
70 TEST_F(OcclusionTrackerPerfTest, UnoccludedContentRect_FullyOccluded) { 73 TEST_F(OcclusionTrackerPerfTest, UnoccludedContentRect_FullyOccluded) {
71 SetTestName("unoccluded_content_rect_fully_occluded"); 74 SetTestName("unoccluded_content_rect_fully_occluded");
72 75
73 gfx::Rect viewport_rect(768, 1038); 76 gfx::Rect viewport_rect(768, 1038);
74 OcclusionTracker<LayerImpl> tracker(viewport_rect); 77 OcclusionTracker<LayerImpl> tracker(viewport_rect);
75 78
76 CreateHost(); 79 CreateHost();
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 EXPECT_EQ(active_tree()->root_layer(), next.current_layer); 201 EXPECT_EQ(active_tree()->root_layer(), next.current_layer);
199 202
200 ++begin; 203 ++begin;
201 EXPECT_EQ(end, begin); 204 EXPECT_EQ(end, begin);
202 205
203 PrintResults(); 206 PrintResults();
204 } 207 }
205 208
206 } // namespace 209 } // namespace
207 } // namespace cc 210 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest_scroll.cc ('k') | cc/trees/quad_culler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698