| 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> |
| 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 Loading... |
| 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 uint64_t oldest_incorporated_frame, |
| 111 uint32_t remaining_frames, |
| 112 bool has_updates); |
| 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 // Sequence number of the oldest frame that contributed contents to the last |
| 121 // update the consumer sent. It describes the "staleness" of the last update. |
| 122 // Note that the last update may remain "fresh" even if the consumer did not |
| 123 // produce an update for this frame (|has_updates == false|): If the consumer |
| 124 // does not have any pending updates for a frame, the frame will be considered |
| 125 // to have contributed its contents to the last 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; |
| 132 |
| 133 // Number of BeginFrames queued at the observer at time of acknowledgment. |
| 134 uint32_t remaining_frames; |
| 135 |
| 136 // |true| if the consumer has produced updates (e.g. sent a CompositorFrame or |
| 137 // damaged a surface) as part of responding to the BeginFrame. |
| 138 bool has_updates; |
| 139 }; |
| 140 |
| 97 } // namespace cc | 141 } // namespace cc |
| 98 | 142 |
| 99 #endif // CC_OUTPUT_BEGIN_FRAME_ARGS_H_ | 143 #endif // CC_OUTPUT_BEGIN_FRAME_ARGS_H_ |
| OLD | NEW |