Skip to content

Commit

Permalink
aw: Hook up gpu client tracing
Browse files Browse the repository at this point in the history
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}
  • Loading branch information
boliu authored and Commit bot committed Apr 28, 2017
1 parent bcc6788 commit 6c55724
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
14 changes: 13 additions & 1 deletion android_webview/browser/aw_render_thread_context_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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));
}
Expand Down Expand Up @@ -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();
}

Expand Down
6 changes: 5 additions & 1 deletion android_webview/browser/aw_render_thread_context_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ class GLSurface;

namespace gpu {
class GLInProcessContext;
}
namespace gles2 {
class GLES2TraceImplementation;
} // namespace gles2
} // namespace gpu

namespace android_webview {

Expand Down Expand Up @@ -59,6 +62,7 @@ class AwRenderThreadContextProvider : public cc::ContextProvider {
base::ThreadChecker main_thread_checker_;

std::unique_ptr<gpu::GLInProcessContext> context_;
std::unique_ptr<gpu::gles2::GLES2TraceImplementation> trace_impl_;
sk_sp<class GrContext> gr_context_;
std::unique_ptr<cc::ContextCacheController> cache_controller_;

Expand Down

0 comments on commit 6c55724

Please sign in to comment.