Chromium Code Reviews| 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. |
| 108 uint32_t frame_source_number; | |
|
vmpstr
2017/04/05 19:11:33
nit: source_frame_number to be consistent with the
brianderson
2017/04/06 23:43:15
A few comments:
* Make sure to initialize this in
panicker
2017/04/08 00:29:06
Updated.
Happy to try out the BeginMainFrameArgs s
| |
| 109 | |
| 110 // This is to report Activation time back to main. | |
|
vmpstr
2017/04/05 19:11:33
Can you please elaborate on this comment a bit. Sp
panicker
2017/04/08 00:29:06
Done.
| |
| 111 std::vector<std::pair<uint32_t, base::TimeTicks>> ready_to_activate_time; | |
| 106 | 112 |
| 107 BeginFrameArgsType type; | 113 BeginFrameArgsType type; |
| 108 bool on_critical_path; | 114 bool on_critical_path; |
| 109 | 115 |
| 110 private: | 116 private: |
| 111 BeginFrameArgs(uint32_t source_id, | 117 BeginFrameArgs(uint32_t source_id, |
| 112 uint64_t sequence_number, | 118 uint64_t sequence_number, |
| 113 base::TimeTicks frame_time, | 119 base::TimeTicks frame_time, |
| 114 base::TimeTicks deadline, | 120 base::TimeTicks deadline, |
| 115 base::TimeDelta interval, | 121 base::TimeDelta interval, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 uint32_t source_id; // |source_id| after above fields for packing. | 174 uint32_t source_id; // |source_id| after above fields for packing. |
| 169 | 175 |
| 170 // |true| if the observer has produced damage (e.g. sent a CompositorFrame or | 176 // |true| if the observer has produced damage (e.g. sent a CompositorFrame or |
| 171 // damaged a surface) as part of responding to the BeginFrame. | 177 // damaged a surface) as part of responding to the BeginFrame. |
| 172 bool has_damage; | 178 bool has_damage; |
| 173 }; | 179 }; |
| 174 | 180 |
| 175 } // namespace cc | 181 } // namespace cc |
| 176 | 182 |
| 177 #endif // CC_OUTPUT_BEGIN_FRAME_ARGS_H_ | 183 #endif // CC_OUTPUT_BEGIN_FRAME_ARGS_H_ |
| OLD | NEW |