Index: cc/scheduler/begin_frame_source.cc |
diff --git a/cc/scheduler/begin_frame_source.cc b/cc/scheduler/begin_frame_source.cc |
index e0bc5e0a48a0133f35bcf389b05917e5f3c8bdd3..b429ba580de54d8c10d9997d4b9b88d1c7d5514f 100644 |
--- a/cc/scheduler/begin_frame_source.cc |
+++ b/cc/scheduler/begin_frame_source.cc |
@@ -24,38 +24,6 @@ namespace { |
static const double kDoubleTickDivisor = 2.0; |
} |
-// BeginFrameObserverBase ----------------------------------------------- |
-BeginFrameObserverBase::BeginFrameObserverBase() |
- : last_begin_frame_args_(), dropped_begin_frame_args_(0) { |
-} |
- |
-const BeginFrameArgs& BeginFrameObserverBase::LastUsedBeginFrameArgs() const { |
- return last_begin_frame_args_; |
-} |
-void BeginFrameObserverBase::OnBeginFrame(const BeginFrameArgs& args) { |
- DEBUG_FRAMES("BeginFrameObserverBase::OnBeginFrame", |
- "last args", |
- last_begin_frame_args_.AsValue(), |
- "new args", |
- args.AsValue()); |
- DCHECK(args.IsValid()); |
- DCHECK(args.frame_time >= last_begin_frame_args_.frame_time); |
- bool used = OnBeginFrameDerivedImpl(args); |
- if (used) { |
- last_begin_frame_args_ = args; |
- } else { |
- ++dropped_begin_frame_args_; |
- } |
-} |
- |
-void BeginFrameObserverBase::AsValueInto( |
- base::trace_event::TracedValue* dict) const { |
- dict->BeginDictionary("last_begin_frame_args_"); |
- last_begin_frame_args_.AsValueInto(dict); |
- dict->EndDictionary(); |
- dict->SetInteger("dropped_begin_frame_args_", dropped_begin_frame_args_); |
-} |
- |
// BeginFrameSourceBase ------------------------------------------------------ |
BeginFrameSourceBase::BeginFrameSourceBase() |
: paused_(false), inside_as_value_into_(false) {} |
@@ -174,9 +142,8 @@ void BackToBackBeginFrameSource::BeginFrame() { |
CallOnBeginFrame(args); |
} |
-void BackToBackBeginFrameSource::DidFinishFrame(size_t remaining_frames) { |
- BeginFrameSourceBase::DidFinishFrame(remaining_frames); |
- if (needs_begin_frames() && remaining_frames == 0) |
+void BackToBackBeginFrameSource::DidFinishFrame(BeginFrameObserver* obs) { |
+ if (needs_begin_frames()) |
PostBeginFrame(); |
enne (OOO)
2016/04/14 23:02:26
Hmm. Should this only post a begin frame to the o
|
} |
@@ -219,6 +186,18 @@ BeginFrameArgs SyntheticBeginFrameSource::CreateBeginFrameArgs( |
} |
// BeginFrameSource support |
+void SyntheticBeginFrameSource::DidFinishFrame(BeginFrameObserver* obs) { |
+ BeginFrameArgs args = CreateBeginFrameArgs( |
+ time_source_->NextTickTime() - time_source_->Interval(), |
+ BeginFrameArgs::MISSED); |
+ BeginFrameArgs last_args = obs->LastUsedBeginFrameArgs(); |
+ if (!last_args.IsValid() || |
+ (args.frame_time > |
+ last_args.frame_time + args.interval / kDoubleTickDivisor)) { |
+ obs->OnBeginFrame(args); |
+ } |
+} |
+ |
void SyntheticBeginFrameSource::AddObserver(BeginFrameObserver* obs) { |
BeginFrameSourceBase::AddObserver(obs); |
BeginFrameArgs args = CreateBeginFrameArgs( |