Index: android_webview/browser/aw_render_thread_context_provider.cc |
diff --git a/android_webview/browser/aw_render_thread_context_provider.cc b/android_webview/browser/aw_render_thread_context_provider.cc |
index 563bce645e62410116bdd81e8381e7dad44bfa0f..a3ed6c8d22578281e1f9febe15c8b11ed9fee0b8 100644 |
--- a/android_webview/browser/aw_render_thread_context_provider.cc |
+++ b/android_webview/browser/aw_render_thread_context_provider.cc |
@@ -6,12 +6,15 @@ |
#include "base/bind.h" |
#include "base/callback_helpers.h" |
+#include "base/command_line.h" |
#include "base/lazy_instance.h" |
#include "base/trace_event/trace_event.h" |
#include "cc/output/context_cache_controller.h" |
#include "cc/output/managed_memory_policy.h" |
#include "gpu/command_buffer/client/gles2_implementation.h" |
#include "gpu/command_buffer/client/gles2_lib.h" |
+#include "gpu/command_buffer/client/gles2_trace_implementation.h" |
+#include "gpu/command_buffer/client/gpu_switches.h" |
#include "gpu/command_buffer/client/shared_memory_limits.h" |
#include "gpu/ipc/gl_in_process_context.h" |
#include "gpu/skia_bindings/gl_bindings_skia_cmd_buffer.h" |
@@ -69,6 +72,14 @@ AwRenderThreadContextProvider::AwRenderThreadContextProvider( |
context_->GetImplementation()->SetLostContextCallback(base::Bind( |
&AwRenderThreadContextProvider::OnLostContext, base::Unretained(this))); |
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kEnableGpuClientTracing)) { |
+ // This wraps the real GLES2Implementation and we should always use this |
+ // instead when it's present. |
+ trace_impl_.reset(new gpu::gles2::GLES2TraceImplementation( |
+ context_->GetImplementation())); |
+ } |
+ |
cache_controller_.reset( |
new cc::ContextCacheController(context_->GetImplementation(), nullptr)); |
} |
@@ -98,7 +109,8 @@ gpu::Capabilities AwRenderThreadContextProvider::ContextCapabilities() { |
gpu::gles2::GLES2Interface* AwRenderThreadContextProvider::ContextGL() { |
DCHECK(main_thread_checker_.CalledOnValidThread()); |
- |
+ if (trace_impl_) |
+ return trace_impl_.get(); |
return context_->GetImplementation(); |
} |