Commit 6c557240 authored by boliu's avatar boliu Committed by Commit bot

aw: Hook up gpu client tracing

Make --enable-gpu-client-tracing work for the in-process context on the
render thread. This matches ContextProviderCommandBuffer implementation.

Review-Url: https://codereview.chromium.org/2850713002
Cr-Commit-Position: refs/heads/master@{#468065}
parent bcc67886
...@@ -6,12 +6,15 @@ ...@@ -6,12 +6,15 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/callback_helpers.h" #include "base/callback_helpers.h"
#include "base/command_line.h"
#include "base/lazy_instance.h" #include "base/lazy_instance.h"
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
#include "cc/output/context_cache_controller.h" #include "cc/output/context_cache_controller.h"
#include "cc/output/managed_memory_policy.h" #include "cc/output/managed_memory_policy.h"
#include "gpu/command_buffer/client/gles2_implementation.h" #include "gpu/command_buffer/client/gles2_implementation.h"
#include "gpu/command_buffer/client/gles2_lib.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/command_buffer/client/shared_memory_limits.h"
#include "gpu/ipc/gl_in_process_context.h" #include "gpu/ipc/gl_in_process_context.h"
#include "gpu/skia_bindings/gl_bindings_skia_cmd_buffer.h" #include "gpu/skia_bindings/gl_bindings_skia_cmd_buffer.h"
...@@ -69,6 +72,14 @@ AwRenderThreadContextProvider::AwRenderThreadContextProvider( ...@@ -69,6 +72,14 @@ AwRenderThreadContextProvider::AwRenderThreadContextProvider(
context_->GetImplementation()->SetLostContextCallback(base::Bind( context_->GetImplementation()->SetLostContextCallback(base::Bind(
&AwRenderThreadContextProvider::OnLostContext, base::Unretained(this))); &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( cache_controller_.reset(
new cc::ContextCacheController(context_->GetImplementation(), nullptr)); new cc::ContextCacheController(context_->GetImplementation(), nullptr));
} }
...@@ -98,7 +109,8 @@ gpu::Capabilities AwRenderThreadContextProvider::ContextCapabilities() { ...@@ -98,7 +109,8 @@ gpu::Capabilities AwRenderThreadContextProvider::ContextCapabilities() {
gpu::gles2::GLES2Interface* AwRenderThreadContextProvider::ContextGL() { gpu::gles2::GLES2Interface* AwRenderThreadContextProvider::ContextGL() {
DCHECK(main_thread_checker_.CalledOnValidThread()); DCHECK(main_thread_checker_.CalledOnValidThread());
if (trace_impl_)
return trace_impl_.get();
return context_->GetImplementation(); return context_->GetImplementation();
} }
......
...@@ -22,7 +22,10 @@ class GLSurface; ...@@ -22,7 +22,10 @@ class GLSurface;
namespace gpu { namespace gpu {
class GLInProcessContext; class GLInProcessContext;
} namespace gles2 {
class GLES2TraceImplementation;
} // namespace gles2
} // namespace gpu
namespace android_webview { namespace android_webview {
...@@ -59,6 +62,7 @@ class AwRenderThreadContextProvider : public cc::ContextProvider { ...@@ -59,6 +62,7 @@ class AwRenderThreadContextProvider : public cc::ContextProvider {
base::ThreadChecker main_thread_checker_; base::ThreadChecker main_thread_checker_;
std::unique_ptr<gpu::GLInProcessContext> context_; std::unique_ptr<gpu::GLInProcessContext> context_;
std::unique_ptr<gpu::gles2::GLES2TraceImplementation> trace_impl_;
sk_sp<class GrContext> gr_context_; sk_sp<class GrContext> gr_context_;
std::unique_ptr<cc::ContextCacheController> cache_controller_; std::unique_ptr<cc::ContextCacheController> cache_controller_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment