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

Side by Side Diff: cc/resources/raster_worker_pool_perftest.cc

Issue 523243002: cc: Generalize raster task notifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove obsolete HasPendingTasks Created 6 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
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/resources/raster_worker_pool.h" 5 #include "cc/resources/raster_worker_pool.h"
6 6
7 #include "base/test/test_simple_task_runner.h" 7 #include "base/test/test_simple_task_runner.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/output/context_provider.h" 10 #include "cc/output/context_provider.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 private: 140 private:
141 scoped_ptr<ScopedResource> resource_; 141 scoped_ptr<ScopedResource> resource_;
142 142
143 DISALLOW_COPY_AND_ASSIGN(PerfRasterTaskImpl); 143 DISALLOW_COPY_AND_ASSIGN(PerfRasterTaskImpl);
144 }; 144 };
145 145
146 class RasterWorkerPoolPerfTestBase { 146 class RasterWorkerPoolPerfTestBase {
147 public: 147 public:
148 typedef std::vector<scoped_refptr<RasterTask> > RasterTaskVector; 148 typedef std::vector<scoped_refptr<RasterTask> > RasterTaskVector;
149 149
150 enum NamedTaskSet {
151 HIGH_RESOLUTION_IN_NOW_BIN_ON_ACTIVE_TREE = 0,
152 REQUIRED_FOR_ACTIVATION = 1,
153 ALL = 2
154 };
155
150 RasterWorkerPoolPerfTestBase() 156 RasterWorkerPoolPerfTestBase()
151 : context_provider_(make_scoped_refptr(new PerfContextProvider)), 157 : context_provider_(make_scoped_refptr(new PerfContextProvider)),
152 task_runner_(new base::TestSimpleTaskRunner), 158 task_runner_(new base::TestSimpleTaskRunner),
153 task_graph_runner_(new TaskGraphRunner), 159 task_graph_runner_(new TaskGraphRunner),
154 timer_(kWarmupRuns, 160 timer_(kWarmupRuns,
155 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), 161 base::TimeDelta::FromMilliseconds(kTimeLimitMillis),
156 kTimeCheckInterval) { 162 kTimeCheckInterval) {
157 output_surface_ = FakeOutputSurface::Create3d(context_provider_).Pass(); 163 output_surface_ = FakeOutputSurface::Create3d(context_provider_).Pass();
158 CHECK(output_surface_->BindToClient(&output_surface_client_)); 164 CHECK(output_surface_->BindToClient(&output_surface_client_));
159 165
(...skipping 29 matching lines...) Expand all
189 ImageDecodeTask::Vector dependencies = image_decode_tasks; 195 ImageDecodeTask::Vector dependencies = image_decode_tasks;
190 raster_tasks->push_back( 196 raster_tasks->push_back(
191 new PerfRasterTaskImpl(resource.Pass(), &dependencies)); 197 new PerfRasterTaskImpl(resource.Pass(), &dependencies));
192 } 198 }
193 } 199 }
194 200
195 void BuildRasterTaskQueue(RasterTaskQueue* queue, 201 void BuildRasterTaskQueue(RasterTaskQueue* queue,
196 const RasterTaskVector& raster_tasks) { 202 const RasterTaskVector& raster_tasks) {
197 for (size_t i = 0u; i < raster_tasks.size(); ++i) { 203 for (size_t i = 0u; i < raster_tasks.size(); ++i) {
198 bool required_for_activation = (i % 2) == 0; 204 bool required_for_activation = (i % 2) == 0;
199 queue->items.push_back(RasterTaskQueue::Item(raster_tasks[i].get(), 205 TaskSetCollection task_set_collection;
200 required_for_activation)); 206 task_set_collection[ALL] = true;
201 queue->required_for_activation_count += required_for_activation; 207 task_set_collection[REQUIRED_FOR_ACTIVATION] = required_for_activation;
208 queue->items.push_back(
209 RasterTaskQueue::Item(raster_tasks[i].get(), task_set_collection));
202 } 210 }
203 } 211 }
204 212
205 protected: 213 protected:
206 scoped_refptr<ContextProvider> context_provider_; 214 scoped_refptr<ContextProvider> context_provider_;
207 FakeOutputSurfaceClient output_surface_client_; 215 FakeOutputSurfaceClient output_surface_client_;
208 scoped_ptr<FakeOutputSurface> output_surface_; 216 scoped_ptr<FakeOutputSurface> output_surface_;
209 scoped_ptr<SharedBitmapManager> shared_bitmap_manager_; 217 scoped_ptr<SharedBitmapManager> shared_bitmap_manager_;
210 scoped_ptr<ResourceProvider> resource_provider_; 218 scoped_ptr<ResourceProvider> resource_provider_;
211 scoped_ptr<ResourcePool> staging_resource_pool_; 219 scoped_ptr<ResourcePool> staging_resource_pool_;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 raster_worker_pool_->AsRasterizer()->SetClient(this); 263 raster_worker_pool_->AsRasterizer()->SetClient(this);
256 } 264 }
257 265
258 // Overridden from testing::Test: 266 // Overridden from testing::Test:
259 virtual void TearDown() OVERRIDE { 267 virtual void TearDown() OVERRIDE {
260 raster_worker_pool_->AsRasterizer()->Shutdown(); 268 raster_worker_pool_->AsRasterizer()->Shutdown();
261 raster_worker_pool_->AsRasterizer()->CheckForCompletedTasks(); 269 raster_worker_pool_->AsRasterizer()->CheckForCompletedTasks();
262 } 270 }
263 271
264 // Overriden from RasterizerClient: 272 // Overriden from RasterizerClient:
265 virtual bool ShouldForceTasksRequiredForActivationToComplete() const 273 virtual void DidFinishRunningTaskSet(TaskSet task_set) OVERRIDE {
266 OVERRIDE { 274 if (task_set == ALL)
267 return false; 275 raster_worker_pool_->AsRasterizer()->CheckForCompletedTasks();
268 } 276 }
269 virtual void DidFinishRunningTasks() OVERRIDE { 277 virtual TaskSetCollection TasksThatShouldBeForcedToComplete() const OVERRIDE {
270 raster_worker_pool_->AsRasterizer()->CheckForCompletedTasks(); 278 return TaskSetCollection();
271 } 279 }
272 virtual void DidFinishRunningTasksRequiredForActivation() OVERRIDE {} 280 virtual base::debug::TraceEventSyntheticDelay* SyntheticDelayForTaskSet(
281 TaskSet task_set) const OVERRIDE {
282 return NULL;
283 }
273 284
274 void RunMessageLoopUntilAllTasksHaveCompleted() { 285 void RunMessageLoopUntilAllTasksHaveCompleted() {
275 task_graph_runner_->RunUntilIdle(); 286 task_graph_runner_->RunUntilIdle();
276 task_runner_->RunUntilIdle(); 287 task_runner_->RunUntilIdle();
277 } 288 }
278 289
279 void RunScheduleTasksTest(const std::string& test_name, 290 void RunScheduleTasksTest(const std::string& test_name,
280 unsigned num_raster_tasks, 291 unsigned num_raster_tasks,
281 unsigned num_image_decode_tasks) { 292 unsigned num_image_decode_tasks) {
282 ImageDecodeTask::Vector image_decode_tasks; 293 ImageDecodeTask::Vector image_decode_tasks;
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 RunBuildRasterTaskQueueTest("1_0", 1, 0); 476 RunBuildRasterTaskQueueTest("1_0", 1, 0);
466 RunBuildRasterTaskQueueTest("32_0", 32, 0); 477 RunBuildRasterTaskQueueTest("32_0", 32, 0);
467 RunBuildRasterTaskQueueTest("1_1", 1, 1); 478 RunBuildRasterTaskQueueTest("1_1", 1, 1);
468 RunBuildRasterTaskQueueTest("32_1", 32, 1); 479 RunBuildRasterTaskQueueTest("32_1", 32, 1);
469 RunBuildRasterTaskQueueTest("1_4", 1, 4); 480 RunBuildRasterTaskQueueTest("1_4", 1, 4);
470 RunBuildRasterTaskQueueTest("32_4", 32, 4); 481 RunBuildRasterTaskQueueTest("32_4", 32, 4);
471 } 482 }
472 483
473 } // namespace 484 } // namespace
474 } // namespace cc 485 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698