OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_COMPOSITOR_GPU_VSYNC_BEGIN_FRAME_SOURCE_H_ |
| 6 #define CONTENT_BROWSER_COMPOSITOR_GPU_VSYNC_BEGIN_FRAME_SOURCE_H_ |
| 7 |
| 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/time/time.h" |
| 10 #include "cc/scheduler/begin_frame_source.h" |
| 11 |
| 12 namespace content { |
| 13 |
| 14 // This class is used to control VSync production on GPU side. |
| 15 class GpuVSyncControl { |
| 16 public: |
| 17 virtual void SetNeedsVSync(bool needs_vsync) = 0; |
| 18 }; |
| 19 |
| 20 // This is a type of ExternalBeginFrameSource where VSync signals are |
| 21 // generated externally on GPU side. |
| 22 class GpuVSyncBeginFrameSource : public cc::ExternalBeginFrameSource, |
| 23 cc::ExternalBeginFrameSourceClient { |
| 24 public: |
| 25 explicit GpuVSyncBeginFrameSource(GpuVSyncControl* vsync_control); |
| 26 ~GpuVSyncBeginFrameSource() override; |
| 27 |
| 28 // cc::ExternalBeginFrameSourceClient implementation. |
| 29 void OnNeedsBeginFrames(bool needs_begin_frames) override; |
| 30 void OnDidFinishFrame(const cc::BeginFrameAck& ack) override; |
| 31 |
| 32 void OnVSync(base::TimeTicks timestamp, base::TimeDelta interval); |
| 33 |
| 34 private: |
| 35 GpuVSyncControl* const vsync_control_; |
| 36 bool needs_begin_frames_; |
| 37 uint64_t next_sequence_number_; |
| 38 |
| 39 DISALLOW_COPY_AND_ASSIGN(GpuVSyncBeginFrameSource); |
| 40 }; |
| 41 |
| 42 } // namespace content |
| 43 |
| 44 #endif // CONTENT_BROWSER_COMPOSITOR_GPU_VSYNC_BEGIN_FRAME_SOURCE_H_ |
OLD | NEW |