| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file contains the GPUTrace class. | 5 // This file contains the GPUTrace class. |
| 6 #ifndef GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ | 6 #ifndef GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ |
| 7 #define GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ | 7 #define GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ |
| 8 | 8 |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <deque> | 11 #include <deque> |
| 12 #include <memory> |
| 12 #include <stack> | 13 #include <stack> |
| 13 #include <string> | 14 #include <string> |
| 14 #include <vector> | 15 #include <vector> |
| 15 | 16 |
| 16 #include "base/macros.h" | 17 #include "base/macros.h" |
| 17 #include "base/memory/scoped_ptr.h" | |
| 18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 19 #include "base/threading/thread.h" | 19 #include "base/threading/thread.h" |
| 20 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 20 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 21 #include "gpu/gpu_export.h" | 21 #include "gpu/gpu_export.h" |
| 22 | 22 |
| 23 namespace gfx { | 23 namespace gfx { |
| 24 class GPUTimingClient; | 24 class GPUTimingClient; |
| 25 class GPUTimer; | 25 class GPUTimer; |
| 26 } | 26 } |
| 27 | 27 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 ~GPUTrace(); | 186 ~GPUTrace(); |
| 187 | 187 |
| 188 void Output(); | 188 void Output(); |
| 189 | 189 |
| 190 friend class base::RefCounted<GPUTrace>; | 190 friend class base::RefCounted<GPUTrace>; |
| 191 | 191 |
| 192 const GpuTracerSource source_ = kTraceGroupInvalid; | 192 const GpuTracerSource source_ = kTraceGroupInvalid; |
| 193 const std::string category_; | 193 const std::string category_; |
| 194 const std::string name_; | 194 const std::string name_; |
| 195 scoped_refptr<Outputter> outputter_; | 195 scoped_refptr<Outputter> outputter_; |
| 196 scoped_ptr<gfx::GPUTimer> gpu_timer_; | 196 std::unique_ptr<gfx::GPUTimer> gpu_timer_; |
| 197 const bool service_enabled_ = false; | 197 const bool service_enabled_ = false; |
| 198 const bool device_enabled_ = false; | 198 const bool device_enabled_ = false; |
| 199 | 199 |
| 200 DISALLOW_COPY_AND_ASSIGN(GPUTrace); | 200 DISALLOW_COPY_AND_ASSIGN(GPUTrace); |
| 201 }; | 201 }; |
| 202 | 202 |
| 203 class ScopedGPUTrace { | 203 class ScopedGPUTrace { |
| 204 public: | 204 public: |
| 205 ScopedGPUTrace(GPUTracer* gpu_tracer, | 205 ScopedGPUTrace(GPUTracer* gpu_tracer, |
| 206 GpuTracerSource source, | 206 GpuTracerSource source, |
| 207 const std::string& category, | 207 const std::string& category, |
| 208 const std::string& name) | 208 const std::string& name) |
| 209 : gpu_tracer_(gpu_tracer), source_(source) { | 209 : gpu_tracer_(gpu_tracer), source_(source) { |
| 210 gpu_tracer_->Begin(category, name, source_); | 210 gpu_tracer_->Begin(category, name, source_); |
| 211 } | 211 } |
| 212 | 212 |
| 213 ~ScopedGPUTrace() { gpu_tracer_->End(source_); } | 213 ~ScopedGPUTrace() { gpu_tracer_->End(source_); } |
| 214 | 214 |
| 215 private: | 215 private: |
| 216 GPUTracer* gpu_tracer_; | 216 GPUTracer* gpu_tracer_; |
| 217 GpuTracerSource source_; | 217 GpuTracerSource source_; |
| 218 }; | 218 }; |
| 219 | 219 |
| 220 } // namespace gles2 | 220 } // namespace gles2 |
| 221 } // namespace gpu | 221 } // namespace gpu |
| 222 | 222 |
| 223 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ | 223 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ |
| OLD | NEW |