Index: webkit/common/gpu/context_provider_in_process.cc |
diff --git a/webkit/common/gpu/context_provider_in_process.cc b/webkit/common/gpu/context_provider_in_process.cc |
index b02d961d70cf109cdf434197fe6dc7b86551df41..de8443f56a790a8fa16d2132bbbd2ee2e6571fc1 100644 |
--- a/webkit/common/gpu/context_provider_in_process.cc |
+++ b/webkit/common/gpu/context_provider_in_process.cc |
@@ -66,7 +66,9 @@ ContextProviderInProcess::CreateOffscreen( |
ContextProviderInProcess::ContextProviderInProcess( |
scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> 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()), |
destroyed_(false), |
debug_name_(debug_name) { |
DCHECK(main_thread_checker_.CalledOnValidThread()); |
@@ -100,9 +102,13 @@ bool ContextProviderInProcess::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:11
Same with these.
|
+ 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)); |
return true; |
@@ -194,6 +200,9 @@ void ContextProviderInProcess::OnLostContext() { |
bool ContextProviderInProcess::DestroyedOnMainThread() { |
DCHECK(main_thread_checker_.CalledOnValidThread()); |
+ if (*gpu_trace_top_level_category_) { |
+ TRACE_GPU_EVENT_END0(context3d_); |
+ } |
base::AutoLock lock(destroyed_lock_); |
return destroyed_; |