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

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

Issue 363563006: cc: Hide Gpu Rasterization details in Resource Provider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update unit/perf tests Create function for gpurasterworkerpool 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/resource_provider.h ('k') | cc/trees/layer_tree_host_impl.cc » ('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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/resource_provider.h" 5 #include "cc/resources/resource_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after
1222 ResourceProvider::PopulateSkBitmapWithResource( 1222 ResourceProvider::PopulateSkBitmapWithResource(
1223 &sk_bitmap_, resource_provider->LockForWrite(resource_id)); 1223 &sk_bitmap_, resource_provider->LockForWrite(resource_id));
1224 DCHECK(valid()); 1224 DCHECK(valid());
1225 sk_canvas_.reset(new SkCanvas(sk_bitmap_)); 1225 sk_canvas_.reset(new SkCanvas(sk_bitmap_));
1226 } 1226 }
1227 1227
1228 ResourceProvider::ScopedWriteLockSoftware::~ScopedWriteLockSoftware() { 1228 ResourceProvider::ScopedWriteLockSoftware::~ScopedWriteLockSoftware() {
1229 resource_provider_->UnlockForWrite(resource_id_); 1229 resource_provider_->UnlockForWrite(resource_id_);
1230 } 1230 }
1231 1231
1232 ResourceProvider::ScopedGpuRaster::ScopedGpuRaster(
1233 ResourceProvider* resource_provider)
1234 : resource_provider_(resource_provider) {
1235 resource_provider_->BeginGpuRaster();
1236 }
1237
1238 ResourceProvider::ScopedGpuRaster::~ScopedGpuRaster() {
1239 resource_provider_->EndGpuRaster();
1240 }
1241
1232 ResourceProvider::ResourceProvider(OutputSurface* output_surface, 1242 ResourceProvider::ResourceProvider(OutputSurface* output_surface,
1233 SharedBitmapManager* shared_bitmap_manager, 1243 SharedBitmapManager* shared_bitmap_manager,
1234 int highp_threshold_min, 1244 int highp_threshold_min,
1235 bool use_rgba_4444_texture_format, 1245 bool use_rgba_4444_texture_format,
1236 size_t id_allocation_chunk_size, 1246 size_t id_allocation_chunk_size,
1237 bool use_distance_field_text) 1247 bool use_distance_field_text)
1238 : output_surface_(output_surface), 1248 : output_surface_(output_surface),
1239 shared_bitmap_manager_(shared_bitmap_manager), 1249 shared_bitmap_manager_(shared_bitmap_manager),
1240 lost_output_surface_(false), 1250 lost_output_surface_(false),
1241 highp_threshold_min_(highp_threshold_min), 1251 highp_threshold_min_(highp_threshold_min),
(...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after
2266 GLES2Interface* ResourceProvider::ContextGL() const { 2276 GLES2Interface* ResourceProvider::ContextGL() const {
2267 ContextProvider* context_provider = output_surface_->context_provider(); 2277 ContextProvider* context_provider = output_surface_->context_provider();
2268 return context_provider ? context_provider->ContextGL() : NULL; 2278 return context_provider ? context_provider->ContextGL() : NULL;
2269 } 2279 }
2270 2280
2271 class GrContext* ResourceProvider::GrContext() const { 2281 class GrContext* ResourceProvider::GrContext() const {
2272 ContextProvider* context_provider = output_surface_->context_provider(); 2282 ContextProvider* context_provider = output_surface_->context_provider();
2273 return context_provider ? context_provider->GrContext() : NULL; 2283 return context_provider ? context_provider->GrContext() : NULL;
2274 } 2284 }
2275 2285
2286 void ResourceProvider::BeginGpuRaster() {
2287 GLES2Interface* gl = ContextGL();
2288 DCHECK(gl);
2289
2290 // TODO(alokp): Use a trace macro to push/pop markers.
2291 // Using push/pop functions directly incurs cost to evaluate function
2292 // arguments even when tracing is disabled.
2293 gl->PushGroupMarkerEXT(0, "GpuRasterization");
2294
2295 class GrContext* gr_context = GrContext();
2296 if (gr_context)
2297 gr_context->resetContext();
2298 }
2299
2300 void ResourceProvider::EndGpuRaster() {
2301 GLES2Interface* gl = ContextGL();
2302 DCHECK(gl);
2303
2304 class GrContext* gr_context = GrContext();
2305 if (gr_context)
2306 gr_context->flush();
2307
2308 // TODO(alokp): Use a trace macro to push/pop markers.
2309 // Using push/pop functions directly incurs cost to evaluate function
2310 // arguments even when tracing is disabled.
2311 gl->PopGroupMarkerEXT();
2312 }
2313
2276 } // namespace cc 2314 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/resource_provider.h ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698