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

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

Issue 1419283002: cc: Split Proxy and TaskRunnerProvider for the LayerTreeHost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 5 years, 1 month 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
« no previous file with comments | « cc/trees/layer_tree_host_unittest_proxy.cc ('k') | cc/trees/proxy.h » ('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/thread_task_runner_handle.h" 7 #include "base/thread_task_runner_handle.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "cc/debug/lap_timer.h" 9 #include "cc/debug/lap_timer.h"
10 #include "cc/layers/layer_iterator.h" 10 #include "cc/layers/layer_iterator.h"
11 #include "cc/layers/solid_color_layer_impl.h" 11 #include "cc/layers/solid_color_layer_impl.h"
12 #include "cc/test/fake_impl_task_runner_provider.h"
12 #include "cc/test/fake_layer_tree_host_impl_client.h" 13 #include "cc/test/fake_layer_tree_host_impl_client.h"
13 #include "cc/test/fake_output_surface.h" 14 #include "cc/test/fake_output_surface.h"
14 #include "cc/test/fake_proxy.h" 15 #include "cc/test/fake_proxy.h"
15 #include "cc/test/fake_rendering_stats_instrumentation.h" 16 #include "cc/test/fake_rendering_stats_instrumentation.h"
16 #include "cc/test/test_shared_bitmap_manager.h" 17 #include "cc/test/test_shared_bitmap_manager.h"
17 #include "cc/test/test_task_graph_runner.h" 18 #include "cc/test/test_task_graph_runner.h"
18 #include "cc/trees/layer_tree_host_impl.h" 19 #include "cc/trees/layer_tree_host_impl.h"
19 #include "cc/trees/layer_tree_impl.h" 20 #include "cc/trees/layer_tree_impl.h"
20 #include "cc/trees/single_thread_proxy.h" 21 #include "cc/trees/single_thread_proxy.h"
21 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
22 #include "testing/perf/perf_test.h" 23 #include "testing/perf/perf_test.h"
23 24
24 namespace cc { 25 namespace cc {
25 namespace { 26 namespace {
26 27
27 static const int kTimeLimitMillis = 2000; 28 static const int kTimeLimitMillis = 2000;
28 static const int kWarmupRuns = 5; 29 static const int kWarmupRuns = 5;
29 static const int kTimeCheckInterval = 10; 30 static const int kTimeCheckInterval = 10;
30 31
31 class OcclusionTrackerPerfTest : public testing::Test { 32 class OcclusionTrackerPerfTest : public testing::Test {
32 public: 33 public:
33 OcclusionTrackerPerfTest() 34 OcclusionTrackerPerfTest()
34 : timer_(kWarmupRuns, 35 : timer_(kWarmupRuns,
35 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), 36 base::TimeDelta::FromMilliseconds(kTimeLimitMillis),
36 kTimeCheckInterval), 37 kTimeCheckInterval),
37 proxy_(base::ThreadTaskRunnerHandle::Get(), nullptr),
38 impl_(&proxy_),
39 output_surface_(FakeOutputSurface::Create3d()) {} 38 output_surface_(FakeOutputSurface::Create3d()) {}
40 void CreateHost() { 39 void CreateHost() {
41 LayerTreeSettings settings; 40 LayerTreeSettings settings;
42 host_impl_ = LayerTreeHostImpl::Create(settings, &client_, &proxy_, &stats_, 41 host_impl_ = LayerTreeHostImpl::Create(
43 &shared_bitmap_manager_, nullptr, 42 settings, &client_, &impl_task_runner_provider_, &stats_,
44 &task_graph_runner_, 1); 43 &shared_bitmap_manager_, nullptr, &task_graph_runner_, 1);
45 host_impl_->SetVisible(true); 44 host_impl_->SetVisible(true);
46 host_impl_->InitializeRenderer(output_surface_.get()); 45 host_impl_->InitializeRenderer(output_surface_.get());
47 46
48 scoped_ptr<LayerImpl> root_layer = LayerImpl::Create(active_tree(), 1); 47 scoped_ptr<LayerImpl> root_layer = LayerImpl::Create(active_tree(), 1);
49 root_layer->SetHasRenderSurface(true); 48 root_layer->SetHasRenderSurface(true);
50 active_tree()->SetRootLayer(root_layer.Pass()); 49 active_tree()->SetRootLayer(root_layer.Pass());
51 } 50 }
52 51
53 LayerTreeImpl* active_tree() { return host_impl_->active_tree(); } 52 LayerTreeImpl* active_tree() { return host_impl_->active_tree(); }
54 53
55 void SetTestName(const std::string& name) { test_name_ = name; } 54 void SetTestName(const std::string& name) { test_name_ = name; }
56 55
57 void PrintResults() { 56 void PrintResults() {
58 CHECK(!test_name_.empty()) << "Must SetTestName() before AfterTest()."; 57 CHECK(!test_name_.empty()) << "Must SetTestName() before AfterTest().";
59 perf_test::PrintResult("occlusion_tracker_time", 58 perf_test::PrintResult("occlusion_tracker_time",
60 "", 59 "",
61 test_name_, 60 test_name_,
62 1000 * timer_.MsPerLap(), 61 1000 * timer_.MsPerLap(),
63 "us", 62 "us",
64 true); 63 true);
65 } 64 }
66 65
67 protected: 66 protected:
68 LapTimer timer_; 67 LapTimer timer_;
69 std::string test_name_; 68 std::string test_name_;
70 FakeLayerTreeHostImplClient client_; 69 FakeLayerTreeHostImplClient client_;
71 FakeProxy proxy_; 70 FakeImplTaskRunnerProvider impl_task_runner_provider_;
72 DebugScopedSetImplThread impl_;
73 FakeRenderingStatsInstrumentation stats_; 71 FakeRenderingStatsInstrumentation stats_;
74 TestSharedBitmapManager shared_bitmap_manager_; 72 TestSharedBitmapManager shared_bitmap_manager_;
75 TestTaskGraphRunner task_graph_runner_; 73 TestTaskGraphRunner task_graph_runner_;
76 scoped_ptr<OutputSurface> output_surface_; 74 scoped_ptr<OutputSurface> output_surface_;
77 scoped_ptr<LayerTreeHostImpl> host_impl_; 75 scoped_ptr<LayerTreeHostImpl> host_impl_;
78 }; 76 };
79 77
80 TEST_F(OcclusionTrackerPerfTest, UnoccludedContentRect_FullyOccluded) { 78 TEST_F(OcclusionTrackerPerfTest, UnoccludedContentRect_FullyOccluded) {
81 SetTestName("unoccluded_content_rect_fully_occluded"); 79 SetTestName("unoccluded_content_rect_fully_occluded");
82 80
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 EXPECT_EQ(active_tree()->root_layer(), next.current_layer); 205 EXPECT_EQ(active_tree()->root_layer(), next.current_layer);
208 206
209 ++begin; 207 ++begin;
210 EXPECT_EQ(end, begin); 208 EXPECT_EQ(end, begin);
211 209
212 PrintResults(); 210 PrintResults();
213 } 211 }
214 212
215 } // namespace 213 } // namespace
216 } // namespace cc 214 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest_proxy.cc ('k') | cc/trees/proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698