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

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: clean-ups 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 { REQUIRED_FOR_ACTIVATION = 0, ALL = 1 };
151
150 RasterWorkerPoolPerfTestBase() 152 RasterWorkerPoolPerfTestBase()
151 : context_provider_(make_scoped_refptr(new PerfContextProvider)), 153 : context_provider_(make_scoped_refptr(new PerfContextProvider)),
152 task_runner_(new base::TestSimpleTaskRunner), 154 task_runner_(new base::TestSimpleTaskRunner),
153 task_graph_runner_(new TaskGraphRunner), 155 task_graph_runner_(new TaskGraphRunner),
154 timer_(kWarmupRuns, 156 timer_(kWarmupRuns,
155 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), 157 base::TimeDelta::FromMilliseconds(kTimeLimitMillis),
156 kTimeCheckInterval) { 158 kTimeCheckInterval) {
157 output_surface_ = FakeOutputSurface::Create3d(context_provider_).Pass(); 159 output_surface_ = FakeOutputSurface::Create3d(context_provider_).Pass();
158 CHECK(output_surface_->BindToClient(&output_surface_client_)); 160 CHECK(output_surface_->BindToClient(&output_surface_client_));
159 161
(...skipping 29 matching lines...) Expand all
189 ImageDecodeTask::Vector dependencies = image_decode_tasks; 191 ImageDecodeTask::Vector dependencies = image_decode_tasks;
190 raster_tasks->push_back( 192 raster_tasks->push_back(
191 new PerfRasterTaskImpl(resource.Pass(), &dependencies)); 193 new PerfRasterTaskImpl(resource.Pass(), &dependencies));
192 } 194 }
193 } 195 }
194 196
195 void BuildRasterTaskQueue(RasterTaskQueue* queue, 197 void BuildRasterTaskQueue(RasterTaskQueue* queue,
196 const RasterTaskVector& raster_tasks) { 198 const RasterTaskVector& raster_tasks) {
197 for (size_t i = 0u; i < raster_tasks.size(); ++i) { 199 for (size_t i = 0u; i < raster_tasks.size(); ++i) {
198 bool required_for_activation = (i % 2) == 0; 200 bool required_for_activation = (i % 2) == 0;
199 queue->items.push_back(RasterTaskQueue::Item(raster_tasks[i].get(), 201 TaskSetCollection task_set_collection;
200 required_for_activation)); 202 task_set_collection[ALL] = true;
203 task_set_collection[REQUIRED_FOR_ACTIVATION] = required_for_activation;
204 queue->items.push_back(
205 RasterTaskQueue::Item(raster_tasks[i].get(), task_set_collection));
201 } 206 }
202 } 207 }
203 208
204 protected: 209 protected:
205 scoped_refptr<ContextProvider> context_provider_; 210 scoped_refptr<ContextProvider> context_provider_;
206 FakeOutputSurfaceClient output_surface_client_; 211 FakeOutputSurfaceClient output_surface_client_;
207 scoped_ptr<FakeOutputSurface> output_surface_; 212 scoped_ptr<FakeOutputSurface> output_surface_;
208 scoped_ptr<SharedBitmapManager> shared_bitmap_manager_; 213 scoped_ptr<SharedBitmapManager> shared_bitmap_manager_;
209 scoped_ptr<ResourceProvider> resource_provider_; 214 scoped_ptr<ResourceProvider> resource_provider_;
210 scoped_ptr<ResourcePool> staging_resource_pool_; 215 scoped_ptr<ResourcePool> staging_resource_pool_;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 raster_worker_pool_->AsRasterizer()->SetClient(this); 259 raster_worker_pool_->AsRasterizer()->SetClient(this);
255 } 260 }
256 261
257 // Overridden from testing::Test: 262 // Overridden from testing::Test:
258 virtual void TearDown() OVERRIDE { 263 virtual void TearDown() OVERRIDE {
259 raster_worker_pool_->AsRasterizer()->Shutdown(); 264 raster_worker_pool_->AsRasterizer()->Shutdown();
260 raster_worker_pool_->AsRasterizer()->CheckForCompletedTasks(); 265 raster_worker_pool_->AsRasterizer()->CheckForCompletedTasks();
261 } 266 }
262 267
263 // Overriden from RasterizerClient: 268 // Overriden from RasterizerClient:
264 virtual bool ShouldForceTasksRequiredForActivationToComplete() const 269 virtual void DidFinishRunningTasks(TaskSet task_set) OVERRIDE {
265 OVERRIDE {
266 return false;
267 }
268 virtual void DidFinishRunningTasks() OVERRIDE {
269 raster_worker_pool_->AsRasterizer()->CheckForCompletedTasks(); 270 raster_worker_pool_->AsRasterizer()->CheckForCompletedTasks();
270 } 271 }
271 virtual void DidFinishRunningTasksRequiredForActivation() OVERRIDE {} 272 virtual TaskSetCollection TasksThatShouldBeForcedToComplete() const OVERRIDE {
273 return TaskSetCollection();
274 }
272 275
273 void RunMessageLoopUntilAllTasksHaveCompleted() { 276 void RunMessageLoopUntilAllTasksHaveCompleted() {
274 task_graph_runner_->RunUntilIdle(); 277 task_graph_runner_->RunUntilIdle();
275 task_runner_->RunUntilIdle(); 278 task_runner_->RunUntilIdle();
276 } 279 }
277 280
278 void RunScheduleTasksTest(const std::string& test_name, 281 void RunScheduleTasksTest(const std::string& test_name,
279 unsigned num_raster_tasks, 282 unsigned num_raster_tasks,
280 unsigned num_image_decode_tasks) { 283 unsigned num_image_decode_tasks) {
281 ImageDecodeTask::Vector image_decode_tasks; 284 ImageDecodeTask::Vector image_decode_tasks;
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 RunBuildRasterTaskQueueTest("1_0", 1, 0); 467 RunBuildRasterTaskQueueTest("1_0", 1, 0);
465 RunBuildRasterTaskQueueTest("32_0", 32, 0); 468 RunBuildRasterTaskQueueTest("32_0", 32, 0);
466 RunBuildRasterTaskQueueTest("1_1", 1, 1); 469 RunBuildRasterTaskQueueTest("1_1", 1, 1);
467 RunBuildRasterTaskQueueTest("32_1", 32, 1); 470 RunBuildRasterTaskQueueTest("32_1", 32, 1);
468 RunBuildRasterTaskQueueTest("1_4", 1, 4); 471 RunBuildRasterTaskQueueTest("1_4", 1, 4);
469 RunBuildRasterTaskQueueTest("32_4", 32, 4); 472 RunBuildRasterTaskQueueTest("32_4", 32, 4);
470 } 473 }
471 474
472 } // namespace 475 } // namespace
473 } // namespace cc 476 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698