Index: gpu/command_buffer/service/gles2_cmd_decoder.cc |
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
index 3fc39c6dda1c29f787f7a8648d00baa58d85d481..66739841c0d7485013cfdb3729514cc4b7bf94ed 100644 |
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc |
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
@@ -40,7 +40,7 @@ |
#include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" |
#include "gpu/command_buffer/service/gles2_cmd_validation.h" |
#include "gpu/command_buffer/service/gpu_switches.h" |
-#include "gpu/command_buffer/service/gpu_trace.h" |
+#include "gpu/command_buffer/service/gpu_tracer.h" |
#include "gpu/command_buffer/service/image_manager.h" |
#include "gpu/command_buffer/service/mailbox_manager.h" |
#include "gpu/command_buffer/service/memory_tracking.h" |
@@ -1671,7 +1671,7 @@ class GLES2DecoderImpl : public GLES2Decoder { |
base::TimeDelta total_texture_upload_time_; |
base::TimeDelta total_processing_commands_time_; |
- std::stack<linked_ptr<GPUTrace> > gpu_trace_stack_; |
+ scoped_ptr<GPUTracer> gpu_tracer_; |
DISALLOW_COPY_AND_ASSIGN(GLES2DecoderImpl); |
}; |
@@ -2118,6 +2118,8 @@ bool GLES2DecoderImpl::Initialize( |
DCHECK(context->IsCurrent(surface.get())); |
DCHECK(!context_.get()); |
+ gpu_tracer_ = GPUTracer::Create(); |
+ |
if (CommandLine::ForCurrentProcess()->HasSwitch( |
switches::kEnableGPUDebugging)) { |
set_debug(true); |
@@ -6782,6 +6784,7 @@ error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM( |
"glPostSubBufferCHROMIUM", "command not supported by surface"); |
return error::kNoError; |
} |
+ |
if (surface_->PostSubBuffer(c.x, c.y, c.width, c.height)) { |
return error::kNoError; |
} else { |
@@ -9646,24 +9649,23 @@ error::Error GLES2DecoderImpl::HandleTraceBeginCHROMIUM( |
if (!bucket->GetAsString(&command_name)) { |
return error::kInvalidArguments; |
} |
- |
- linked_ptr<GPUTrace> trace(new GPUTrace(command_name)); |
- trace->EnableStartTrace(); |
- gpu_trace_stack_.push(trace); |
- |
+ TRACE_EVENT_COPY_ASYNC_BEGIN0("gpu", command_name.c_str(), this); |
+ if (!gpu_tracer_->Begin(command_name)) { |
+ SetGLError(GL_INVALID_OPERATION, |
+ "glTraceBeginCHROMIUM", "unable to create begin trace"); |
+ return error::kNoError; |
jonathan.backer
2012/12/14 20:48:29
Why return here rather than the next line?
dsinclair
2012/12/14 21:26:04
Paranoia? I originally had code after this if bloc
|
+ } |
return error::kNoError; |
} |
void GLES2DecoderImpl::DoTraceEndCHROMIUM() { |
- if (gpu_trace_stack_.empty()) { |
+ if (gpu_tracer_->CurrentName().empty()) { |
SetGLError(GL_INVALID_OPERATION, |
"glTraceEndCHROMIUM", "no trace begin found"); |
return; |
} |
- |
- linked_ptr<GPUTrace> trace = gpu_trace_stack_.top(); |
- trace->EnableEndTrace(); |
- gpu_trace_stack_.pop(); |
+ TRACE_EVENT_COPY_ASYNC_END0("gpu", gpu_tracer_->CurrentName().c_str(), this); |
+ gpu_tracer_->End(); |
} |
error::Error GLES2DecoderImpl::HandleAsyncTexImage2DCHROMIUM( |