OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 CONTENT_BROWSER_COMPOSITOR_GPU_VSYNC_BEGIN_FRAME_SOURCE_H_ | 5 #ifndef CONTENT_BROWSER_COMPOSITOR_GPU_VSYNC_BEGIN_FRAME_SOURCE_H_ |
6 #define CONTENT_BROWSER_COMPOSITOR_GPU_VSYNC_BEGIN_FRAME_SOURCE_H_ | 6 #define CONTENT_BROWSER_COMPOSITOR_GPU_VSYNC_BEGIN_FRAME_SOURCE_H_ |
7 | 7 |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "cc/scheduler/begin_frame_source.h" | 10 #include "cc/scheduler/begin_frame_source.h" |
11 #include "content/common/content_export.h" | |
11 | 12 |
12 namespace content { | 13 namespace content { |
13 | 14 |
14 // This class is used to control VSync production on GPU side. | 15 // This class is used to control VSync production on GPU side. |
15 class GpuVSyncControl { | 16 class CONTENT_EXPORT GpuVSyncControl { |
16 public: | 17 public: |
17 virtual void SetNeedsVSync(bool needs_vsync) = 0; | 18 virtual void SetNeedsVSync(bool needs_vsync) = 0; |
18 }; | 19 }; |
19 | 20 |
20 // This is a type of ExternalBeginFrameSource where VSync signals are | 21 // This is a type of ExternalBeginFrameSource where VSync signals are |
21 // generated externally on GPU side. | 22 // generated externally on GPU side. |
22 class GpuVSyncBeginFrameSource : public cc::ExternalBeginFrameSource, | 23 class CONTENT_EXPORT GpuVSyncBeginFrameSource |
23 cc::ExternalBeginFrameSourceClient { | 24 : public cc::ExternalBeginFrameSource, |
25 cc::ExternalBeginFrameSourceClient { | |
sunnyps
2017/05/30 22:13:17
nit: public cc::ExternalBeginFrameSourceClient
stanisc
2017/05/31 01:17:53
This inheritance doesn't need to be public because
sunnyps
2017/05/31 01:26:02
google style guide prohibits private inheritance:
stanisc
2017/05/31 17:33:12
Thanks to pointing out to that! Done.
| |
24 public: | 26 public: |
25 explicit GpuVSyncBeginFrameSource(GpuVSyncControl* vsync_control); | 27 explicit GpuVSyncBeginFrameSource(GpuVSyncControl* vsync_control); |
26 ~GpuVSyncBeginFrameSource() override; | 28 ~GpuVSyncBeginFrameSource() override; |
27 | 29 |
28 // cc::ExternalBeginFrameSourceClient implementation. | 30 // cc::ExternalBeginFrameSourceClient implementation. |
29 void OnNeedsBeginFrames(bool needs_begin_frames) override; | 31 void OnNeedsBeginFrames(bool needs_begin_frames) override; |
30 | 32 |
31 void OnVSync(base::TimeTicks timestamp, base::TimeDelta interval); | 33 void OnVSync(base::TimeTicks timestamp, base::TimeDelta interval); |
32 | 34 |
35 protected: | |
36 // Virtual for testing. | |
37 virtual base::TimeTicks Now() const; | |
38 | |
33 private: | 39 private: |
40 bool GetMissedBeginFrameArgs(cc::BeginFrameObserver* obs, | |
41 cc::BeginFrameArgs* missed_args) override; | |
42 | |
34 GpuVSyncControl* const vsync_control_; | 43 GpuVSyncControl* const vsync_control_; |
35 bool needs_begin_frames_; | 44 bool needs_begin_frames_; |
36 uint64_t next_sequence_number_; | 45 uint64_t next_sequence_number_; |
37 | 46 |
38 DISALLOW_COPY_AND_ASSIGN(GpuVSyncBeginFrameSource); | 47 DISALLOW_COPY_AND_ASSIGN(GpuVSyncBeginFrameSource); |
39 }; | 48 }; |
40 | 49 |
41 } // namespace content | 50 } // namespace content |
42 | 51 |
43 #endif // CONTENT_BROWSER_COMPOSITOR_GPU_VSYNC_BEGIN_FRAME_SOURCE_H_ | 52 #endif // CONTENT_BROWSER_COMPOSITOR_GPU_VSYNC_BEGIN_FRAME_SOURCE_H_ |
OLD | NEW |