| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 129 | 129 | 
| 130 // Simple base class which implements a BeginFrameSource. | 130 // Simple base class which implements a BeginFrameSource. | 
| 131 // Implementation classes should: | 131 // Implementation classes should: | 
| 132 //  - Implement the pure virtual (Set)NeedsBeginFrames methods from | 132 //  - Implement the pure virtual (Set)NeedsBeginFrames methods from | 
| 133 //    BeginFrameSource. | 133 //    BeginFrameSource. | 
| 134 //  - Use the CallOnBeginFrame method to call to the observer(s). | 134 //  - Use the CallOnBeginFrame method to call to the observer(s). | 
| 135 //  - Recommended (but not required) to call BeginFrameSourceBase::AsValueInto | 135 //  - Recommended (but not required) to call BeginFrameSourceBase::AsValueInto | 
| 136 //    in their own AsValueInto implementation. | 136 //    in their own AsValueInto implementation. | 
| 137 class CC_EXPORT BeginFrameSourceBase : public BeginFrameSource { | 137 class CC_EXPORT BeginFrameSourceBase : public BeginFrameSource { | 
| 138  public: | 138  public: | 
| 139   ~BeginFrameSourceBase() override {} | 139   ~BeginFrameSourceBase() override; | 
| 140 | 140 | 
| 141   // BeginFrameSource | 141   // BeginFrameSource | 
| 142   bool NeedsBeginFrames() const final; | 142   bool NeedsBeginFrames() const final; | 
| 143   void SetNeedsBeginFrames(bool needs_begin_frames) final; | 143   void SetNeedsBeginFrames(bool needs_begin_frames) final; | 
| 144   void DidFinishFrame(size_t remaining_frames) override {} | 144   void DidFinishFrame(size_t remaining_frames) override {} | 
| 145   void AddObserver(BeginFrameObserver* obs) final; | 145   void AddObserver(BeginFrameObserver* obs) final; | 
| 146   void RemoveObserver(BeginFrameObserver* obs) final; | 146   void RemoveObserver(BeginFrameObserver* obs) final; | 
| 147   void SetClientReady() override {} | 147   void SetClientReady() override {} | 
| 148 | 148 | 
| 149   // Tracing support - Recommend (but not required) to call this implementation | 149   // Tracing support - Recommend (but not required) to call this implementation | 
| 150   // in any override. | 150   // in any override. | 
| 151   void AsValueInto(base::trace_event::TracedValue* dict) const override; | 151   void AsValueInto(base::trace_event::TracedValue* dict) const override; | 
| 152 | 152 | 
| 153  protected: | 153  protected: | 
| 154   BeginFrameSourceBase(); | 154   BeginFrameSourceBase(); | 
| 155 | 155 | 
| 156   // These methods should be used by subclasses to make the call to the | 156   // These methods should be used by subclasses to make the call to the | 
| 157   // observers. | 157   // observers. | 
| 158   void CallOnBeginFrame(const BeginFrameArgs& args); | 158   void CallOnBeginFrame(const BeginFrameArgs& args); | 
| 159 | 159 | 
| 160   // This method should be overridden if you want to change some behaviour on | 160   // This method should be overridden if you want to change some behaviour on | 
| 161   // needs_begin_frames change. | 161   // needs_begin_frames change. | 
| 162   virtual void OnNeedsBeginFramesChange(bool needs_begin_frames) {} | 162   virtual void OnNeedsBeginFramesChange(bool needs_begin_frames) {} | 
| 163 | 163 | 
| 164   BeginFrameObserver* observer_; | 164   base::ObserverList<const BeginFrameObserver>::Iterator | 
|  | 165   getConstObserverListIterator() const; | 
|  | 166   base::ObserverList<BeginFrameObserver> observer_list_; | 
| 165   bool needs_begin_frames_; | 167   bool needs_begin_frames_; | 
| 166 | 168 | 
| 167  private: | 169  private: | 
| 168   bool inside_as_value_into_; | 170   bool inside_as_value_into_; | 
| 169 | 171 | 
| 170   DISALLOW_COPY_AND_ASSIGN(BeginFrameSourceBase); | 172   DISALLOW_COPY_AND_ASSIGN(BeginFrameSourceBase); | 
| 171 }; | 173 }; | 
| 172 | 174 | 
| 173 // A frame source which calls BeginFrame (at the next possible time) as soon as | 175 // A frame source which calls BeginFrame (at the next possible time) as soon as | 
| 174 // remaining frames reaches zero. | 176 // remaining frames reaches zero. | 
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 283   BeginFrameSource* active_source_; | 285   BeginFrameSource* active_source_; | 
| 284   std::set<BeginFrameSource*> source_list_; | 286   std::set<BeginFrameSource*> source_list_; | 
| 285 | 287 | 
| 286  private: | 288  private: | 
| 287   DISALLOW_COPY_AND_ASSIGN(BeginFrameSourceMultiplexer); | 289   DISALLOW_COPY_AND_ASSIGN(BeginFrameSourceMultiplexer); | 
| 288 }; | 290 }; | 
| 289 | 291 | 
| 290 }  // namespace cc | 292 }  // namespace cc | 
| 291 | 293 | 
| 292 #endif  // CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ | 294 #endif  // CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ | 
| OLD | NEW | 
|---|