File tree 2 files changed +37
-0
lines changed 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,28 @@ class FrameTiming {
92
92
FrameTiming (List <int > timestamps)
93
93
: assert (timestamps.length == FramePhase .values.length), _timestamps = timestamps;
94
94
95
+ /// Construct [FrameTiming] with given timestamp in micrseconds.
96
+ ///
97
+ /// This constructor is used for unit test only. Real [FrameTiming] s should
98
+ /// be retrieved from [Window.onReportTimings] .
99
+ ///
100
+ /// TODO(CareF): This is part of #20229. Remove back to default constructor
101
+ /// after #20229 lands and corresponding framwork PRs land.
102
+ factory FrameTiming .fromTimeStamps ({
103
+ int ? vsyncStart,
104
+ required int buildStart,
105
+ required int buildFinish,
106
+ required int rasterStart,
107
+ required int rasterFinish
108
+ }) {
109
+ return FrameTiming (< int > [
110
+ buildStart,
111
+ buildFinish,
112
+ rasterStart,
113
+ rasterFinish
114
+ ]);
115
+ }
116
+
95
117
/// This is a raw timestamp in microseconds from some epoch. The epoch in all
96
118
/// [FrameTiming] is the same, but it may not match [DateTime] 's epoch.
97
119
int timestampInMicroseconds (FramePhase phase) => _timestamps[phase.index];
Original file line number Diff line number Diff line change @@ -1033,6 +1033,21 @@ class FrameTiming {
1033
1033
: assert (timestamps.length == FramePhase .values.length),
1034
1034
_timestamps = timestamps;
1035
1035
1036
+ /// Construct [FrameTiming] with given timestamp in micrseconds.
1037
+ ///
1038
+ /// This constructor is used for unit test only. Real [FrameTiming] s should
1039
+ /// be retrieved from [Window.onReportTimings] .
1040
+ ///
1041
+ /// TODO(CareF): This is part of #20229. Remove back to default constructor
1042
+ /// after #20229 lands and corresponding framwork PRs land.
1043
+ FrameTiming .fromTimeStamps ({
1044
+ int ? vsyncStart,
1045
+ required int buildStart,
1046
+ required int buildFinish,
1047
+ required int rasterStart,
1048
+ required int rasterFinish
1049
+ }) : _timestamps = < int > [buildStart, buildFinish, rasterStart, rasterFinish];
1050
+
1036
1051
/// This is a raw timestamp in microseconds from some epoch. The epoch in all
1037
1052
/// [FrameTiming] is the same, but it may not match [DateTime] 's epoch.
1038
1053
int timestampInMicroseconds (FramePhase phase) => _timestamps[phase.index];
You can’t perform that action at this time.
0 commit comments