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

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

Issue 1336733002: Re-land: cc: Implement shared worker contexts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix LayerTreeHostClientTakeAwayOutputSurface test. Content provider is always destroyed on the clie… Created 5 years, 3 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
« no previous file with comments | « cc/trees/layer_tree_impl_unittest.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"
(...skipping 17 matching lines...) Expand all
28 static const int kWarmupRuns = 5; 28 static const int kWarmupRuns = 5;
29 static const int kTimeCheckInterval = 10; 29 static const int kTimeCheckInterval = 10;
30 30
31 class OcclusionTrackerPerfTest : public testing::Test { 31 class OcclusionTrackerPerfTest : public testing::Test {
32 public: 32 public:
33 OcclusionTrackerPerfTest() 33 OcclusionTrackerPerfTest()
34 : timer_(kWarmupRuns, 34 : timer_(kWarmupRuns,
35 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), 35 base::TimeDelta::FromMilliseconds(kTimeLimitMillis),
36 kTimeCheckInterval), 36 kTimeCheckInterval),
37 proxy_(base::ThreadTaskRunnerHandle::Get(), nullptr), 37 proxy_(base::ThreadTaskRunnerHandle::Get(), nullptr),
38 impl_(&proxy_) {} 38 impl_(&proxy_),
39 output_surface_(FakeOutputSurface::Create3d()) {}
39 void CreateHost() { 40 void CreateHost() {
40 LayerTreeSettings settings; 41 LayerTreeSettings settings;
41 host_impl_ = LayerTreeHostImpl::Create(settings, &client_, &proxy_, &stats_, 42 host_impl_ = LayerTreeHostImpl::Create(settings, &client_, &proxy_, &stats_,
42 &shared_bitmap_manager_, nullptr, 43 &shared_bitmap_manager_, nullptr,
43 &task_graph_runner_, 1); 44 &task_graph_runner_, 1);
44 host_impl_->InitializeRenderer(FakeOutputSurface::Create3d()); 45 host_impl_->InitializeRenderer(output_surface_.get());
45 46
46 scoped_ptr<LayerImpl> root_layer = LayerImpl::Create(active_tree(), 1); 47 scoped_ptr<LayerImpl> root_layer = LayerImpl::Create(active_tree(), 1);
47 root_layer->SetHasRenderSurface(true); 48 root_layer->SetHasRenderSurface(true);
48 active_tree()->SetRootLayer(root_layer.Pass()); 49 active_tree()->SetRootLayer(root_layer.Pass());
49 } 50 }
50 51
51 LayerTreeImpl* active_tree() { return host_impl_->active_tree(); } 52 LayerTreeImpl* active_tree() { return host_impl_->active_tree(); }
52 53
53 void SetTestName(const std::string& name) { test_name_ = name; } 54 void SetTestName(const std::string& name) { test_name_ = name; }
54 55
55 void PrintResults() { 56 void PrintResults() {
56 CHECK(!test_name_.empty()) << "Must SetTestName() before AfterTest()."; 57 CHECK(!test_name_.empty()) << "Must SetTestName() before AfterTest().";
57 perf_test::PrintResult("occlusion_tracker_time", 58 perf_test::PrintResult("occlusion_tracker_time",
58 "", 59 "",
59 test_name_, 60 test_name_,
60 1000 * timer_.MsPerLap(), 61 1000 * timer_.MsPerLap(),
61 "us", 62 "us",
62 true); 63 true);
63 } 64 }
64 65
65 protected: 66 protected:
66 LapTimer timer_; 67 LapTimer timer_;
67 std::string test_name_; 68 std::string test_name_;
68 FakeLayerTreeHostImplClient client_; 69 FakeLayerTreeHostImplClient client_;
69 FakeProxy proxy_; 70 FakeProxy proxy_;
70 DebugScopedSetImplThread impl_; 71 DebugScopedSetImplThread impl_;
71 FakeRenderingStatsInstrumentation stats_; 72 FakeRenderingStatsInstrumentation stats_;
72 TestSharedBitmapManager shared_bitmap_manager_; 73 TestSharedBitmapManager shared_bitmap_manager_;
73 TestTaskGraphRunner task_graph_runner_; 74 TestTaskGraphRunner task_graph_runner_;
75 scoped_ptr<OutputSurface> output_surface_;
74 scoped_ptr<LayerTreeHostImpl> host_impl_; 76 scoped_ptr<LayerTreeHostImpl> host_impl_;
75 }; 77 };
76 78
77 TEST_F(OcclusionTrackerPerfTest, UnoccludedContentRect_FullyOccluded) { 79 TEST_F(OcclusionTrackerPerfTest, UnoccludedContentRect_FullyOccluded) {
78 SetTestName("unoccluded_content_rect_fully_occluded"); 80 SetTestName("unoccluded_content_rect_fully_occluded");
79 81
80 gfx::Rect viewport_rect(768, 1038); 82 gfx::Rect viewport_rect(768, 1038);
81 OcclusionTracker tracker(viewport_rect); 83 OcclusionTracker tracker(viewport_rect);
82 84
83 CreateHost(); 85 CreateHost();
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 EXPECT_EQ(active_tree()->root_layer(), next.current_layer); 206 EXPECT_EQ(active_tree()->root_layer(), next.current_layer);
205 207
206 ++begin; 208 ++begin;
207 EXPECT_EQ(end, begin); 209 EXPECT_EQ(end, begin);
208 210
209 PrintResults(); 211 PrintResults();
210 } 212 }
211 213
212 } // namespace 214 } // namespace
213 } // namespace cc 215 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_impl_unittest.cc ('k') | cc/trees/proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698