| 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 <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
| 15 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 15 #include "gpu/gpu_export.h" | 16 #include "gpu/gpu_export.h" |
| 16 #include "ui/gl/gl_bindings.h" | 17 #include "ui/gl/gl_bindings.h" |
| 17 | 18 |
| 18 namespace gpu { | 19 namespace gpu { |
| 19 namespace gles2 { | 20 namespace gles2 { |
| 20 | 21 |
| 21 // Traces GPU Commands. | 22 // Traces GPU Commands. |
| 22 class GPUTracer { | 23 class GPUTracer { |
| 23 public: | 24 public: |
| 24 static scoped_ptr<GPUTracer> Create(); | 25 static scoped_ptr<GPUTracer> Create( |
| 26 base::WeakPtr<gles2::GLES2Decoder> decoder); |
| 25 | 27 |
| 26 GPUTracer() {} | 28 explicit GPUTracer(base::WeakPtr<gles2::GLES2Decoder> decoder); |
| 27 virtual ~GPUTracer() {} | 29 virtual ~GPUTracer(); |
| 28 | 30 |
| 29 // Begin a trace. | 31 // Begin a trace. |
| 30 virtual bool Begin(const std::string& name) = 0; | 32 virtual bool Begin(const std::string& name) = 0; |
| 31 | 33 |
| 32 // End the last started trace. | 34 // End the last started trace. |
| 33 virtual bool End() = 0; | 35 virtual bool End() = 0; |
| 34 | 36 |
| 35 // Retrieve the name of the current open trace. | 37 // Retrieve the name of the current open trace. |
| 36 // Returns empty string if no current open trace. | 38 // Returns empty string if no current open trace. |
| 37 virtual const std::string& CurrentName() const = 0; | 39 virtual const std::string& CurrentName() const = 0; |
| 38 | 40 |
| 41 base::WeakPtr<gles2::GLES2Decoder> decoder_; |
| 42 |
| 39 private: | 43 private: |
| 40 DISALLOW_COPY_AND_ASSIGN(GPUTracer); | 44 DISALLOW_COPY_AND_ASSIGN(GPUTracer); |
| 41 }; | 45 }; |
| 42 | 46 |
| 43 class Outputter : public base::RefCounted<Outputter> { | 47 class Outputter : public base::RefCounted<Outputter> { |
| 44 public: | 48 public: |
| 45 virtual void Trace(const std::string& name, | 49 virtual void Trace(const std::string& name, |
| 46 int64 start_time, | 50 int64 start_time, |
| 47 int64 end_time) = 0; | 51 int64 end_time) = 0; |
| 48 | 52 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 125 |
| 122 GLuint queries_[2]; | 126 GLuint queries_[2]; |
| 123 | 127 |
| 124 DISALLOW_COPY_AND_ASSIGN(GLARBTimerTrace); | 128 DISALLOW_COPY_AND_ASSIGN(GLARBTimerTrace); |
| 125 }; | 129 }; |
| 126 | 130 |
| 127 } // namespace gles2 | 131 } // namespace gles2 |
| 128 } // namespace gpu | 132 } // namespace gpu |
| 129 | 133 |
| 130 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ | 134 #endif // GPU_COMMAND_BUFFER_SERVICE_GPU_TRACER_H_ |
| OLD | NEW |