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

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

Issue 375303002: cc: Refactor ResourceProvider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixing typing error in build.gn Created 6 years, 5 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/resources/gpu_raster_worker_pool.h ('k') | cc/resources/image_copy_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 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/resources/gpu_raster_worker_pool.h" 5 #include "cc/resources/gpu_raster_worker_pool.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "cc/output/context_provider.h" 8 #include "cc/output/context_provider.h"
9 #include "cc/resources/resource.h" 9 #include "cc/resources/resource.h"
10 #include "cc/resources/resource_provider.h" 10 #include "cc/resources/resource_provider.h"
11 #include "cc/resources/scoped_gpu_raster.h"
11 #include "gpu/command_buffer/client/gles2_interface.h" 12 #include "gpu/command_buffer/client/gles2_interface.h"
12 #include "third_party/skia/include/gpu/GrContext.h" 13 #include "third_party/skia/include/gpu/GrContext.h"
13 14
14 namespace cc { 15 namespace cc {
15 16
16 // static 17 // static
17 scoped_ptr<RasterWorkerPool> GpuRasterWorkerPool::Create( 18 scoped_ptr<RasterWorkerPool> GpuRasterWorkerPool::Create(
18 base::SequencedTaskRunner* task_runner, 19 base::SequencedTaskRunner* task_runner,
20 ContextProvider* context_provider,
19 ResourceProvider* resource_provider) { 21 ResourceProvider* resource_provider) {
20 return make_scoped_ptr<RasterWorkerPool>( 22 return make_scoped_ptr<RasterWorkerPool>(new GpuRasterWorkerPool(
21 new GpuRasterWorkerPool(task_runner, resource_provider)); 23 task_runner, context_provider, resource_provider));
22 } 24 }
23 25
24 GpuRasterWorkerPool::GpuRasterWorkerPool(base::SequencedTaskRunner* task_runner, 26 GpuRasterWorkerPool::GpuRasterWorkerPool(base::SequencedTaskRunner* task_runner,
27 ContextProvider* context_provider,
25 ResourceProvider* resource_provider) 28 ResourceProvider* resource_provider)
26 : task_runner_(task_runner), 29 : task_runner_(task_runner),
27 task_graph_runner_(new TaskGraphRunner), 30 task_graph_runner_(new TaskGraphRunner),
28 namespace_token_(task_graph_runner_->GetNamespaceToken()), 31 namespace_token_(task_graph_runner_->GetNamespaceToken()),
32 context_provider_(context_provider),
29 resource_provider_(resource_provider), 33 resource_provider_(resource_provider),
30 run_tasks_on_origin_thread_pending_(false), 34 run_tasks_on_origin_thread_pending_(false),
31 raster_tasks_pending_(false), 35 raster_tasks_pending_(false),
32 raster_tasks_required_for_activation_pending_(false), 36 raster_tasks_required_for_activation_pending_(false),
33 raster_finished_weak_ptr_factory_(this), 37 raster_finished_weak_ptr_factory_(this),
34 weak_ptr_factory_(this) { 38 weak_ptr_factory_(this) {
35 } 39 }
36 40
37 GpuRasterWorkerPool::~GpuRasterWorkerPool() { 41 GpuRasterWorkerPool::~GpuRasterWorkerPool() {
38 DCHECK_EQ(0u, completed_tasks_.size()); 42 DCHECK_EQ(0u, completed_tasks_.size());
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 weak_ptr_factory_.GetWeakPtr())); 182 weak_ptr_factory_.GetWeakPtr()));
179 run_tasks_on_origin_thread_pending_ = true; 183 run_tasks_on_origin_thread_pending_ = true;
180 } 184 }
181 185
182 void GpuRasterWorkerPool::RunTasksOnOriginThread() { 186 void GpuRasterWorkerPool::RunTasksOnOriginThread() {
183 TRACE_EVENT0("cc", "GpuRasterWorkerPool::RunTasksOnOriginThread"); 187 TRACE_EVENT0("cc", "GpuRasterWorkerPool::RunTasksOnOriginThread");
184 188
185 DCHECK(run_tasks_on_origin_thread_pending_); 189 DCHECK(run_tasks_on_origin_thread_pending_);
186 run_tasks_on_origin_thread_pending_ = false; 190 run_tasks_on_origin_thread_pending_ = false;
187 191
188 ResourceProvider::ScopedGpuRaster gpu_raster(resource_provider_); 192 ScopedGpuRaster gpu_raster(context_provider_);
189 task_graph_runner_->RunUntilIdle(); 193 task_graph_runner_->RunUntilIdle();
190 } 194 }
191 195
192 } // namespace cc 196 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/gpu_raster_worker_pool.h ('k') | cc/resources/image_copy_raster_worker_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698