| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 #ifndef UI_GL_GPU_TIMING_H_ | 5 #ifndef UI_GL_GPU_TIMING_H_ |
| 6 #define UI_GL_GPU_TIMING_H_ | 6 #define UI_GL_GPU_TIMING_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <queue> | 11 #include <queue> |
| 12 | 12 |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/scoped_ptr.h" | |
| 16 #include "ui/gl/gl_export.h" | 15 #include "ui/gl/gl_export.h" |
| 17 | 16 |
| 18 // The gpu_timing classes handles the abstraction of GL GPU Timing extensions | 17 // The gpu_timing classes handles the abstraction of GL GPU Timing extensions |
| 19 // into a common set of functions. Currently the different timer extensions that | 18 // into a common set of functions. Currently the different timer extensions that |
| 20 // are supported are EXT_timer_query, ARB_timer_query and | 19 // are supported are EXT_timer_query, ARB_timer_query and |
| 21 // EXT_disjoint_timer_query. | 20 // EXT_disjoint_timer_query. |
| 22 // | 21 // |
| 23 // Explanation of Classes: | 22 // Explanation of Classes: |
| 24 // GPUTiming - GPU Timing is a private class which is only owned by the | 23 // GPUTiming - GPU Timing is a private class which is only owned by the |
| 25 // underlying GLContextReal class. This class handles any GL Context level | 24 // underlying GLContextReal class. This class handles any GL Context level |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 DISALLOW_COPY_AND_ASSIGN(GPUTimer); | 121 DISALLOW_COPY_AND_ASSIGN(GPUTimer); |
| 123 }; | 122 }; |
| 124 | 123 |
| 125 // GPUTimingClient contains all the gl timing logic that is not specific | 124 // GPUTimingClient contains all the gl timing logic that is not specific |
| 126 // to a single GPUTimer. | 125 // to a single GPUTimer. |
| 127 class GL_EXPORT GPUTimingClient | 126 class GL_EXPORT GPUTimingClient |
| 128 : public base::RefCounted<GPUTimingClient> { | 127 : public base::RefCounted<GPUTimingClient> { |
| 129 public: | 128 public: |
| 130 explicit GPUTimingClient(GPUTimingImpl* gpu_timing = nullptr); | 129 explicit GPUTimingClient(GPUTimingImpl* gpu_timing = nullptr); |
| 131 | 130 |
| 132 scoped_ptr<GPUTimer> CreateGPUTimer(bool prefer_elapsed_time); | 131 std::unique_ptr<GPUTimer> CreateGPUTimer(bool prefer_elapsed_time); |
| 133 bool IsAvailable(); | 132 bool IsAvailable(); |
| 134 | 133 |
| 135 const char* GetTimerTypeName() const; | 134 const char* GetTimerTypeName() const; |
| 136 | 135 |
| 137 // CheckAndResetTimerErrors has to be called before reading timestamps | 136 // CheckAndResetTimerErrors has to be called before reading timestamps |
| 138 // from GPUTimers instances and after making sure all the timers | 137 // from GPUTimers instances and after making sure all the timers |
| 139 // were available. | 138 // were available. |
| 140 // If the returned value is false, all the previous timers should be | 139 // If the returned value is false, all the previous timers should be |
| 141 // discarded. | 140 // discarded. |
| 142 bool CheckAndResetTimerErrors(); | 141 bool CheckAndResetTimerErrors(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 156 GPUTimingImpl* gpu_timing_; | 155 GPUTimingImpl* gpu_timing_; |
| 157 GPUTiming::TimerType timer_type_ = GPUTiming::kTimerTypeInvalid; | 156 GPUTiming::TimerType timer_type_ = GPUTiming::kTimerTypeInvalid; |
| 158 uint32_t disjoint_counter_ = 0; | 157 uint32_t disjoint_counter_ = 0; |
| 159 | 158 |
| 160 DISALLOW_COPY_AND_ASSIGN(GPUTimingClient); | 159 DISALLOW_COPY_AND_ASSIGN(GPUTimingClient); |
| 161 }; | 160 }; |
| 162 | 161 |
| 163 } // namespace gfx | 162 } // namespace gfx |
| 164 | 163 |
| 165 #endif // UI_GL_GPU_TIMING_H_ | 164 #endif // UI_GL_GPU_TIMING_H_ |
| OLD | NEW |