OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ | 5 #ifndef CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ |
6 #define CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ | 6 #define CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // BeginFrameSource. | 131 // BeginFrameSource. |
132 // - Use the CallOnBeginFrame method to call to the observer(s). | 132 // - Use the CallOnBeginFrame method to call to the observer(s). |
133 // - Recommended (but not required) to call BeginFrameSourceMixIn::AsValueInto | 133 // - Recommended (but not required) to call BeginFrameSourceMixIn::AsValueInto |
134 // in their own AsValueInto implementation. | 134 // in their own AsValueInto implementation. |
135 class CC_EXPORT BeginFrameSourceMixIn : public BeginFrameSource { | 135 class CC_EXPORT BeginFrameSourceMixIn : public BeginFrameSource { |
136 public: | 136 public: |
137 ~BeginFrameSourceMixIn() override {} | 137 ~BeginFrameSourceMixIn() override {} |
138 | 138 |
139 // BeginFrameSource | 139 // BeginFrameSource |
140 bool NeedsBeginFrames() const override; | 140 bool NeedsBeginFrames() const override; |
141 void SetNeedsBeginFrames(bool needs_begin_frames) override; | 141 void SetNeedsBeginFrames(bool needs_begin_frames) final; |
142 void DidFinishFrame(size_t remaining_frames) override {} | 142 void DidFinishFrame(size_t remaining_frames) override {} |
143 void AddObserver(BeginFrameObserver* obs) final; | 143 void AddObserver(BeginFrameObserver* obs) final; |
144 void RemoveObserver(BeginFrameObserver* obs) final; | 144 void RemoveObserver(BeginFrameObserver* obs) final; |
145 void SetClientReady() override {} | 145 void SetClientReady() override {} |
146 | 146 |
147 // Tracing support - Recommend (but not required) to call this implementation | 147 // Tracing support - Recommend (but not required) to call this implementation |
148 // in any override. | 148 // in any override. |
149 void AsValueInto(base::debug::TracedValue* dict) const override; | 149 void AsValueInto(base::debug::TracedValue* dict) const override; |
150 | 150 |
151 protected: | 151 protected: |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 | 254 |
255 // BeginFrameObserver | 255 // BeginFrameObserver |
256 // The mux is an BeginFrameObserver as it needs to proxy the OnBeginFrame | 256 // The mux is an BeginFrameObserver as it needs to proxy the OnBeginFrame |
257 // calls to preserve the monotonicity of the BeginFrameArgs when switching | 257 // calls to preserve the monotonicity of the BeginFrameArgs when switching |
258 // sources. | 258 // sources. |
259 void OnBeginFrame(const BeginFrameArgs& args) override; | 259 void OnBeginFrame(const BeginFrameArgs& args) override; |
260 const BeginFrameArgs LastUsedBeginFrameArgs() const override; | 260 const BeginFrameArgs LastUsedBeginFrameArgs() const override; |
261 | 261 |
262 // BeginFrameSource | 262 // BeginFrameSource |
263 bool NeedsBeginFrames() const override; | 263 bool NeedsBeginFrames() const override; |
264 void SetNeedsBeginFrames(bool needs_begin_frames) override; | |
265 void DidFinishFrame(size_t remaining_frames) override; | 264 void DidFinishFrame(size_t remaining_frames) override; |
266 | 265 |
| 266 // BeginFrameSourceMixIn |
| 267 void OnNeedsBeginFramesChange(bool needs_begin_frames) override; |
| 268 |
267 // Tracing | 269 // Tracing |
268 void AsValueInto(base::debug::TracedValue* dict) const override; | 270 void AsValueInto(base::debug::TracedValue* dict) const override; |
269 | 271 |
270 protected: | 272 protected: |
271 BeginFrameSourceMultiplexer(); | 273 BeginFrameSourceMultiplexer(); |
272 explicit BeginFrameSourceMultiplexer(base::TimeDelta minimum_interval); | 274 explicit BeginFrameSourceMultiplexer(base::TimeDelta minimum_interval); |
273 | 275 |
274 bool HasSource(BeginFrameSource* source); | 276 bool HasSource(BeginFrameSource* source); |
275 bool IsIncreasing(const BeginFrameArgs& args); | 277 bool IsIncreasing(const BeginFrameArgs& args); |
276 | 278 |
277 base::TimeDelta minimum_interval_; | 279 base::TimeDelta minimum_interval_; |
278 | 280 |
279 BeginFrameSource* active_source_; | 281 BeginFrameSource* active_source_; |
280 std::set<BeginFrameSource*> source_list_; | 282 std::set<BeginFrameSource*> source_list_; |
281 }; | 283 }; |
282 | 284 |
283 } // namespace cc | 285 } // namespace cc |
284 | 286 |
285 #endif // CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ | 287 #endif // CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ |
OLD | NEW |