File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed
Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,28 @@ class FrameTiming {
9292 FrameTiming (List <int > timestamps)
9393 : assert (timestamps.length == FramePhase .values.length), _timestamps = timestamps;
9494
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+
95117 /// This is a raw timestamp in microseconds from some epoch. The epoch in all
96118 /// [FrameTiming] is the same, but it may not match [DateTime] 's epoch.
97119 int timestampInMicroseconds (FramePhase phase) => _timestamps[phase.index];
Original file line number Diff line number Diff line change @@ -1033,6 +1033,21 @@ class FrameTiming {
10331033 : assert (timestamps.length == FramePhase .values.length),
10341034 _timestamps = timestamps;
10351035
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+
10361051 /// This is a raw timestamp in microseconds from some epoch. The epoch in all
10371052 /// [FrameTiming] is the same, but it may not match [DateTime] 's epoch.
10381053 int timestampInMicroseconds (FramePhase phase) => _timestamps[phase.index];
You can’t perform that action at this time.
0 commit comments