| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 // BeginFrameObservers use DidFinishFrame to acknowledge that they have | 112 // BeginFrameObservers use DidFinishFrame to acknowledge that they have |
| 113 // completed handling a BeginFrame. | 113 // completed handling a BeginFrame. |
| 114 // | 114 // |
| 115 // The DisplayScheduler uses these acknowledgments to trigger an early | 115 // The DisplayScheduler uses these acknowledgments to trigger an early |
| 116 // deadline once all BeginFrameObservers have completed a frame. | 116 // deadline once all BeginFrameObservers have completed a frame. |
| 117 // | 117 // |
| 118 // They also provide back pressure to a frame source about frame processing | 118 // They also provide back pressure to a frame source about frame processing |
| 119 // (rather than toggling SetNeedsBeginFrames every frame). For example, the | 119 // (rather than toggling SetNeedsBeginFrames every frame). For example, the |
| 120 // BackToBackFrameSource uses them to make sure only one frame is pending at a | 120 // BackToBackFrameSource uses them to make sure only one frame is pending at a |
| 121 // time. | 121 // time. |
| 122 // |
| 123 // Note that the BeginFrameSource should not assume that the |ack| references |
| 124 // a valid BeginFrame sent by the source. The |ack| may reference a BeginFrame |
| 125 // sent by a different BeginFrameSource, and a malicious client may reference |
| 126 // any invalid frame. The source is responsible for checking for |
| 127 // validity/relevance of the BeginFrame itself. |
| 122 // TODO(eseckler): Use BeginFrameAcks in DisplayScheduler as described above. | 128 // TODO(eseckler): Use BeginFrameAcks in DisplayScheduler as described above. |
| 123 virtual void DidFinishFrame(BeginFrameObserver* obs, | 129 virtual void DidFinishFrame(BeginFrameObserver* obs, |
| 124 const BeginFrameAck& ack) = 0; | 130 const BeginFrameAck& ack) = 0; |
| 125 | 131 |
| 126 // Add/Remove an observer from the source. When no observers are added the BFS | 132 // Add/Remove an observer from the source. When no observers are added the BFS |
| 127 // should shut down its timers, disable vsync, etc. | 133 // should shut down its timers, disable vsync, etc. |
| 128 virtual void AddObserver(BeginFrameObserver* obs) = 0; | 134 virtual void AddObserver(BeginFrameObserver* obs) = 0; |
| 129 virtual void RemoveObserver(BeginFrameObserver* obs) = 0; | 135 virtual void RemoveObserver(BeginFrameObserver* obs) = 0; |
| 130 | 136 |
| 131 // Returns false if the begin frame source will just continue to produce | 137 // Returns false if the begin frame source will just continue to produce |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 bool frame_active_ = false; | 318 bool frame_active_ = false; |
| 313 BeginFrameObserverAckTracker ack_tracker_; | 319 BeginFrameObserverAckTracker ack_tracker_; |
| 314 | 320 |
| 315 private: | 321 private: |
| 316 DISALLOW_COPY_AND_ASSIGN(ExternalBeginFrameSource); | 322 DISALLOW_COPY_AND_ASSIGN(ExternalBeginFrameSource); |
| 317 }; | 323 }; |
| 318 | 324 |
| 319 } // namespace cc | 325 } // namespace cc |
| 320 | 326 |
| 321 #endif // CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ | 327 #endif // CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ |
| OLD | NEW |