Index: content/common/gpu/client/context_provider_command_buffer.cc |
diff --git a/content/common/gpu/client/context_provider_command_buffer.cc b/content/common/gpu/client/context_provider_command_buffer.cc |
index a4c3111c0cea56475463ae9eac507a986afb95b3..6c4882cd13e9cbbcc805ac06c17bcad7264b51e2 100644 |
--- a/content/common/gpu/client/context_provider_command_buffer.cc |
+++ b/content/common/gpu/client/context_provider_command_buffer.cc |
@@ -48,7 +48,9 @@ ContextProviderCommandBuffer::Create( |
ContextProviderCommandBuffer::ContextProviderCommandBuffer( |
scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d, |
const std::string& debug_name) |
- : context3d_(context3d.Pass()), |
+ : gpu_trace_top_level_category_(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED( |
+ TRACE_DISABLED_BY_DEFAULT("gpu_toplevel"))), |
+ context3d_(context3d.Pass()), |
debug_name_(debug_name), |
destroyed_(false) { |
DCHECK(main_thread_checker_.CalledOnValidThread()); |
@@ -96,9 +98,13 @@ bool ContextProviderCommandBuffer::BindToCurrentThread() { |
InitializeCapabilities(); |
- std::string unique_context_name = |
- base::StringPrintf("%s-%p", debug_name_.c_str(), context3d_.get()); |
- context3d_->pushGroupMarkerEXT(unique_context_name.c_str()); |
+ if (*gpu_trace_top_level_category_) { |
vmiura
2014/12/09 00:18:10
As in render_widget_host_view_android.cc, move the
|
+ std::string unique_context_name = |
+ base::StringPrintf("%s-%p", debug_name_.c_str(), context3d_.get()); |
+ TRACE_GPU_EVENT_BEGIN0(context3d_, |
+ TRACE_DISABLED_BY_DEFAULT("gpu_toplevel"), |
+ unique_context_name.c_str()); |
+ } |
lost_context_callback_proxy_.reset(new LostContextCallbackProxy(this)); |
context3d_->GetCommandBufferProxy()->SetMemoryAllocationChangedCallback( |
@@ -199,6 +205,9 @@ void ContextProviderCommandBuffer::InitializeCapabilities() { |
bool ContextProviderCommandBuffer::DestroyedOnMainThread() { |
DCHECK(main_thread_checker_.CalledOnValidThread()); |
+ if (*gpu_trace_top_level_category_) { |
+ TRACE_GPU_EVENT_END0(context3d_); |
+ } |
base::AutoLock lock(main_thread_lock_); |
return destroyed_; |