Chromium Code Reviews| 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 9837ebbbd0c9c99ac8fa2980c3e456c72466f76a..c1a3692589ce8c400fc50dbf6051e42d81cf5935 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" |
| @@ -1581,7 +1581,7 @@ class GLES2DecoderImpl : public base::SupportsWeakPtr<GLES2DecoderImpl>, |
| 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); |
| }; |
| @@ -2012,6 +2012,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); |
| @@ -6503,6 +6505,9 @@ error::Error GLES2DecoderImpl::HandlePostSubBufferCHROMIUM( |
| "glPostSubBufferCHROMIUM", "command not supported by surface"); |
| return error::kNoError; |
| } |
| + |
| + gpu_tracer_->Process(); |
| + |
| if (surface_->PostSubBuffer(c.x, c.y, c.width, c.height)) { |
| return error::kNoError; |
| } else { |
| @@ -8186,6 +8191,8 @@ error::Error GLES2DecoderImpl::HandleSwapBuffers( |
| return error::kDeferCommandUntilLater; |
| } |
| + gpu_tracer_->Process(); |
| + |
| int this_frame_number = frame_number_++; |
| // TRACE_EVENT for gpu tests: |
| TRACE_EVENT_INSTANT2("test_gpu", "SwapBuffersLatency", |
| @@ -9351,23 +9358,21 @@ error::Error GLES2DecoderImpl::HandleTraceBeginCHROMIUM( |
| return error::kInvalidArguments; |
| } |
| - linked_ptr<GPUTrace> trace(new GPUTrace(command_name)); |
| - trace->EnableStartTrace(); |
| - gpu_trace_stack_.push(trace); |
| + if (!gpu_tracer_->Begin(command_name)) { |
| + SetGLError(GL_INVALID_OPERATION, |
| + "glTraceBeginCHROMIUM", "unable to create begin trace"); |
| + return error::kNoError; |
|
jonathan.backer
2012/11/23 18:55:41
Do we return an error here?
dsinclair
2012/11/23 21:13:56
From looking at the other methods in this file, I
|
| + } |
| return error::kNoError; |
| } |
| void GLES2DecoderImpl::DoTraceEndCHROMIUM() { |
| - if (gpu_trace_stack_.empty()) { |
| + if (!gpu_tracer_->End()) { |
| SetGLError(GL_INVALID_OPERATION, |
| "glTraceEndCHROMIUM", "no trace begin found"); |
| return; |
| } |
| - |
| - linked_ptr<GPUTrace> trace = gpu_trace_stack_.top(); |
| - trace->EnableEndTrace(); |
| - gpu_trace_stack_.pop(); |
| } |
| // Include the auto-generated part of this file. We split this because it means |