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
25c84001
Unverified
Commit
25c84001
authored
Jun 12, 2019
by
Devon Carew
Committed by
GitHub
Jun 12, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "update the Flutter.Frame event to use new engine APIs (#34243)" (#34352)
This reverts commit
446179f6
.
parent
c40d701e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
57 deletions
+21
-57
binding.dart
packages/flutter/lib/src/scheduler/binding.dart
+19
-23
scheduler_test.dart
packages/flutter/test/scheduler/scheduler_test.dart
+2
-34
No files found.
packages/flutter/lib/src/scheduler/binding.dart
View file @
25c84001
...
...
@@ -4,8 +4,8 @@
import
'dart:async'
;
import
'dart:collection'
;
import
'dart:developer'
show
Flow
,
Timeline
;
import
'dart:ui'
show
AppLifecycleState
,
FramePhase
,
FrameTiming
;
import
'dart:developer'
;
import
'dart:ui'
show
AppLifecycleState
;
import
'package:collection/collection.dart'
show
PriorityQueue
,
HeapPriorityQueue
;
import
'package:flutter/foundation.dart'
;
...
...
@@ -198,17 +198,6 @@ mixin SchedulerBinding on BindingBase, ServicesBinding {
window
.
onDrawFrame
=
_handleDrawFrame
;
SystemChannels
.
lifecycle
.
setMessageHandler
(
_handleLifecycleMessage
);
readInitialLifecycleStateFromNativeWindow
();
if
(!
kReleaseMode
)
{
int
frameNumber
=
0
;
window
.
onReportTimings
=
(
List
<
FrameTiming
>
timings
)
{
for
(
FrameTiming
frameTiming
in
timings
)
{
frameNumber
+=
1
;
_profileFramePostEvent
(
frameNumber
,
frameTiming
);
}
};
}
}
/// The current [SchedulerBinding], if one has been created.
...
...
@@ -853,7 +842,8 @@ mixin SchedulerBinding on BindingBase, ServicesBinding {
}
Duration
_currentFrameTimeStamp
;
int
_debugFrameNumber
=
0
;
int
_profileFrameNumber
=
0
;
final
Stopwatch
_profileFrameStopwatch
=
Stopwatch
();
String
_debugBanner
;
bool
_ignoreNextEngineDrawFrame
=
false
;
...
...
@@ -904,9 +894,13 @@ mixin SchedulerBinding on BindingBase, ServicesBinding {
if
(
rawTimeStamp
!=
null
)
_lastRawTimeStamp
=
rawTimeStamp
;
assert
(()
{
_debugFrameNumber
+=
1
;
if
(!
kReleaseMode
)
{
_profileFrameNumber
+=
1
;
_profileFrameStopwatch
.
reset
();
_profileFrameStopwatch
.
start
();
}
assert
(()
{
if
(
debugPrintBeginFrameBanner
||
debugPrintEndFrameBanner
)
{
final
StringBuffer
frameTimeStampDescription
=
StringBuffer
();
if
(
rawTimeStamp
!=
null
)
{
...
...
@@ -914,7 +908,7 @@ mixin SchedulerBinding on BindingBase, ServicesBinding {
}
else
{
frameTimeStampDescription
.
write
(
'(warm-up frame)'
);
}
_debugBanner
=
'▄▄▄▄▄▄▄▄ Frame
${_
debug
FrameNumber.toString().padRight(7)}
${frameTimeStampDescription.toString().padLeft(18)}
▄▄▄▄▄▄▄▄'
;
_debugBanner
=
'▄▄▄▄▄▄▄▄ Frame
${_
profile
FrameNumber.toString().padRight(7)}
${frameTimeStampDescription.toString().padLeft(18)}
▄▄▄▄▄▄▄▄'
;
if
(
debugPrintBeginFrameBanner
)
debugPrint
(
_debugBanner
);
}
...
...
@@ -967,6 +961,10 @@ mixin SchedulerBinding on BindingBase, ServicesBinding {
}
finally
{
_schedulerPhase
=
SchedulerPhase
.
idle
;
Timeline
.
finishSync
();
// end the Frame
if
(!
kReleaseMode
)
{
_profileFrameStopwatch
.
stop
();
_profileFramePostEvent
();
}
assert
(()
{
if
(
debugPrintEndFrameBanner
)
debugPrint
(
'▀'
*
_debugBanner
.
length
);
...
...
@@ -977,13 +975,11 @@ mixin SchedulerBinding on BindingBase, ServicesBinding {
}
}
void
_profileFramePostEvent
(
int
frameNumber
,
FrameTiming
frameTiming
)
{
void
_profileFramePostEvent
()
{
postEvent
(
'Flutter.Frame'
,
<
String
,
dynamic
>{
'number'
:
frameNumber
,
'startTime'
:
frameTiming
.
timestampInMicroseconds
(
FramePhase
.
buildStart
),
'elapsed'
:
frameTiming
.
totalSpan
.
inMicroseconds
,
'build'
:
frameTiming
.
buildDuration
.
inMicroseconds
,
'raster'
:
frameTiming
.
rasterDuration
.
inMicroseconds
,
'number'
:
_profileFrameNumber
,
'startTime'
:
_currentFrameTimeStamp
.
inMicroseconds
,
'elapsed'
:
_profileFrameStopwatch
.
elapsedMicroseconds
,
});
}
...
...
packages/flutter/test/scheduler/scheduler_test.dart
View file @
25c84001
...
...
@@ -3,7 +3,6 @@
// found in the LICENSE file.
import
'dart:async'
;
import
'dart:ui'
show
window
,
FrameTiming
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/scheduler.dart'
;
...
...
@@ -11,18 +10,7 @@ import 'package:flutter/services.dart';
import
'../flutter_test_alternative.dart'
;
class
TestSchedulerBinding
extends
BindingBase
with
ServicesBinding
,
SchedulerBinding
{
final
Map
<
String
,
List
<
Map
<
String
,
dynamic
>>>
eventsDispatched
=
<
String
,
List
<
Map
<
String
,
dynamic
>>>{};
@override
void
postEvent
(
String
eventKind
,
Map
<
dynamic
,
dynamic
>
eventData
)
{
getEventsDispatched
(
eventKind
).
add
(
eventData
);
}
List
<
Map
<
String
,
dynamic
>>
getEventsDispatched
(
String
eventKind
)
{
return
eventsDispatched
.
putIfAbsent
(
eventKind
,
()
=>
<
Map
<
String
,
dynamic
>>[]);
}
}
class
TestSchedulerBinding
extends
BindingBase
with
ServicesBinding
,
SchedulerBinding
{
}
class
TestStrategy
{
int
allowedPriority
=
10000
;
...
...
@@ -33,8 +21,7 @@ class TestStrategy {
}
void
main
(
)
{
TestSchedulerBinding
scheduler
;
SchedulerBinding
scheduler
;
setUpAll
(()
{
scheduler
=
TestSchedulerBinding
();
});
...
...
@@ -129,23 +116,4 @@ void main() {
expect
(
timerQueueTasks
.
length
,
2
);
expect
(
taskExecuted
,
false
);
});
test
(
'Flutter.Frame event fired'
,
()
async
{
window
.
onReportTimings
(<
FrameTiming
>[
FrameTiming
(<
int
>[
// build start, build finish
10000
,
15000
,
// raster start, raster finish
16000
,
20000
,
])]);
final
List
<
Map
<
String
,
dynamic
>>
events
=
scheduler
.
getEventsDispatched
(
'Flutter.Frame'
);
expect
(
events
,
hasLength
(
1
));
final
Map
<
String
,
dynamic
>
event
=
events
.
first
;
expect
(
event
[
'number'
],
isNonNegative
);
expect
(
event
[
'startTime'
],
10000
);
expect
(
event
[
'elapsed'
],
10000
);
expect
(
event
[
'build'
],
5000
);
expect
(
event
[
'raster'
],
4000
);
});
}
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