| 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 | |
| 64 // Creates an invalid set of values. | 62 // Creates an invalid set of values. |
| 65 BeginFrameArgs(); | 63 BeginFrameArgs(); |
| 66 ~BeginFrameArgs(); | |
| 67 | 64 |
| 68 #ifdef NDEBUG | 65 #ifdef NDEBUG |
| 69 typedef const void* CreationLocation; | 66 typedef const void* CreationLocation; |
| 70 #else | 67 #else |
| 71 typedef const tracked_objects::Location& CreationLocation; | 68 typedef const tracked_objects::Location& CreationLocation; |
| 72 tracked_objects::Location created_from; | 69 tracked_objects::Location created_from; |
| 73 #endif | 70 #endif |
| 74 | 71 |
| 75 // You should be able to find all instances where a BeginFrame has been | 72 // You should be able to find all instances where a BeginFrame has been |
| 76 // created by searching for "BeginFrameArgs::Create". | 73 // created by searching for "BeginFrameArgs::Create". |
| 77 // The location argument should **always** be BEGINFRAME_FROM_HERE macro. | 74 // The location argument should **always** be BEGINFRAME_FROM_HERE macro. |
| 78 static BeginFrameArgs Create(CreationLocation location, | 75 static BeginFrameArgs Create(CreationLocation location, |
| 79 uint32_t source_id, | 76 uint32_t source_id, |
| 80 uint64_t sequence_number, | 77 uint64_t sequence_number, |
| 81 uint32_t source_frame_number, | |
| 82 base::TimeTicks frame_time, | 78 base::TimeTicks frame_time, |
| 83 base::TimeTicks deadline, | 79 base::TimeTicks deadline, |
| 84 base::TimeDelta interval, | 80 base::TimeDelta interval, |
| 85 BeginFrameArgsType type); | 81 BeginFrameArgsType type); |
| 86 BeginFrameArgs(const BeginFrameArgs&); | |
| 87 | 82 |
| 88 // This is the default delta that will be used to adjust the deadline when | 83 // This is the default delta that will be used to adjust the deadline when |
| 89 // proper draw-time estimations are not yet available. | 84 // proper draw-time estimations are not yet available. |
| 90 static base::TimeDelta DefaultEstimatedParentDrawTime(); | 85 static base::TimeDelta DefaultEstimatedParentDrawTime(); |
| 91 | 86 |
| 92 // This is the default interval to use to avoid sprinkling the code with | 87 // This is the default interval to use to avoid sprinkling the code with |
| 93 // magic numbers. | 88 // magic numbers. |
| 94 static base::TimeDelta DefaultInterval(); | 89 static base::TimeDelta DefaultInterval(); |
| 95 | 90 |
| 96 bool IsValid() const { return interval >= base::TimeDelta(); } | 91 bool IsValid() const { return interval >= base::TimeDelta(); } |
| 97 | 92 |
| 98 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; | 93 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValue() const; |
| 99 void AsValueInto(base::trace_event::TracedValue* dict) const; | 94 void AsValueInto(base::trace_event::TracedValue* dict) const; |
| 100 | 95 |
| 101 base::TimeTicks frame_time; | 96 base::TimeTicks frame_time; |
| 102 base::TimeTicks deadline; | 97 base::TimeTicks deadline; |
| 103 base::TimeDelta interval; | 98 base::TimeDelta interval; |
| 104 | 99 |
| 105 // |source_id| and |sequence_number| identify a BeginFrame within a single | 100 // |source_id| and |sequence_number| identify a BeginFrame within a single |
| 106 // process and are set by the original BeginFrameSource that created the | 101 // process and are set by the original BeginFrameSource that created the |
| 107 // BeginFrameArgs. When |source_id| of consecutive BeginFrameArgs changes, | 102 // BeginFrameArgs. When |source_id| of consecutive BeginFrameArgs changes, |
| 108 // observers should expect the continuity of |sequence_number| to break. | 103 // observers should expect the continuity of |sequence_number| to break. |
| 109 uint64_t sequence_number; | 104 uint64_t sequence_number; |
| 110 uint32_t source_id; // |source_id| after |sequence_number| for packing. | 105 uint32_t source_id; // |source_id| after |sequence_number| for packing. |
| 111 | 106 |
| 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 | |
| 125 BeginFrameArgsType type; | 107 BeginFrameArgsType type; |
| 126 bool on_critical_path; | 108 bool on_critical_path; |
| 127 | 109 |
| 128 private: | 110 private: |
| 129 BeginFrameArgs(uint32_t source_id, | 111 BeginFrameArgs(uint32_t source_id, |
| 130 uint64_t sequence_number, | 112 uint64_t sequence_number, |
| 131 uint32_t source_frame_number, | |
| 132 base::TimeTicks frame_time, | 113 base::TimeTicks frame_time, |
| 133 base::TimeTicks deadline, | 114 base::TimeTicks deadline, |
| 134 base::TimeDelta interval, | 115 base::TimeDelta interval, |
| 135 BeginFrameArgsType type); | 116 BeginFrameArgsType type); |
| 136 }; | 117 }; |
| 137 | 118 |
| 138 // Sent by a BeginFrameObserver as acknowledgment of completing a BeginFrame. | 119 // Sent by a BeginFrameObserver as acknowledgment of completing a BeginFrame. |
| 139 struct CC_EXPORT BeginFrameAck { | 120 struct CC_EXPORT BeginFrameAck { |
| 140 BeginFrameAck(); | 121 BeginFrameAck(); |
| 141 BeginFrameAck(uint32_t source_id, | 122 BeginFrameAck(uint32_t source_id, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 uint32_t source_id; // |source_id| after above fields for packing. | 168 uint32_t source_id; // |source_id| after above fields for packing. |
| 188 | 169 |
| 189 // |true| if the observer has produced damage (e.g. sent a CompositorFrame or | 170 // |true| if the observer has produced damage (e.g. sent a CompositorFrame or |
| 190 // damaged a surface) as part of responding to the BeginFrame. | 171 // damaged a surface) as part of responding to the BeginFrame. |
| 191 bool has_damage; | 172 bool has_damage; |
| 192 }; | 173 }; |
| 193 | 174 |
| 194 } // namespace cc | 175 } // namespace cc |
| 195 | 176 |
| 196 #endif // CC_OUTPUT_BEGIN_FRAME_ARGS_H_ | 177 #endif // CC_OUTPUT_BEGIN_FRAME_ARGS_H_ |
| OLD | NEW |