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
92e3436f
Unverified
Commit
92e3436f
authored
Jun 09, 2021
by
Abhishek Ghaskata
Committed by
GitHub
Jun 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
migrate complex layout to null safety (#83894)
parent
1df798a5
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
52 additions
and
55 deletions
+52
-55
main.dart
dev/benchmarks/complex_layout/lib/main.dart
+35
-35
pubspec.yaml
dev/benchmarks/complex_layout/pubspec.yaml
+1
-1
measure_scroll_smoothness.dart
...hmarks/complex_layout/test/measure_scroll_smoothness.dart
+6
-9
measure_scroll_smoothness_test.dart
...ex_layout/test_driver/measure_scroll_smoothness_test.dart
+1
-1
scroll_perf_test.dart
...nchmarks/complex_layout/test_driver/scroll_perf_test.dart
+1
-1
semantics_perf_test.dart
...marks/complex_layout/test_driver/semantics_perf_test.dart
+5
-5
scroll_perf.dart
dev/benchmarks/complex_layout/test_memory/scroll_perf.dart
+3
-3
No files found.
dev/benchmarks/complex_layout/lib/main.dart
View file @
92e3436f
This diff is collapsed.
Click to expand it.
dev/benchmarks/complex_layout/pubspec.yaml
View file @
92e3436f
...
...
@@ -2,7 +2,7 @@ name: complex_layout
description
:
A benchmark of a relatively complex layout.
environment
:
sdk
:
"
>=2.
2.2
<3.0.0"
sdk
:
"
>=2.
12.0
<3.0.0"
dependencies
:
flutter
:
...
...
dev/benchmarks/complex_layout/test/measure_scroll_smoothness.dart
View file @
92e3436f
...
...
@@ -66,7 +66,7 @@ class ResampleFlagVariant extends TestVariant<TestScenario> {
@override
final
Set
<
TestScenario
>
values
=
Set
<
TestScenario
>.
from
(
TestScenario
.
values
);
TestScenario
currentValue
;
late
TestScenario
currentValue
;
bool
get
resample
{
switch
(
currentValue
)
{
case
TestScenario
.
resampleOn90Hz
:
...
...
@@ -76,7 +76,6 @@ class ResampleFlagVariant extends TestVariant<TestScenario> {
case
TestScenario
.
resampleOff59Hz
:
return
false
;
}
throw
ArgumentError
;
}
double
get
frequency
{
switch
(
currentValue
)
{
...
...
@@ -87,10 +86,9 @@ class ResampleFlagVariant extends TestVariant<TestScenario> {
case
TestScenario
.
resampleOff59Hz
:
return
59.0
;
}
throw
ArgumentError
;
}
Map
<
String
,
dynamic
>
result
;
Map
<
String
,
dynamic
>
?
result
;
@override
String
describeValue
(
TestScenario
value
)
{
...
...
@@ -104,7 +102,6 @@ class ResampleFlagVariant extends TestVariant<TestScenario> {
case
TestScenario
.
resampleOff59Hz
:
return
'resample off with 59Hz input'
;
}
throw
ArgumentError
;
}
@override
...
...
@@ -118,7 +115,7 @@ class ResampleFlagVariant extends TestVariant<TestScenario> {
@override
Future
<
void
>
tearDown
(
TestScenario
value
,
bool
memento
)
async
{
binding
.
resamplingEnabled
=
memento
;
binding
.
reportData
[
describeValue
(
value
)]
=
result
;
binding
.
reportData
!
[
describeValue
(
value
)]
=
result
;
}
}
...
...
@@ -134,16 +131,16 @@ Future<void> main() async {
await
tester
.
pumpAndSettle
();
final
Finder
scrollerFinder
=
find
.
byKey
(
const
ValueKey
<
String
>(
'complex-scroll'
));
final
ListView
scroller
=
tester
.
widget
<
ListView
>(
scrollerFinder
);
final
ScrollController
controller
=
scroller
.
controller
;
final
ScrollController
?
controller
=
scroller
.
controller
;
final
List
<
int
>
frameTimestamp
=
<
int
>[];
final
List
<
double
>
scrollOffset
=
<
double
>[];
final
List
<
Duration
>
delays
=
<
Duration
>[];
binding
.
addPersistentFrameCallback
((
Duration
timeStamp
)
{
if
(
controller
.
hasClients
)
{
if
(
controller
?.
hasClients
==
true
)
{
// This if is necessary because by the end of the test the widget tree
// is destroyed.
frameTimestamp
.
add
(
timeStamp
.
inMicroseconds
);
scrollOffset
.
add
(
controller
.
offset
);
scrollOffset
.
add
(
controller
!
.
offset
);
}
});
...
...
dev/benchmarks/complex_layout/test_driver/measure_scroll_smoothness_test.dart
View file @
92e3436f
...
...
@@ -8,7 +8,7 @@ import 'package:integration_test/integration_test_driver.dart' as driver;
Future
<
void
>
main
()
=>
driver
.
integrationDriver
(
timeout:
const
Duration
(
minutes:
5
),
responseDataCallback:
(
Map
<
String
,
dynamic
>
data
)
async
{
responseDataCallback:
(
Map
<
String
,
dynamic
>
?
data
)
async
{
await
driver
.
writeResponseData
(
data
,
testOutputFilename:
'scroll_smoothness_test'
,
...
...
dev/benchmarks/complex_layout/test_driver/scroll_perf_test.dart
View file @
92e3436f
...
...
@@ -9,7 +9,7 @@ import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
void
main
(
)
{
group
(
'scrolling performance test'
,
()
{
FlutterDriver
driver
;
late
FlutterDriver
driver
;
setUpAll
(()
async
{
driver
=
await
FlutterDriver
.
connect
();
...
...
dev/benchmarks/complex_layout/test_driver/semantics_perf_test.dart
View file @
92e3436f
...
...
@@ -12,7 +12,7 @@ import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
void
main
(
)
{
group
(
'semantics performance test'
,
()
{
FlutterDriver
driver
;
late
FlutterDriver
driver
;
setUpAll
(()
async
{
driver
=
await
FlutterDriver
.
connect
(
printCommunication:
true
);
...
...
@@ -33,10 +33,10 @@ void main() {
expect
(
await
driver
.
setSemantics
(
true
),
isTrue
);
});
final
Iterable
<
TimelineEvent
>
semanticsEvents
=
timeline
.
events
.
where
((
TimelineEvent
event
)
=>
event
.
name
==
'Semantics'
);
if
(
semanticsEvents
.
length
!=
2
)
fail
(
'Expected exactly two semantics events, got
${semanticsEvents.length}
'
);
final
Duration
semanticsTreeCreation
=
Duration
(
microseconds:
semanticsEvents
.
last
.
timestampMicros
-
semanticsEvents
.
first
.
timestampMicros
);
final
Iterable
<
TimelineEvent
>
?
semanticsEvents
=
timeline
.
events
?
.
where
((
TimelineEvent
event
)
=>
event
.
name
==
'Semantics'
);
if
(
semanticsEvents
?
.
length
!=
2
)
fail
(
'Expected exactly two semantics events, got
${semanticsEvents
?
.length}
'
);
final
Duration
semanticsTreeCreation
=
Duration
(
microseconds:
semanticsEvents
!.
last
.
timestampMicros
!
-
semanticsEvents
.
first
.
timestampMicros
!
);
final
String
jsonEncoded
=
json
.
encode
(<
String
,
dynamic
>{
'initialSemanticsTreeCreation'
:
semanticsTreeCreation
.
inMilliseconds
});
File
(
p
.
join
(
testOutputsDirectory
,
'complex_layout_semantics_perf.json'
)).
writeAsStringSync
(
jsonEncoded
);
...
...
dev/benchmarks/complex_layout/test_memory/scroll_perf.dart
View file @
92e3436f
...
...
@@ -32,7 +32,7 @@ Future<void> main() async {
child:
ComplexLayoutApp
(),
),
));
await
SchedulerBinding
.
instance
.
endOfFrame
;
await
SchedulerBinding
.
instance
?
.
endOfFrame
;
/// Wait 50ms to allow the raster thread to actually put up the frame. (The
/// endOfFrame future ends when we send the data to the engine, before
...
...
@@ -50,9 +50,9 @@ Future<void> main() async {
child:
ComplexLayoutApp
(),
),
));
await
SchedulerBinding
.
instance
.
endOfFrame
;
await
SchedulerBinding
.
instance
?
.
endOfFrame
;
final
WidgetController
controller
=
LiveWidgetController
(
WidgetsBinding
.
instance
);
final
WidgetController
controller
=
LiveWidgetController
(
WidgetsBinding
.
instance
!
);
// Scroll down
for
(
int
iteration
=
0
;
iteration
<
maxIterations
;
iteration
+=
1
)
{
...
...
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