Chromium Code Reviews| Index: cc/output/gl_renderer.cc |
| diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc |
| index 2a27ff7810416861d3d38af9db571d95038265bf..e89b7f2e86ceb047ede0145090fd219c543f3ced 100644 |
| --- a/cc/output/gl_renderer.cc |
| +++ b/cc/output/gl_renderer.cc |
| @@ -14,6 +14,7 @@ |
| #include "base/logging.h" |
| #include "base/strings/string_split.h" |
| #include "base/strings/string_util.h" |
| +#include "base/strings/stringprintf.h" |
| #include "build/build_config.h" |
| #include "cc/base/math_util.h" |
| #include "cc/layers/video_layer_impl.h" |
| @@ -138,7 +139,8 @@ GLRenderer::GLRenderer(RendererClient* client, |
| highp_threshold_min_(highp_threshold_min), |
| highp_threshold_cache_(0), |
| on_demand_tile_raster_resource_id_(0), |
| - weak_factory_(this) { |
| + weak_factory_(this), |
| + offscreen_context_labelled_(false) { |
| DCHECK(context_); |
| } |
| @@ -146,7 +148,11 @@ bool GLRenderer::Initialize() { |
| if (!context_->makeContextCurrent()) |
| return false; |
| - context_->pushGroupMarkerEXT(Settings().compositor_name.c_str()); |
| + std::string unique_context_name = base::StringPrintf( |
| + "%s-%p", |
| + Settings().compositor_name.c_str(), |
| + context_); |
| + context_->pushGroupMarkerEXT(unique_context_name.c_str()); |
| std::string extensions_string = |
| UTF16ToASCII(context_->getString(GL_EXTENSIONS)); |
| @@ -462,6 +468,9 @@ static inline SkBitmap ApplyFilters(GLRenderer* renderer, |
| // Make sure skia uses the correct GL context. |
| offscreen_contexts->Context3d()->makeContextCurrent(); |
| + // Lazily label this context. |
| + renderer->LazyLabelOffscreenContext(); |
| + |
| SkBitmap source = |
| RenderSurfaceFilters::Apply(filters, |
| lock.texture_id(), |
| @@ -503,6 +512,9 @@ static SkBitmap ApplyImageFilter(GLRenderer* renderer, |
| // Make sure skia uses the correct GL context. |
| offscreen_contexts->Context3d()->makeContextCurrent(); |
| + // Lazily label this context. |
| + renderer->LazyLabelOffscreenContext(); |
| + |
| // Wrap the source texture in a Ganesh platform texture. |
| GrBackendTextureDesc backend_texture_description; |
| backend_texture_description.fWidth = source_texture_resource->size().width(); |
| @@ -3035,4 +3047,17 @@ bool GLRenderer::IsContextLost() { |
| return (context_->getGraphicsResetStatusARB() != GL_NO_ERROR); |
| } |
| +void GLRenderer::LazyLabelOffscreenContext() { |
| + if (!offscreen_context_labelled_) { |
|
danakj
2013/06/25 15:02:19
nit: if (labelled) return;
|
| + offscreen_context_labelled_ = true; |
| + std::string unique_context_name = base::StringPrintf( |
| + "%s-Offscreen-%p", |
| + Settings().compositor_name.c_str(), |
| + context_); |
| + resource_provider()->offscreen_context_provider()->Context3d()-> |
| + pushGroupMarkerEXT(unique_context_name.c_str()); |
| + } |
| +} |
| + |
| + |
| } // namespace cc |