Index: cc/output/begin_frame_args.h |
diff --git a/cc/output/begin_frame_args.h b/cc/output/begin_frame_args.h |
index 78ddce99ddfcde3c4508f1d706d4b1eb205ff89f..d5f49fac7d776efd9051ca27086923ae87e85398 100644 |
--- a/cc/output/begin_frame_args.h |
+++ b/cc/output/begin_frame_args.h |
@@ -5,6 +5,8 @@ |
#ifndef CC_OUTPUT_BEGIN_FRAME_ARGS_H_ |
#define CC_OUTPUT_BEGIN_FRAME_ARGS_H_ |
+#include <stdint.h> |
+ |
#include <memory> |
#include "base/location.h" |
@@ -49,6 +51,9 @@ struct CC_EXPORT BeginFrameArgs { |
}; |
static const char* TypeToString(BeginFrameArgsType type); |
+ static const uint64_t kInvalidFrameNumber; |
+ static const uint64_t kStartingFrameNumber; |
+ |
// Creates an invalid set of values. |
BeginFrameArgs(); |
@@ -63,6 +68,8 @@ struct CC_EXPORT BeginFrameArgs { |
// created by searching for "BeginFrameArgs::Create". |
// The location argument should **always** be BEGINFRAME_FROM_HERE macro. |
static BeginFrameArgs Create(CreationLocation location, |
+ uint64_t source_id, |
+ uint64_t sequence_number, |
base::TimeTicks frame_time, |
base::TimeTicks deadline, |
base::TimeDelta interval, |
@@ -81,6 +88,13 @@ struct CC_EXPORT BeginFrameArgs { |
std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; |
void AsValueInto(base::trace_event::TracedValue* dict) const; |
+ // |source_id| and |sequence_number| identify a BeginFrame within a single |
+ // process and are set by the original BeginFrameSource that created the |
+ // BeginFrameArgs. When |source_id| of consecutive BeginFrameArgs changes, |
+ // observers should expect the continuity of |sequence_number| to break. |
+ uint64_t source_id; |
+ uint64_t sequence_number; |
+ |
base::TimeTicks frame_time; |
base::TimeTicks deadline; |
base::TimeDelta interval; |
@@ -88,12 +102,66 @@ struct CC_EXPORT BeginFrameArgs { |
bool on_critical_path; |
private: |
- BeginFrameArgs(base::TimeTicks frame_time, |
+ BeginFrameArgs(uint64_t source_id, |
+ uint64_t sequence_number, |
+ base::TimeTicks frame_time, |
base::TimeTicks deadline, |
base::TimeDelta interval, |
BeginFrameArgsType type); |
}; |
+// Sent by a BeginFrameObserver as acknowledgment of completing a BeginFrame. |
+struct CC_EXPORT BeginFrameAck { |
+ BeginFrameAck(); |
+ BeginFrameAck(uint64_t source_id, |
+ uint64_t sequence_number, |
+ uint64_t latest_confirmed_frame, |
+ uint32_t remaining_frames, |
+ bool has_damage); |
+ |
+ // Source identifier of the BeginFrame that is acknowledged. The |
+ // BeginFrameSource that receives the acknowledgment uses this to discard |
+ // BeginFrameAcks for BeginFrames sent by a different source. Such a situation |
+ // may occur when the BeginFrameSource of the observer changes while a |
+ // BeginFrame from the old source is still in flight. |
+ uint64_t source_id; |
+ |
+ // Sequence number of the BeginFrame that is acknowledged. |
+ uint64_t sequence_number; |
+ |
+ // Sequence number of the latest BeginFrame that was positively acknowledged |
+ // (confirmed) by the observer. |
+ // |
+ // There are two scenarios for a positive acknowledgment: |
+ // a) All of the observer's pending updates led to successful damage (e.g. a |
+ // CompositorFrame or a damaged surface). |
+ // b) The observer did not have any updates and thus did not need to |
+ // produce damage. |
+ // A negative acknowledgment, in contrast, describes a situation in which the |
+ // observer had pending updates, but was unable to successfully produce |
+ // corresponding damage for all its updates in time. |
+ // |
+ // As a result, |latest_confirmed_frame| describes the "staleness" of the last |
+ // damage that was produced by the observer. Note that even if |
+ // |has_damage == true|, the damage produced as a result of the acknowledged |
+ // BeginFrame may be stale (|latest_confirmed_frame < sequence_number|). In |
+ // such a case, the damage that was produced may contain updates from previous |
+ // BeginFrames or only part of this BeginFrame's updates. |
+ // |
+ // Observers aggregate the |latest_confirmed_frame| of their children: The |
+ // compositor Scheduler indicates the latest BeginFrame that both impl and |
+ // main thread confirmed. Likewise, the DisplayScheduler indicates the minimum |
+ // |latest_confirmed_frame| that all its BeginFrameObservers acknowledged. |
+ uint64_t latest_confirmed_frame; |
+ |
+ // Number of BeginFrames queued at the observer at time of acknowledgment. |
+ uint32_t remaining_frames; |
+ |
+ // |true| if the observer has produced damage (e.g. sent a CompositorFrame or |
+ // damaged a surface) as part of responding to the BeginFrame. |
+ bool has_damage; |
+}; |
+ |
} // namespace cc |
#endif // CC_OUTPUT_BEGIN_FRAME_ARGS_H_ |