Chromium Code Reviews| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 159 // needs_begin_frames change. | 159 // needs_begin_frames change. |
| 160 virtual void OnNeedsBeginFramesChange(bool needs_begin_frames) {} | 160 virtual void OnNeedsBeginFramesChange(bool needs_begin_frames) {} |
| 161 | 161 |
| 162 BeginFrameObserver* observer_; | 162 BeginFrameObserver* observer_; |
| 163 bool needs_begin_frames_; | 163 bool needs_begin_frames_; |
| 164 | 164 |
| 165 private: | 165 private: |
| 166 bool inside_as_value_into_; | 166 bool inside_as_value_into_; |
| 167 }; | 167 }; |
| 168 | 168 |
| 169 class CC_EXPORT ProxyBeginFrameSource : public BeginFrameSource { | |
|
mithro-old
2015/03/23 11:32:17
If I understand correctly, this just takes a messa
simonhong
2015/03/23 11:46:39
Yes, right.
| |
| 170 public: | |
| 171 class Delegate { | |
| 172 public: | |
| 173 virtual void SetChildrenNeedBeginFrames(bool needs_begin_frames) = 0; | |
| 174 }; | |
| 175 | |
| 176 ProxyBeginFrameSource(); | |
| 177 ~ProxyBeginFrameSource() override; | |
| 178 | |
| 179 // BeginFrameSource | |
| 180 bool NeedsBeginFrames() const override; | |
| 181 // SetNeedsBeginFrames() is not used for now. | |
| 182 // Instead, turning BeginFrame on/off is controlled by Add/RemoveObserver. | |
|
mithro-old
2015/03/23 11:32:17
I think this violates the BeginFrameSource interfa
simonhong
2015/03/23 11:46:39
This is special login for ProxyBeginFrameSource.
W
| |
| 183 void SetNeedsBeginFrames(bool needs_begin_frames) override {} | |
| 184 void DidFinishFrame(size_t remaining_frames) override {} | |
| 185 void AddObserver(BeginFrameObserver* obs) override; | |
| 186 void RemoveObserver(BeginFrameObserver* obs) override; | |
| 187 void SetClientReady() override {} | |
| 188 void AsValueInto(base::debug::TracedValue* dict) const override; | |
| 189 | |
| 190 void set_delegate(Delegate* delegate) { | |
|
mithro-old
2015/03/23 11:32:17
Why is this set_delegate rather than SetDelegate?
simonhong
2015/03/23 11:46:39
As I know, this style is used for just get/set met
| |
| 191 delegate_ = delegate; | |
| 192 } | |
| 193 | |
| 194 // virtual for testing. | |
| 195 virtual void BeginFrames(const BeginFrameArgs& args); | |
| 196 | |
| 197 private: | |
| 198 Delegate* delegate_; // Not owned. | |
| 199 // Used to send to any new BeginFrameObserver immediately. | |
| 200 BeginFrameArgs missed_begin_frame_args_; | |
| 201 ObserverList<BeginFrameObserver> observer_list_; | |
| 202 | |
| 203 DISALLOW_COPY_AND_ASSIGN(ProxyBeginFrameSource); | |
| 204 }; | |
| 205 | |
| 206 | |
| 169 // A frame source which calls BeginFrame (at the next possible time) as soon as | 207 // A frame source which calls BeginFrame (at the next possible time) as soon as |
| 170 // remaining frames reaches zero. | 208 // remaining frames reaches zero. |
| 171 class CC_EXPORT BackToBackBeginFrameSource : public BeginFrameSourceMixIn { | 209 class CC_EXPORT BackToBackBeginFrameSource : public BeginFrameSourceMixIn { |
| 172 public: | 210 public: |
| 173 static scoped_ptr<BackToBackBeginFrameSource> Create( | 211 static scoped_ptr<BackToBackBeginFrameSource> Create( |
| 174 base::SingleThreadTaskRunner* task_runner); | 212 base::SingleThreadTaskRunner* task_runner); |
| 175 ~BackToBackBeginFrameSource() override; | 213 ~BackToBackBeginFrameSource() override; |
| 176 | 214 |
| 177 // BeginFrameSource | 215 // BeginFrameSource |
| 178 void DidFinishFrame(size_t remaining_frames) override; | 216 void DidFinishFrame(size_t remaining_frames) override; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 276 | 314 |
| 277 base::TimeDelta minimum_interval_; | 315 base::TimeDelta minimum_interval_; |
| 278 | 316 |
| 279 BeginFrameSource* active_source_; | 317 BeginFrameSource* active_source_; |
| 280 std::set<BeginFrameSource*> source_list_; | 318 std::set<BeginFrameSource*> source_list_; |
| 281 }; | 319 }; |
| 282 | 320 |
| 283 } // namespace cc | 321 } // namespace cc |
| 284 | 322 |
| 285 #endif // CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ | 323 #endif // CC_SCHEDULER_BEGIN_FRAME_SOURCE_H_ |
| OLD | NEW |