OLD | NEW |
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> | 8 #include <stdint.h> |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 static constexpr uint32_t kStartingSourceId = 0; | 53 static constexpr uint32_t kStartingSourceId = 0; |
54 // |source_id| for BeginFrameArgs not created by a BeginFrameSource. Used to | 54 // |source_id| for BeginFrameArgs not created by a BeginFrameSource. Used to |
55 // avoid sequence number conflicts of BeginFrameArgs manually fed to an | 55 // avoid sequence number conflicts of BeginFrameArgs manually fed to an |
56 // observer with those fed to the observer by the its BeginFrameSource. | 56 // observer with those fed to the observer by the its BeginFrameSource. |
57 static constexpr uint32_t kManualSourceId = UINT32_MAX; | 57 static constexpr uint32_t kManualSourceId = UINT32_MAX; |
58 | 58 |
59 static constexpr uint64_t kInvalidFrameNumber = 0; | 59 static constexpr uint64_t kInvalidFrameNumber = 0; |
60 static constexpr uint64_t kStartingFrameNumber = 1; | 60 static constexpr uint64_t kStartingFrameNumber = 1; |
61 | 61 |
| 62 static constexpr uint32_t kDefaultSourceFrameNumber = 0; |
| 63 |
62 // Creates an invalid set of values. | 64 // Creates an invalid set of values. |
63 BeginFrameArgs(); | 65 BeginFrameArgs(); |
| 66 ~BeginFrameArgs(); |
64 | 67 |
65 #ifdef NDEBUG | 68 #ifdef NDEBUG |
66 typedef const void* CreationLocation; | 69 typedef const void* CreationLocation; |
67 #else | 70 #else |
68 typedef const tracked_objects::Location& CreationLocation; | 71 typedef const tracked_objects::Location& CreationLocation; |
69 tracked_objects::Location created_from; | 72 tracked_objects::Location created_from; |
70 #endif | 73 #endif |
71 | 74 |
72 // You should be able to find all instances where a BeginFrame has been | 75 // You should be able to find all instances where a BeginFrame has been |
73 // created by searching for "BeginFrameArgs::Create". | 76 // created by searching for "BeginFrameArgs::Create". |
74 // The location argument should **always** be BEGINFRAME_FROM_HERE macro. | 77 // The location argument should **always** be BEGINFRAME_FROM_HERE macro. |
75 static BeginFrameArgs Create(CreationLocation location, | 78 static BeginFrameArgs Create(CreationLocation location, |
76 uint32_t source_id, | 79 uint32_t source_id, |
77 uint64_t sequence_number, | 80 uint64_t sequence_number, |
| 81 uint32_t source_frame_number, |
78 base::TimeTicks frame_time, | 82 base::TimeTicks frame_time, |
79 base::TimeTicks deadline, | 83 base::TimeTicks deadline, |
80 base::TimeDelta interval, | 84 base::TimeDelta interval, |
81 BeginFrameArgsType type); | 85 BeginFrameArgsType type); |
| 86 BeginFrameArgs(const BeginFrameArgs&); |
82 | 87 |
83 // This is the default delta that will be used to adjust the deadline when | 88 // This is the default delta that will be used to adjust the deadline when |
84 // proper draw-time estimations are not yet available. | 89 // proper draw-time estimations are not yet available. |
85 static base::TimeDelta DefaultEstimatedParentDrawTime(); | 90 static base::TimeDelta DefaultEstimatedParentDrawTime(); |
86 | 91 |
87 // This is the default interval to use to avoid sprinkling the code with | 92 // This is the default interval to use to avoid sprinkling the code with |
88 // magic numbers. | 93 // magic numbers. |
89 static base::TimeDelta DefaultInterval(); | 94 static base::TimeDelta DefaultInterval(); |
90 | 95 |
91 bool IsValid() const { return interval >= base::TimeDelta(); } | 96 bool IsValid() const { return interval >= base::TimeDelta(); } |
92 | 97 |
93 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; | 98 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; |
94 void AsValueInto(base::trace_event::TracedValue* dict) const; | 99 void AsValueInto(base::trace_event::TracedValue* dict) const; |
95 | 100 |
96 base::TimeTicks frame_time; | 101 base::TimeTicks frame_time; |
97 base::TimeTicks deadline; | 102 base::TimeTicks deadline; |
98 base::TimeDelta interval; | 103 base::TimeDelta interval; |
99 | 104 |
100 // |source_id| and |sequence_number| identify a BeginFrame within a single | 105 // |source_id| and |sequence_number| identify a BeginFrame within a single |
101 // process and are set by the original BeginFrameSource that created the | 106 // process and are set by the original BeginFrameSource that created the |
102 // BeginFrameArgs. When |source_id| of consecutive BeginFrameArgs changes, | 107 // BeginFrameArgs. When |source_id| of consecutive BeginFrameArgs changes, |
103 // observers should expect the continuity of |sequence_number| to break. | 108 // observers should expect the continuity of |sequence_number| to break. |
104 uint64_t sequence_number; | 109 uint64_t sequence_number; |
105 uint32_t source_id; // |source_id| after |sequence_number| for packing. | 110 uint32_t source_id; // |source_id| after |sequence_number| for packing. |
106 | 111 |
| 112 // |source_frame_number| is set by the LayerTreeHost when the BeginFrame |
| 113 // reaches blink and corresponds to the commit count. |
| 114 uint32_t source_frame_number; |
| 115 |
| 116 // This is to report Activation (ReadyToActivate signal) time back to main. |
| 117 // A vector of pairs of source_frame_number and timestamp is captured, and |
| 118 // sent back with the next ProxyMain::BeginMainFrame, and from there routed to |
| 119 // the Blink Scheduler. A vector is needed as there can be multiple |
| 120 // ReadyToActivate signals before the next BeginMainFrame. |
| 121 // TODO(panicker): Sub-class BeginFrameArgs as BeginMainFrameArgs and move |
| 122 // this there. |
| 123 std::vector<std::pair<uint32_t, base::TimeTicks>> ready_to_activate_time; |
| 124 |
107 BeginFrameArgsType type; | 125 BeginFrameArgsType type; |
108 bool on_critical_path; | 126 bool on_critical_path; |
109 | 127 |
110 private: | 128 private: |
111 BeginFrameArgs(uint32_t source_id, | 129 BeginFrameArgs(uint32_t source_id, |
112 uint64_t sequence_number, | 130 uint64_t sequence_number, |
| 131 uint32_t source_frame_number, |
113 base::TimeTicks frame_time, | 132 base::TimeTicks frame_time, |
114 base::TimeTicks deadline, | 133 base::TimeTicks deadline, |
115 base::TimeDelta interval, | 134 base::TimeDelta interval, |
116 BeginFrameArgsType type); | 135 BeginFrameArgsType type); |
117 }; | 136 }; |
118 | 137 |
119 // Sent by a BeginFrameObserver as acknowledgment of completing a BeginFrame. | 138 // Sent by a BeginFrameObserver as acknowledgment of completing a BeginFrame. |
120 struct CC_EXPORT BeginFrameAck { | 139 struct CC_EXPORT BeginFrameAck { |
121 BeginFrameAck(); | 140 BeginFrameAck(); |
122 BeginFrameAck(uint32_t source_id, | 141 BeginFrameAck(uint32_t source_id, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 uint32_t source_id; // |source_id| after above fields for packing. | 187 uint32_t source_id; // |source_id| after above fields for packing. |
169 | 188 |
170 // |true| if the observer has produced damage (e.g. sent a CompositorFrame or | 189 // |true| if the observer has produced damage (e.g. sent a CompositorFrame or |
171 // damaged a surface) as part of responding to the BeginFrame. | 190 // damaged a surface) as part of responding to the BeginFrame. |
172 bool has_damage; | 191 bool has_damage; |
173 }; | 192 }; |
174 | 193 |
175 } // namespace cc | 194 } // namespace cc |
176 | 195 |
177 #endif // CC_OUTPUT_BEGIN_FRAME_ARGS_H_ | 196 #endif // CC_OUTPUT_BEGIN_FRAME_ARGS_H_ |
OLD | NEW |