Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: cc/output/begin_frame_args.h

Issue 2527283003: cc: Introduce BeginFrame sequence numbers and acknowledgements.
Patch Set: . Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_OUTPUT_BEGIN_FRAME_ARGS_H_ 5 #ifndef CC_OUTPUT_BEGIN_FRAME_ARGS_H_
6 #define CC_OUTPUT_BEGIN_FRAME_ARGS_H_ 6 #define CC_OUTPUT_BEGIN_FRAME_ARGS_H_
7 7
8 #include <stdint.h>
9
8 #include <memory> 10 #include <memory>
9 11
10 #include "base/location.h" 12 #include "base/location.h"
11 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
12 #include "base/time/time.h" 14 #include "base/time/time.h"
13 #include "base/values.h" 15 #include "base/values.h"
14 #include "cc/base/cc_export.h" 16 #include "cc/base/cc_export.h"
15 17
16 namespace base { 18 namespace base {
17 namespace trace_event { 19 namespace trace_event {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 typedef const void* CreationLocation; 58 typedef const void* CreationLocation;
57 #else 59 #else
58 typedef const tracked_objects::Location& CreationLocation; 60 typedef const tracked_objects::Location& CreationLocation;
59 tracked_objects::Location created_from; 61 tracked_objects::Location created_from;
60 #endif 62 #endif
61 63
62 // You should be able to find all instances where a BeginFrame has been 64 // You should be able to find all instances where a BeginFrame has been
63 // created by searching for "BeginFrameArgs::Create". 65 // created by searching for "BeginFrameArgs::Create".
64 // The location argument should **always** be BEGINFRAME_FROM_HERE macro. 66 // The location argument should **always** be BEGINFRAME_FROM_HERE macro.
65 static BeginFrameArgs Create(CreationLocation location, 67 static BeginFrameArgs Create(CreationLocation location,
68 uint64_t source_id,
69 uint64_t sequence_number,
66 base::TimeTicks frame_time, 70 base::TimeTicks frame_time,
67 base::TimeTicks deadline, 71 base::TimeTicks deadline,
68 base::TimeDelta interval, 72 base::TimeDelta interval,
69 BeginFrameArgsType type); 73 BeginFrameArgsType type);
70 74
71 // This is the default delta that will be used to adjust the deadline when 75 // This is the default delta that will be used to adjust the deadline when
72 // proper draw-time estimations are not yet available. 76 // proper draw-time estimations are not yet available.
73 static base::TimeDelta DefaultEstimatedParentDrawTime(); 77 static base::TimeDelta DefaultEstimatedParentDrawTime();
74 78
75 // This is the default interval to use to avoid sprinkling the code with 79 // This is the default interval to use to avoid sprinkling the code with
76 // magic numbers. 80 // magic numbers.
77 static base::TimeDelta DefaultInterval(); 81 static base::TimeDelta DefaultInterval();
78 82
79 bool IsValid() const { return interval >= base::TimeDelta(); } 83 bool IsValid() const { return interval >= base::TimeDelta(); }
80 84
81 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; 85 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const;
82 void AsValueInto(base::trace_event::TracedValue* dict) const; 86 void AsValueInto(base::trace_event::TracedValue* dict) const;
83 87
88 uint64_t source_id;
89 uint64_t sequence_number;
84 base::TimeTicks frame_time; 90 base::TimeTicks frame_time;
85 base::TimeTicks deadline; 91 base::TimeTicks deadline;
86 base::TimeDelta interval; 92 base::TimeDelta interval;
87 BeginFrameArgsType type; 93 BeginFrameArgsType type;
88 bool on_critical_path; 94 bool on_critical_path;
89 95
90 private: 96 private:
91 BeginFrameArgs(base::TimeTicks frame_time, 97 BeginFrameArgs(uint64_t source_id,
98 uint64_t sequence_number,
99 base::TimeTicks frame_time,
92 base::TimeTicks deadline, 100 base::TimeTicks deadline,
93 base::TimeDelta interval, 101 base::TimeDelta interval,
94 BeginFrameArgsType type); 102 BeginFrameArgsType type);
95 }; 103 };
96 104
105 // Sent by a BeginFrameObserver as acknowledgment of completing a BeginFrame.
106 struct CC_EXPORT BeginFrameAck {
107 BeginFrameAck();
108 BeginFrameAck(uint64_t source_id,
109 uint64_t sequence_number,
110 bool has_updates,
111 uint64_t oldest_incorporated_frame,
112 uint32_t remaining_frames);
113
114 // Source identifier of the BeginFrame that is acknowledged.
115 uint64_t source_id;
116
117 // Sequence number of the BeginFrame that is acknowledged.
118 uint64_t sequence_number;
119
120 // |true| if the consumer has produced updates (e.g. sent a CompositorFrame or
121 // damaged a surface) as part of responding to the BeginFrame.
122 bool has_updates;
Sami 2016/12/06 12:41:06 |oldest_incorporated_frame| is only valid if this
Eric Seckler 2016/12/06 17:33:59 No :) I updated the comment below with a note, but
Sami 2016/12/07 16:59:40 Sorry, I think the explanation is still a bit conf
Eric Seckler 2016/12/08 17:54:28 Renamed and updated the comment again after discus
123
124 // Sequence number of the oldest frame that contributed contents to the last
125 // update the consumer sent. It describes the "staleness" of the update.
126 //
127 // The compositor Scheduler indicates the latest frame that both an impl and
128 // main frame contributed to (or didn't have any updates). The
129 // DisplayScheduler indicates the minimum oldest_incorporated_frame that all
130 // its BeginFrameObservers acknowledged.
131 uint64_t oldest_incorporated_frame;
Sami 2016/12/06 12:41:06 Do we need to define an invalid/unknown value for
Eric Seckler 2016/12/06 17:33:59 My current approach to this is to consider the con
Sami 2016/12/07 16:59:40 Makes sense. If we decide to do that, let's add a
Eric Seckler 2016/12/08 17:54:28 Done, also for 1 as starting frame number.
132
133 // Number of BeginFrames queued at the observer at time of acknowledgment.
134 uint32_t remaining_frames;
Sami 2016/12/06 12:41:06 nit: might want to order these fields from largest
Eric Seckler 2016/12/06 17:33:59 Done.
135 };
136
97 } // namespace cc 137 } // namespace cc
98 138
99 #endif // CC_OUTPUT_BEGIN_FRAME_ARGS_H_ 139 #endif // CC_OUTPUT_BEGIN_FRAME_ARGS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698