Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
4ca7bfa0
Unverified
Commit
4ca7bfa0
authored
Jul 03, 2019
by
Michael Goderbauer
Committed by
GitHub
Jul 03, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Re-apply 'Add currentSystemFrameTimeStamp to SchedulerBinding' (#35492)
parent
2d2bb6bf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
0 deletions
+49
-0
binding.dart
packages/flutter/lib/src/scheduler/binding.dart
+16
-0
scheduler_test.dart
packages/flutter/test/scheduler/scheduler_test.dart
+33
-0
No files found.
packages/flutter/lib/src/scheduler/binding.dart
View file @
4ca7bfa0
...
...
@@ -853,6 +853,22 @@ mixin SchedulerBinding on BindingBase, ServicesBinding {
}
Duration
_currentFrameTimeStamp
;
/// The raw time stamp as provided by the engine to [Window.onBeginFrame]
/// for the frame currently being processed.
///
/// Unlike [currentFrameTimeStamp], this time stamp is neither adjusted to
/// offset when the epoch started nor scaled to reflect the [timeDilation] in
/// the current epoch.
///
/// On most platforms, this is a more or less arbitrary value, and should
/// generally be ignored. On Fuchsia, this corresponds to the system-provided
/// presentation time, and can be used to ensure that animations running in
/// different processes are synchronized.
Duration
get
currentSystemFrameTimeStamp
{
assert
(
_lastRawTimeStamp
!=
null
);
return
_lastRawTimeStamp
;
}
int
_debugFrameNumber
=
0
;
String
_debugBanner
;
bool
_ignoreNextEngineDrawFrame
=
false
;
...
...
packages/flutter/test/scheduler/scheduler_test.dart
View file @
4ca7bfa0
...
...
@@ -10,6 +10,7 @@ import 'package:flutter/scheduler.dart';
import
'package:flutter/services.dart'
;
import
'../flutter_test_alternative.dart'
;
import
'scheduler_tester.dart'
;
class
TestSchedulerBinding
extends
BindingBase
with
ServicesBinding
,
SchedulerBinding
{
final
Map
<
String
,
List
<
Map
<
String
,
dynamic
>>>
eventsDispatched
=
<
String
,
List
<
Map
<
String
,
dynamic
>>>{};
...
...
@@ -148,4 +149,36 @@ void main() {
expect
(
event
[
'build'
],
5000
);
expect
(
event
[
'raster'
],
4000
);
});
test
(
'currentSystemFrameTimeStamp is the raw timestamp'
,
()
{
Duration
lastTimeStamp
;
Duration
lastSystemTimeStamp
;
void
frameCallback
(
Duration
timeStamp
)
{
expect
(
timeStamp
,
scheduler
.
currentFrameTimeStamp
);
lastTimeStamp
=
scheduler
.
currentFrameTimeStamp
;
lastSystemTimeStamp
=
scheduler
.
currentSystemFrameTimeStamp
;
}
scheduler
.
scheduleFrameCallback
(
frameCallback
);
tick
(
const
Duration
(
seconds:
2
));
expect
(
lastTimeStamp
,
Duration
.
zero
);
expect
(
lastSystemTimeStamp
,
const
Duration
(
seconds:
2
));
scheduler
.
scheduleFrameCallback
(
frameCallback
);
tick
(
const
Duration
(
seconds:
4
));
expect
(
lastTimeStamp
,
const
Duration
(
seconds:
2
));
expect
(
lastSystemTimeStamp
,
const
Duration
(
seconds:
4
));
timeDilation
=
2
;
scheduler
.
scheduleFrameCallback
(
frameCallback
);
tick
(
const
Duration
(
seconds:
6
));
expect
(
lastTimeStamp
,
const
Duration
(
seconds:
2
));
// timeDilation calls SchedulerBinding.resetEpoch
expect
(
lastSystemTimeStamp
,
const
Duration
(
seconds:
6
));
scheduler
.
scheduleFrameCallback
(
frameCallback
);
tick
(
const
Duration
(
seconds:
8
));
expect
(
lastTimeStamp
,
const
Duration
(
seconds:
3
));
// 2s + (8 - 6)s / 2
expect
(
lastSystemTimeStamp
,
const
Duration
(
seconds:
8
));
});
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment