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 |