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
03e81003
Unverified
Commit
03e81003
authored
Sep 10, 2019
by
Mouad Debbar
Committed by
GitHub
Sep 10, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable the performance overlay for web (#39999)
parent
423a1914
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
21 deletions
+32
-21
binding.dart
packages/flutter/lib/src/widgets/binding.dart
+13
-11
service_extensions_test.dart
...ages/flutter/test/foundation/service_extensions_test.dart
+19
-10
No files found.
packages/flutter/lib/src/widgets/binding.dart
View file @
03e81003
...
...
@@ -284,17 +284,19 @@ mixin WidgetsBinding on BindingBase, SchedulerBinding, GestureBinding, RendererB
},
);
registerBoolServiceExtension
(
name:
'showPerformanceOverlay'
,
getter:
()
=>
Future
<
bool
>.
value
(
WidgetsApp
.
showPerformanceOverlayOverride
),
setter:
(
bool
value
)
{
if
(
WidgetsApp
.
showPerformanceOverlayOverride
==
value
)
return
Future
<
void
>.
value
();
WidgetsApp
.
showPerformanceOverlayOverride
=
value
;
return
_forceRebuild
();
},
);
if
(!
kIsWeb
)
{
registerBoolServiceExtension
(
name:
'showPerformanceOverlay'
,
getter:
()
=>
Future
<
bool
>.
value
(
WidgetsApp
.
showPerformanceOverlayOverride
),
setter:
(
bool
value
)
{
if
(
WidgetsApp
.
showPerformanceOverlayOverride
==
value
)
return
Future
<
void
>.
value
();
WidgetsApp
.
showPerformanceOverlayOverride
=
value
;
return
_forceRebuild
();
},
);
}
registerServiceExtension
(
name:
'didSendFirstFrameEvent'
,
...
...
packages/flutter/test/foundation/service_extensions_test.dart
View file @
03e81003
...
...
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@TestOn
(
'!chrome'
)
import
'dart:async'
;
import
'dart:convert'
;
import
'dart:typed_data'
;
...
...
@@ -169,9 +167,14 @@ void main() {
widgetInspectorExtensionCount
+=
2
;
}
// The following service extensions are disabled in web:
// 1. exit
// 2. saveCompilationTrace
// 3. showPerformanceOverlay
const
int
disabledExtensions
=
kIsWeb
?
3
:
0
;
// If you add a service extension... TEST IT! :-)
// ...then increment this number.
expect
(
binding
.
extensions
.
length
,
27
+
widgetInspectorExtensionCount
);
expect
(
binding
.
extensions
.
length
,
27
+
widgetInspectorExtensionCount
-
disabledExtensions
);
expect
(
console
,
isEmpty
);
debugPrint
=
debugPrintThrottled
;
...
...
@@ -592,6 +595,12 @@ void main() {
test
(
'Service extensions - showPerformanceOverlay'
,
()
async
{
Map
<
String
,
dynamic
>
result
;
// The performance overlay service extension is disabled on the web.
if
(
kIsWeb
)
{
expect
(
binding
.
extensions
.
containsKey
(
'showPerformanceOverlay'
),
isFalse
);
return
;
}
expect
(
binding
.
frameScheduled
,
isFalse
);
expect
(
WidgetsApp
.
showPerformanceOverlayOverride
,
false
);
result
=
await
binding
.
testExtension
(
'showPerformanceOverlay'
,
<
String
,
String
>{});
...
...
@@ -642,29 +651,29 @@ void main() {
expect
(
binding
.
frameScheduled
,
isFalse
);
expect
(
timeDilation
,
1.0
);
result
=
await
binding
.
testExtension
(
'timeDilation'
,
<
String
,
String
>{});
expect
(
result
,
<
String
,
String
>{
'timeDilation'
:
'1.0'
});
expect
(
result
,
<
String
,
String
>{
'timeDilation'
:
1.0
.
toString
()
});
expect
(
timeDilation
,
1.0
);
expect
(
extensionChangedEvents
,
isEmpty
);
result
=
await
binding
.
testExtension
(
'timeDilation'
,
<
String
,
String
>{
'timeDilation'
:
'100.0'
});
expect
(
result
,
<
String
,
String
>{
'timeDilation'
:
'100.0'
});
expect
(
result
,
<
String
,
String
>{
'timeDilation'
:
100.0
.
toString
()
});
expect
(
timeDilation
,
100.0
);
expect
(
extensionChangedEvents
.
length
,
1
);
extensionChangedEvent
=
extensionChangedEvents
.
last
;
expect
(
extensionChangedEvent
[
'extension'
],
'ext.flutter.timeDilation'
);
expect
(
extensionChangedEvent
[
'value'
],
'100.0'
);
expect
(
extensionChangedEvent
[
'value'
],
100.0
.
toString
()
);
result
=
await
binding
.
testExtension
(
'timeDilation'
,
<
String
,
String
>{});
expect
(
result
,
<
String
,
String
>{
'timeDilation'
:
'100.0'
});
expect
(
result
,
<
String
,
String
>{
'timeDilation'
:
100.0
.
toString
()
});
expect
(
timeDilation
,
100.0
);
expect
(
extensionChangedEvents
.
length
,
1
);
result
=
await
binding
.
testExtension
(
'timeDilation'
,
<
String
,
String
>{
'timeDilation'
:
'1.0'
});
expect
(
result
,
<
String
,
String
>{
'timeDilation'
:
'1.0'
});
expect
(
result
,
<
String
,
String
>{
'timeDilation'
:
1.0
.
toString
()
});
expect
(
timeDilation
,
1.0
);
expect
(
extensionChangedEvents
.
length
,
2
);
extensionChangedEvent
=
extensionChangedEvents
.
last
;
expect
(
extensionChangedEvent
[
'extension'
],
'ext.flutter.timeDilation'
);
expect
(
extensionChangedEvent
[
'value'
],
'1.0'
);
expect
(
extensionChangedEvent
[
'value'
],
1.0
.
toString
()
);
result
=
await
binding
.
testExtension
(
'timeDilation'
,
<
String
,
String
>{});
expect
(
result
,
<
String
,
String
>{
'timeDilation'
:
'1.0'
});
expect
(
result
,
<
String
,
String
>{
'timeDilation'
:
1.0
.
toString
()
});
expect
(
timeDilation
,
1.0
);
expect
(
extensionChangedEvents
.
length
,
2
);
expect
(
binding
.
frameScheduled
,
isFalse
);
...
...
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