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

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

Issue 363563006: cc: Hide Gpu Rasterization details in Resource Provider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added scopedgpuraster class 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
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 "gpu/command_buffer/client/gles2_interface.h" 11 #include "gpu/command_buffer/client/gles2_interface.h"
12 #include "third_party/skia/include/gpu/GrContext.h" 12 #include "third_party/skia/include/gpu/GrContext.h"
13 13
14 namespace cc { 14 namespace cc {
15 15
16 // static 16 // static
17 scoped_ptr<RasterWorkerPool> GpuRasterWorkerPool::Create( 17 scoped_ptr<RasterWorkerPool> GpuRasterWorkerPool::Create(
18 base::SequencedTaskRunner* task_runner, 18 base::SequencedTaskRunner* task_runner,
19 ResourceProvider* resource_provider, 19 ResourceProvider* resource_provider) {
20 ContextProvider* context_provider) { 20 return make_scoped_ptr<RasterWorkerPool>(
21 return make_scoped_ptr<RasterWorkerPool>(new GpuRasterWorkerPool( 21 new GpuRasterWorkerPool(task_runner, resource_provider));
22 task_runner, resource_provider, context_provider));
23 } 22 }
24 23
25 GpuRasterWorkerPool::GpuRasterWorkerPool(base::SequencedTaskRunner* task_runner, 24 GpuRasterWorkerPool::GpuRasterWorkerPool(base::SequencedTaskRunner* task_runner,
26 ResourceProvider* resource_provider, 25 ResourceProvider* resource_provider)
27 ContextProvider* context_provider)
28 : task_runner_(task_runner), 26 : task_runner_(task_runner),
29 task_graph_runner_(new TaskGraphRunner), 27 task_graph_runner_(new TaskGraphRunner),
30 namespace_token_(task_graph_runner_->GetNamespaceToken()), 28 namespace_token_(task_graph_runner_->GetNamespaceToken()),
31 resource_provider_(resource_provider), 29 resource_provider_(resource_provider),
32 context_provider_(context_provider),
33 run_tasks_on_origin_thread_pending_(false), 30 run_tasks_on_origin_thread_pending_(false),
34 raster_tasks_pending_(false), 31 raster_tasks_pending_(false),
35 raster_tasks_required_for_activation_pending_(false), 32 raster_tasks_required_for_activation_pending_(false),
36 raster_finished_weak_ptr_factory_(this), 33 raster_finished_weak_ptr_factory_(this),
37 weak_ptr_factory_(this) { 34 weak_ptr_factory_(this) {
38 DCHECK(context_provider_);
39 } 35 }
40 36
41 GpuRasterWorkerPool::~GpuRasterWorkerPool() { 37 GpuRasterWorkerPool::~GpuRasterWorkerPool() {
42 DCHECK_EQ(0u, completed_tasks_.size()); 38 DCHECK_EQ(0u, completed_tasks_.size());
43 } 39 }
44 40
45 Rasterizer* GpuRasterWorkerPool::AsRasterizer() { 41 Rasterizer* GpuRasterWorkerPool::AsRasterizer() {
46 return this; 42 return this;
47 } 43 }
48 44
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 weak_ptr_factory_.GetWeakPtr())); 178 weak_ptr_factory_.GetWeakPtr()));
183 run_tasks_on_origin_thread_pending_ = true; 179 run_tasks_on_origin_thread_pending_ = true;
184 } 180 }
185 181
186 void GpuRasterWorkerPool::RunTasksOnOriginThread() { 182 void GpuRasterWorkerPool::RunTasksOnOriginThread() {
187 TRACE_EVENT0("cc", "GpuRasterWorkerPool::RunTasksOnOriginThread"); 183 TRACE_EVENT0("cc", "GpuRasterWorkerPool::RunTasksOnOriginThread");
188 184
189 DCHECK(run_tasks_on_origin_thread_pending_); 185 DCHECK(run_tasks_on_origin_thread_pending_);
190 run_tasks_on_origin_thread_pending_ = false; 186 run_tasks_on_origin_thread_pending_ = false;
191 187
192 DCHECK(context_provider_->ContextGL());
193 // TODO(alokp): Use a trace macro to push/pop markers. 188 // TODO(alokp): Use a trace macro to push/pop markers.
194 // Using push/pop functions directly incurs cost to evaluate function 189 // Using push/pop functions directly incurs cost to evaluate function
195 // arguments even when tracing is disabled. 190 // arguments even when tracing is disabled.
reveman 2014/07/01 17:19:01 this comment should be moved to the resource provi
sohanjg 2014/07/02 07:40:37 Done.
196 context_provider_->ContextGL()->PushGroupMarkerEXT( 191 ResourceProvider::ScopedGpuRaster gpu_raster(
197 0, "GpuRasterWorkerPool::RunTasksOnOriginThread"); 192 resource_provider_, "GpuRasterWorkerPool::RunTasksOnOriginThread");
reveman 2014/07/01 17:19:01 I'm not sure how useful the "GpuRasterWorkerPool::
sohanjg 2014/07/02 07:40:37 Done.
198
199 GrContext* gr_context = context_provider_->GrContext();
200 // TODO(alokp): Implement TestContextProvider::GrContext().
201 if (gr_context)
202 gr_context->resetContext();
203
204 task_graph_runner_->RunUntilIdle(); 193 task_graph_runner_->RunUntilIdle();
205
206 // TODO(alokp): Implement TestContextProvider::GrContext().
207 if (gr_context)
208 gr_context->flush();
209
210 context_provider_->ContextGL()->PopGroupMarkerEXT();
211 } 194 }
212 195
213 } // namespace cc 196 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698