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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 // Creates an invalid set of values. | 62 // Creates an invalid set of values. |
63 BeginFrameArgs(); | 63 BeginFrameArgs(); |
64 ~BeginFrameArgs(); | |
64 | 65 |
65 #ifdef NDEBUG | 66 #ifdef NDEBUG |
66 typedef const void* CreationLocation; | 67 typedef const void* CreationLocation; |
67 #else | 68 #else |
68 typedef const tracked_objects::Location& CreationLocation; | 69 typedef const tracked_objects::Location& CreationLocation; |
69 tracked_objects::Location created_from; | 70 tracked_objects::Location created_from; |
70 #endif | 71 #endif |
71 | 72 |
72 // You should be able to find all instances where a BeginFrame has been | 73 // You should be able to find all instances where a BeginFrame has been |
73 // created by searching for "BeginFrameArgs::Create". | 74 // created by searching for "BeginFrameArgs::Create". |
74 // The location argument should **always** be BEGINFRAME_FROM_HERE macro. | 75 // The location argument should **always** be BEGINFRAME_FROM_HERE macro. |
75 static BeginFrameArgs Create(CreationLocation location, | 76 static BeginFrameArgs Create(CreationLocation location, |
76 uint32_t source_id, | 77 uint32_t source_id, |
77 uint64_t sequence_number, | 78 uint64_t sequence_number, |
78 base::TimeTicks frame_time, | 79 base::TimeTicks frame_time, |
79 base::TimeTicks deadline, | 80 base::TimeTicks deadline, |
80 base::TimeDelta interval, | 81 base::TimeDelta interval, |
81 BeginFrameArgsType type); | 82 BeginFrameArgsType type); |
83 BeginFrameArgs(const BeginFrameArgs&); | |
82 | 84 |
83 // This is the default delta that will be used to adjust the deadline when | 85 // This is the default delta that will be used to adjust the deadline when |
84 // proper draw-time estimations are not yet available. | 86 // proper draw-time estimations are not yet available. |
85 static base::TimeDelta DefaultEstimatedParentDrawTime(); | 87 static base::TimeDelta DefaultEstimatedParentDrawTime(); |
86 | 88 |
87 // This is the default interval to use to avoid sprinkling the code with | 89 // This is the default interval to use to avoid sprinkling the code with |
88 // magic numbers. | 90 // magic numbers. |
89 static base::TimeDelta DefaultInterval(); | 91 static base::TimeDelta DefaultInterval(); |
90 | 92 |
91 bool IsValid() const { return interval >= base::TimeDelta(); } | 93 bool IsValid() const { return interval >= base::TimeDelta(); } |
92 | 94 |
93 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; | 95 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; |
94 void AsValueInto(base::trace_event::TracedValue* dict) const; | 96 void AsValueInto(base::trace_event::TracedValue* dict) const; |
95 | 97 |
96 base::TimeTicks frame_time; | 98 base::TimeTicks frame_time; |
97 base::TimeTicks deadline; | 99 base::TimeTicks deadline; |
98 base::TimeDelta interval; | 100 base::TimeDelta interval; |
99 | 101 |
100 // |source_id| and |sequence_number| identify a BeginFrame within a single | 102 // |source_id| and |sequence_number| identify a BeginFrame within a single |
101 // process and are set by the original BeginFrameSource that created the | 103 // process and are set by the original BeginFrameSource that created the |
102 // BeginFrameArgs. When |source_id| of consecutive BeginFrameArgs changes, | 104 // BeginFrameArgs. When |source_id| of consecutive BeginFrameArgs changes, |
103 // observers should expect the continuity of |sequence_number| to break. | 105 // observers should expect the continuity of |sequence_number| to break. |
104 uint64_t sequence_number; | 106 uint64_t sequence_number; |
105 uint32_t source_id; // |source_id| after |sequence_number| for packing. | 107 uint32_t source_id; // |source_id| after |sequence_number| for packing. |
106 | 108 |
109 //|source_frame_number| is set by the LayerTreeHost when the BeginFrame | |
110 // reaches | |
brianderson
2017/04/10 23:12:47
Extra line break?
panicker
2017/04/11 22:19:37
Done.
| |
111 // blink and corresponds to the commit count. | |
112 uint32_t source_frame_number; | |
113 | |
114 // This is to report Activation (ReadyToActivate signal) time back to main. | |
115 // A vector of pairs of source_frame_number and timestamp is captured, and | |
116 // sent back with the next ProxyMain::BeginMainFrame, and from there routed to | |
117 // the Blink Scheduler. A vector is needed as there can be multiple | |
118 // ReadyToActivate signals before the next BeginMainFrame. | |
119 // TODO(panicker): Sub-class BeginFrameArgs as BeginMainFrameArgs and move | |
120 // this there. | |
121 std::vector<std::pair<uint32_t, base::TimeTicks>> ready_to_activate_time; | |
122 | |
107 BeginFrameArgsType type; | 123 BeginFrameArgsType type; |
108 bool on_critical_path; | 124 bool on_critical_path; |
109 | 125 |
110 private: | 126 private: |
111 BeginFrameArgs(uint32_t source_id, | 127 BeginFrameArgs(uint32_t source_id, |
112 uint64_t sequence_number, | 128 uint64_t sequence_number, |
113 base::TimeTicks frame_time, | 129 base::TimeTicks frame_time, |
114 base::TimeTicks deadline, | 130 base::TimeTicks deadline, |
115 base::TimeDelta interval, | 131 base::TimeDelta interval, |
116 BeginFrameArgsType type); | 132 BeginFrameArgsType type); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
168 uint32_t source_id; // |source_id| after above fields for packing. | 184 uint32_t source_id; // |source_id| after above fields for packing. |
169 | 185 |
170 // |true| if the observer has produced damage (e.g. sent a CompositorFrame or | 186 // |true| if the observer has produced damage (e.g. sent a CompositorFrame or |
171 // damaged a surface) as part of responding to the BeginFrame. | 187 // damaged a surface) as part of responding to the BeginFrame. |
172 bool has_damage; | 188 bool has_damage; |
173 }; | 189 }; |
174 | 190 |
175 } // namespace cc | 191 } // namespace cc |
176 | 192 |
177 #endif // CC_OUTPUT_BEGIN_FRAME_ARGS_H_ | 193 #endif // CC_OUTPUT_BEGIN_FRAME_ARGS_H_ |
OLD | NEW |