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
8f75d537
Unverified
Commit
8f75d537
authored
Jun 14, 2019
by
Keerti Parthasarathy
Committed by
GitHub
Jun 14, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "redux of a change to use new engine APIs for Flutter.Frame events (#34365)" (#34514)
This reverts commit
ceb09b8b
.
parent
ceb09b8b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
77 deletions
+29
-77
service_extensions_test.dart
dev/devicelab/bin/tasks/service_extensions_test.dart
+8
-20
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.
dev/devicelab/bin/tasks/service_extensions_test.dart
View file @
8f75d537
...
...
@@ -6,11 +6,12 @@ import 'dart:async';
import
'dart:convert'
;
import
'dart:io'
;
import
'package:path/path.dart'
as
path
;
import
'package:vm_service_client/vm_service_client.dart'
;
import
'package:flutter_devicelab/framework/adb.dart'
;
import
'package:flutter_devicelab/framework/framework.dart'
;
import
'package:flutter_devicelab/framework/utils.dart'
;
import
'package:path/path.dart'
as
path
;
import
'package:vm_service_client/vm_service_client.dart'
;
void
main
(
)
{
task
(()
async
{
...
...
@@ -56,19 +57,10 @@ void main() {
final
VMServiceClient
client
=
VMServiceClient
.
connect
(
'ws://localhost:
$vmServicePort
/ws'
);
final
VM
vm
=
await
client
.
getVM
();
final
VMIsolateRef
isolate
=
vm
.
isolates
.
first
;
final
StreamController
<
VMExtensionEvent
>
frameEventsController
=
StreamController
<
VMExtensionEvent
>();
final
StreamController
<
VMExtensionEvent
>
navigationEventsController
=
StreamController
<
VMExtensionEvent
>();
isolate
.
onExtensionEvent
.
listen
((
VMExtensionEvent
event
)
{
if
(
event
.
kind
==
'Flutter.Frame'
)
{
frameEventsController
.
add
(
event
);
}
else
if
(
event
.
kind
==
'Flutter.Navigation'
)
{
navigationEventsController
.
add
(
event
);
}
});
final
Stream
<
VMExtensionEvent
>
frameEvents
=
frameEventsController
.
stream
;
final
Stream
<
VMExtensionEvent
>
navigationEvents
=
navigationEventsController
.
stream
;
final
Stream
<
VMExtensionEvent
>
frameEvents
=
isolate
.
onExtensionEvent
.
where
(
(
VMExtensionEvent
e
)
=>
e
.
kind
==
'Flutter.Frame'
);
final
Stream
<
VMExtensionEvent
>
navigationEvents
=
isolate
.
onExtensionEvent
.
where
(
(
VMExtensionEvent
e
)
=>
e
.
kind
==
'Flutter.Navigation'
);
print
(
'reassembling app...'
);
final
Future
<
VMExtensionEvent
>
frameFuture
=
frameEvents
.
first
;
...
...
@@ -79,17 +71,13 @@ void main() {
print
(
'
${event.kind}
:
${event.data}
'
);
// validate the fields
// {number: 8, startTime: 0, elapsed: 1437
, build: 600, raster: 800
}
// {number: 8, startTime: 0, elapsed: 1437}
expect
(
event
.
data
[
'number'
]
is
int
);
expect
(
event
.
data
[
'number'
]
>=
0
);
expect
(
event
.
data
[
'startTime'
]
is
int
);
expect
(
event
.
data
[
'startTime'
]
>=
0
);
expect
(
event
.
data
[
'elapsed'
]
is
int
);
expect
(
event
.
data
[
'elapsed'
]
>=
0
);
expect
(
event
.
data
[
'build'
]
is
int
);
expect
(
event
.
data
[
'build'
]
>=
0
);
expect
(
event
.
data
[
'raster'
]
is
int
);
expect
(
event
.
data
[
'raster'
]
>=
0
);
final
Future
<
VMExtensionEvent
>
navigationFuture
=
navigationEvents
.
first
;
// This tap triggers a navigation event.
...
...
packages/flutter/lib/src/scheduler/binding.dart
View file @
8f75d537
...
...
@@ -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 @
8f75d537
...
...
@@ -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