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

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

Issue 160023002: cc: Only make num_threads - 1 SkPicture clones. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sw renderer too Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « cc/resources/picture.cc ('k') | cc/resources/raster_worker_pool.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 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/pixel_buffer_raster_worker_pool.h" 5 #include "cc/resources/pixel_buffer_raster_worker_pool.h"
6 6
7 #include "base/containers/stack_container.h" 7 #include "base/containers/stack_container.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "cc/debug/traced_value.h" 10 #include "cc/debug/traced_value.h"
11 #include "cc/resources/resource.h" 11 #include "cc/resources/resource.h"
12 12
13 namespace cc { 13 namespace cc {
14 namespace { 14 namespace {
15 15
16 const int kCheckForCompletedRasterTasksDelayMs = 6; 16 const int kCheckForCompletedRasterTasksDelayMs = 6;
17 17
18 const size_t kMaxScheduledRasterTasks = 48; 18 const size_t kMaxScheduledRasterTasks = 48;
19 19
20 typedef base::StackVector<internal::WorkerPoolTask*, kMaxScheduledRasterTasks> 20 typedef base::StackVector<internal::WorkerPoolTask*, kMaxScheduledRasterTasks>
21 WorkerPoolTaskVector; 21 WorkerPoolTaskVector;
22 22
23 // Only used as std::find_if predicate for DCHECKs. 23 // Only used as std::find_if predicate for DCHECKs.
24 bool WasCanceled(const internal::RasterWorkerPoolTask* task) { 24 bool WasCanceled(const internal::RasterWorkerPoolTask* task) {
25 return !task->HasFinishedRunning(); 25 return !task->HasFinishedRunning();
26 } 26 }
27 27
28 class RasterTaskGraphRunner : public internal::TaskGraphRunner {
29 public:
30 RasterTaskGraphRunner()
31 : internal::TaskGraphRunner(RasterWorkerPool::GetNumRasterThreads(),
32 "CompositorRaster") {}
33 };
34 base::LazyInstance<RasterTaskGraphRunner>::Leaky g_task_graph_runner =
35 LAZY_INSTANCE_INITIALIZER;
36
37 } // namespace 28 } // namespace
38 29
39 // static 30 // static
40 scoped_ptr<RasterWorkerPool> PixelBufferRasterWorkerPool::Create( 31 scoped_ptr<RasterWorkerPool> PixelBufferRasterWorkerPool::Create(
41 ResourceProvider* resource_provider, 32 ResourceProvider* resource_provider,
42 ContextProvider* context_provider, 33 ContextProvider* context_provider,
43 size_t max_transfer_buffer_usage_bytes) { 34 size_t max_transfer_buffer_usage_bytes) {
44 return make_scoped_ptr<RasterWorkerPool>( 35 return make_scoped_ptr<RasterWorkerPool>(
45 new PixelBufferRasterWorkerPool(g_task_graph_runner.Pointer(), 36 new PixelBufferRasterWorkerPool(GetTaskGraphRunner(),
46 resource_provider, 37 resource_provider,
47 context_provider, 38 context_provider,
48 max_transfer_buffer_usage_bytes)); 39 max_transfer_buffer_usage_bytes));
49 } 40 }
50 41
51 PixelBufferRasterWorkerPool::PixelBufferRasterWorkerPool( 42 PixelBufferRasterWorkerPool::PixelBufferRasterWorkerPool(
52 internal::TaskGraphRunner* task_graph_runner, 43 internal::TaskGraphRunner* task_graph_runner,
53 ResourceProvider* resource_provider, 44 ResourceProvider* resource_provider,
54 ContextProvider* context_provider, 45 ContextProvider* context_provider,
55 size_t max_transfer_buffer_usage_bytes) 46 size_t max_transfer_buffer_usage_bytes)
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 696
706 throttle_state->SetInteger("bytes_available_for_upload", 697 throttle_state->SetInteger("bytes_available_for_upload",
707 max_bytes_pending_upload_ - bytes_pending_upload_); 698 max_bytes_pending_upload_ - bytes_pending_upload_);
708 throttle_state->SetInteger("bytes_pending_upload", bytes_pending_upload_); 699 throttle_state->SetInteger("bytes_pending_upload", bytes_pending_upload_);
709 throttle_state->SetInteger("scheduled_raster_task_count", 700 throttle_state->SetInteger("scheduled_raster_task_count",
710 scheduled_raster_task_count_); 701 scheduled_raster_task_count_);
711 return throttle_state.PassAs<base::Value>(); 702 return throttle_state.PassAs<base::Value>();
712 } 703 }
713 704
714 } // namespace cc 705 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture.cc ('k') | cc/resources/raster_worker_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698