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 #include "cc/scheduler/begin_frame_source.h" | 5 #include "cc/scheduler/begin_frame_source.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 DCHECK(args.frame_time >= last_begin_frame_args_.frame_time); | 42 DCHECK(args.frame_time >= last_begin_frame_args_.frame_time); |
43 bool used = OnBeginFrameDerivedImpl(args); | 43 bool used = OnBeginFrameDerivedImpl(args); |
44 if (used) { | 44 if (used) { |
45 last_begin_frame_args_ = args; | 45 last_begin_frame_args_ = args; |
46 } else { | 46 } else { |
47 ++dropped_begin_frame_args_; | 47 ++dropped_begin_frame_args_; |
48 } | 48 } |
49 } | 49 } |
50 | 50 |
51 // BeginFrameSourceBase ------------------------------------------------------ | 51 // BeginFrameSourceBase ------------------------------------------------------ |
52 BeginFrameSourceBase::BeginFrameSourceBase() | 52 BeginFrameSourceBase::BeginFrameSourceBase() : paused_(false) {} |
53 : paused_(false), inside_as_value_into_(false) {} | |
54 | 53 |
55 BeginFrameSourceBase::~BeginFrameSourceBase() {} | 54 BeginFrameSourceBase::~BeginFrameSourceBase() {} |
56 | 55 |
57 void BeginFrameSourceBase::AddObserver(BeginFrameObserver* obs) { | 56 void BeginFrameSourceBase::AddObserver(BeginFrameObserver* obs) { |
58 DEBUG_FRAMES("BeginFrameSourceBase::AddObserver", "num observers", | 57 DEBUG_FRAMES("BeginFrameSourceBase::AddObserver", "num observers", |
59 observers_.size(), "to add observer", obs); | 58 observers_.size(), "to add observer", obs); |
60 DCHECK(obs); | 59 DCHECK(obs); |
61 DCHECK(observers_.find(obs) == observers_.end()) | 60 DCHECK(observers_.find(obs) == observers_.end()) |
62 << "AddObserver cannot be called with an observer that was already added"; | 61 << "AddObserver cannot be called with an observer that was already added"; |
63 bool observers_was_empty = observers_.empty(); | 62 bool observers_was_empty = observers_.empty(); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 BeginFrameArgs last_args = it->LastUsedBeginFrameArgs(); | 227 BeginFrameArgs last_args = it->LastUsedBeginFrameArgs(); |
229 if (!last_args.IsValid() || | 228 if (!last_args.IsValid() || |
230 (args.frame_time > | 229 (args.frame_time > |
231 last_args.frame_time + args.interval / kDoubleTickDivisor)) { | 230 last_args.frame_time + args.interval / kDoubleTickDivisor)) { |
232 it->OnBeginFrame(args); | 231 it->OnBeginFrame(args); |
233 } | 232 } |
234 } | 233 } |
235 } | 234 } |
236 | 235 |
237 } // namespace cc | 236 } // namespace cc |
OLD | NEW |