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

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

Issue 73923003: Shared Raster Worker Threads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Number of raster threads API comments Created 6 years, 11 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/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "cc/debug/devtools_instrumentation.h" 10 #include "cc/debug/devtools_instrumentation.h"
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 void RunOnOriginThread() const { 312 void RunOnOriginThread() const {
313 on_raster_finished_callback_.Run(this); 313 on_raster_finished_callback_.Run(this);
314 } 314 }
315 315
316 scoped_refptr<base::MessageLoopProxy> origin_loop_; 316 scoped_refptr<base::MessageLoopProxy> origin_loop_;
317 const Callback on_raster_finished_callback_; 317 const Callback on_raster_finished_callback_;
318 318
319 DISALLOW_COPY_AND_ASSIGN(RasterFinishedWorkerPoolTaskImpl); 319 DISALLOW_COPY_AND_ASSIGN(RasterFinishedWorkerPoolTaskImpl);
320 }; 320 };
321 321
322 const char* kWorkerThreadNamePrefix = "CompositorRaster"; 322 const int kDefaultNumRasterThreads = 1;
reveman 2014/01/06 20:01:35 nit: I'd add a blank line after this
sohanjg 2014/01/07 08:35:23 Done.
323 static int num_raster_threads = kDefaultNumRasterThreads;
reveman 2014/01/06 20:01:35 s/num_raster_threads/g_num_raster_threads/ if you
sohanjg 2014/01/07 08:35:23 Done.
323 324
324 } // namespace 325 } // namespace
325 326
326 namespace internal { 327 namespace internal {
327 328
328 RasterWorkerPoolTask::RasterWorkerPoolTask( 329 RasterWorkerPoolTask::RasterWorkerPoolTask(
329 const Resource* resource, TaskVector* dependencies) 330 const Resource* resource, TaskVector* dependencies)
330 : did_run_(false), 331 : did_run_(false),
331 did_complete_(false), 332 did_complete_(false),
332 was_canceled_(false), 333 was_canceled_(false),
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 skia::LazyPixelRef* pixel_ref, 455 skia::LazyPixelRef* pixel_ref,
455 int layer_id, 456 int layer_id,
456 RenderingStatsInstrumentation* stats_instrumentation, 457 RenderingStatsInstrumentation* stats_instrumentation,
457 const Task::Reply& reply) { 458 const Task::Reply& reply) {
458 return Task(new ImageDecodeWorkerPoolTaskImpl(pixel_ref, 459 return Task(new ImageDecodeWorkerPoolTaskImpl(pixel_ref,
459 layer_id, 460 layer_id,
460 stats_instrumentation, 461 stats_instrumentation,
461 reply)); 462 reply));
462 } 463 }
463 464
464 RasterWorkerPool::RasterWorkerPool(ResourceProvider* resource_provider, 465 // static
465 size_t num_threads) 466 void RasterWorkerPool::SetNumRasterThreads(int num_threads) {
466 : WorkerPool(num_threads, kWorkerThreadNamePrefix), 467 DCHECK(num_threads);
reveman 2014/01/06 20:01:35 I prefer DCHECK_LT(0, num_threads) also add DCHEC
sohanjg 2014/01/07 08:35:23 Done.
467 client_(NULL), 468
469 num_raster_threads = num_threads;
470 }
471
472 // static
473 int RasterWorkerPool::GetNumRasterThreads() {
reveman 2014/01/06 20:01:35 Let's just use WorkerPool::GetNumRasterThreads() f
sohanjg 2014/01/07 08:35:23 Done.
474 return num_raster_threads;
475 }
476
477 // static
478 int WorkerPool::GetNumRasterThreads() {
reveman 2014/01/06 20:01:35 if you make this: { if (!g_num_raster_threads)
sohanjg 2014/01/07 08:35:23 Done.
479 return RasterWorkerPool::GetNumRasterThreads();
480 }
481
482 RasterWorkerPool::RasterWorkerPool(ResourceProvider* resource_provider)
483 : client_(NULL),
468 resource_provider_(resource_provider), 484 resource_provider_(resource_provider),
469 weak_ptr_factory_(this) { 485 weak_ptr_factory_(this) {
470 } 486 }
471 487
472 RasterWorkerPool::~RasterWorkerPool() { 488 RasterWorkerPool::~RasterWorkerPool() {
473 } 489 }
474 490
475 void RasterWorkerPool::SetClient(RasterWorkerPoolClient* client) { 491 void RasterWorkerPool::SetClient(RasterWorkerPoolClient* client) {
476 client_ = client; 492 client_ = client;
477 } 493 }
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 603
588 internal::GraphNode* decode_node = CreateGraphNodeForTask( 604 internal::GraphNode* decode_node = CreateGraphNodeForTask(
589 decode_task, priority, graph); 605 decode_task, priority, graph);
590 decode_node->add_dependent(raster_node); 606 decode_node->add_dependent(raster_node);
591 } 607 }
592 608
593 return raster_node; 609 return raster_node;
594 } 610 }
595 611
596 } // namespace cc 612 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698