Chromium Code Reviews| Index: gpu/command_buffer/service/gpu_timing.h |
| diff --git a/gpu/command_buffer/service/gpu_timing.h b/gpu/command_buffer/service/gpu_timing.h |
| index 726ac4e5f776a19a466276edd017a4a48cfc0446..97cc3192c73947c6759ea49e6382411df6be9cd6 100644 |
| --- a/gpu/command_buffer/service/gpu_timing.h |
| +++ b/gpu/command_buffer/service/gpu_timing.h |
| @@ -5,6 +5,8 @@ |
| #ifndef GPU_COMMAND_BUFFER_SERVICE_GPU_TIMING_H_ |
| #define GPU_COMMAND_BUFFER_SERVICE_GPU_TIMING_H_ |
| +#include <vector> |
| + |
| #include "base/callback.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "gpu/gpu_export.h" |
| @@ -51,19 +53,24 @@ class GPU_EXPORT GPUTiming { |
| kTimerTypeDisjoint // EXT_disjoint_timer_query |
| }; |
| - GPUTiming(); |
| + GPUTiming(gfx::GLContext* gl_context = NULL); |
|
Daniele Castagna
2015/02/23 22:21:19
nit: explicit
Why do you pass the context here? A
|
| virtual ~GPUTiming(); |
| - bool Initialize(gfx::GLContext* context); |
| + void Initialize(gfx::GLContext* gl_context); |
| bool IsAvailable(); |
| + int CreateDisjointContextID(); |
| + bool ReleaseDisjointContextID(int disjoint_context_id); |
| + int GetDisjointContextIDCount() const; |
| + |
| // CheckAndResetTimerErrors has to be called before reading timestamps |
| // from GPUTimers instances and after making sure all the timers |
| // were available. |
| // If the returned value is false, all the previous timers should be |
| // discarded. |
| - bool CheckAndResetTimerErrors(); |
| - |
| + bool CheckAndResetTimerErrors(int disjoint_context_id); |
|
Daniele Castagna
2015/02/23 22:21:19
Can you leave the previous method as well, so that
|
| + |
| + TimerType GetTimerType() const { return timer_type_; } |
| const char* GetTimerTypeName() const; |
| // Returns the offset between the current gpu time and the cpu time. |
| @@ -71,14 +78,24 @@ class GPU_EXPORT GPUTiming { |
| void InvalidateTimerOffset(); |
| void SetCpuTimeForTesting(const base::Callback<int64(void)>& cpu_time); |
| - void SetOffsetForTesting(int64 offset, bool cache_it); |
| - void SetTimerTypeForTesting(TimerType type); |
| private: |
| TimerType timer_type_ = kTimerTypeInvalid; |
| int64 offset_ = 0; // offset cache when timer_type_ == kTimerTypeARB |
| bool offset_valid_ = false; |
| + bool disjoint_occurred_ = false; |
| base::Callback<int64(void)> cpu_time_for_testing_; |
| + |
| + struct DisjointContext { |
| + DisjointContext(bool initial_value) |
| + : valid_(true), |
| + disjoint_value_(initial_value) { |
| + } |
| + bool valid_; |
| + bool disjoint_value_; |
| + }; |
| + std::vector<DisjointContext> disjoint_contexts_; |
|
Daniele Castagna
2015/02/23 22:21:19
You never shrink this vector when a context is rel
|
| + |
| friend class GPUTimer; |
| DISALLOW_COPY_AND_ASSIGN(GPUTiming); |
| }; |