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

Unified 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, 6 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/resource_provider.cc
diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc
index 79104d7ef309afa931109763680b84d7c015c269..cf79940c44f36c87384c99fc9730c20d19e9411c 100644
--- a/cc/resources/resource_provider.cc
+++ b/cc/resources/resource_provider.cc
@@ -1229,6 +1229,16 @@ ResourceProvider::ScopedWriteLockSoftware::~ScopedWriteLockSoftware() {
resource_provider_->UnlockForWrite(resource_id_);
}
+ResourceProvider::ScopedGpuRaster::ScopedGpuRaster(
+ ResourceProvider* resource_provider)
+ : resource_provider_(resource_provider) {
+ resource_provider_->BeginGpuRaster();
+}
+
+ResourceProvider::ScopedGpuRaster::~ScopedGpuRaster() {
+ resource_provider_->EndGpuRaster();
+}
+
ResourceProvider::ResourceProvider(OutputSurface* output_surface,
SharedBitmapManager* shared_bitmap_manager,
int highp_threshold_min,
@@ -2273,4 +2283,32 @@ class GrContext* ResourceProvider::GrContext() const {
return context_provider ? context_provider->GrContext() : NULL;
}
+void ResourceProvider::BeginGpuRaster() {
+ GLES2Interface* gl = ContextGL();
+ DCHECK(gl);
+
+ // TODO(alokp): Use a trace macro to push/pop markers.
+ // Using push/pop functions directly incurs cost to evaluate function
+ // arguments even when tracing is disabled.
+ gl->PushGroupMarkerEXT(0, "GpuRasterization");
+
+ class GrContext* gr_context = GrContext();
+ if (gr_context)
+ gr_context->resetContext();
+}
+
+void ResourceProvider::EndGpuRaster() {
+ GLES2Interface* gl = ContextGL();
+ DCHECK(gl);
+
+ class GrContext* gr_context = GrContext();
+ if (gr_context)
+ gr_context->flush();
+
+ // TODO(alokp): Use a trace macro to push/pop markers.
+ // Using push/pop functions directly incurs cost to evaluate function
+ // arguments even when tracing is disabled.
+ gl->PopGroupMarkerEXT();
+}
+
} // namespace cc
« 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