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
c10164c4
Unverified
Commit
c10164c4
authored
Sep 07, 2022
by
Kenzie Davisson
Committed by
GitHub
Sep 07, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create consts for service extension names so they can be accessed from tooling (#110876)
parent
2b373903
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
133 additions
and
73 deletions
+133
-73
binding.dart
packages/flutter/lib/src/widgets/binding.dart
+9
-24
service_extensions.dart
packages/flutter/lib/src/widgets/service_extensions.dart
+96
-0
widgets.dart
packages/flutter/lib/widgets.dart
+1
-0
service_extensions_test.dart
...ages/flutter/test/foundation/service_extensions_test.dart
+27
-49
No files found.
packages/flutter/lib/src/widgets/binding.dart
View file @
c10164c4
...
@@ -18,6 +18,7 @@ import 'focus_manager.dart';
...
@@ -18,6 +18,7 @@ import 'focus_manager.dart';
import
'framework.dart'
;
import
'framework.dart'
;
import
'platform_menu_bar.dart'
;
import
'platform_menu_bar.dart'
;
import
'router.dart'
;
import
'router.dart'
;
import
'service_extensions.dart'
;
import
'widget_inspector.dart'
;
import
'widget_inspector.dart'
;
export
'dart:ui'
show
AppLifecycleState
,
Locale
;
export
'dart:ui'
show
AppLifecycleState
,
Locale
;
...
@@ -360,7 +361,7 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
...
@@ -360,7 +361,7 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
if
(!
kReleaseMode
)
{
if
(!
kReleaseMode
)
{
registerServiceExtension
(
registerServiceExtension
(
name:
'debugDumpApp'
,
name:
WidgetsServiceExtensions
.
debugDumpApp
.
name
,
callback:
(
Map
<
String
,
String
>
parameters
)
async
{
callback:
(
Map
<
String
,
String
>
parameters
)
async
{
final
String
data
=
_debugDumpAppString
();
final
String
data
=
_debugDumpAppString
();
return
<
String
,
Object
>{
return
<
String
,
Object
>{
...
@@ -371,7 +372,7 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
...
@@ -371,7 +372,7 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
if
(!
kIsWeb
)
{
if
(!
kIsWeb
)
{
registerBoolServiceExtension
(
registerBoolServiceExtension
(
name:
'showPerformanceOverlay'
,
name:
WidgetsServiceExtensions
.
showPerformanceOverlay
.
name
,
getter:
()
=>
getter:
()
=>
Future
<
bool
>.
value
(
WidgetsApp
.
showPerformanceOverlayOverride
),
Future
<
bool
>.
value
(
WidgetsApp
.
showPerformanceOverlayOverride
),
setter:
(
bool
value
)
{
setter:
(
bool
value
)
{
...
@@ -385,7 +386,7 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
...
@@ -385,7 +386,7 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
}
}
registerServiceExtension
(
registerServiceExtension
(
name:
'didSendFirstFrameEvent'
,
name:
WidgetsServiceExtensions
.
didSendFirstFrameEvent
.
name
,
callback:
(
_
)
async
{
callback:
(
_
)
async
{
return
<
String
,
dynamic
>{
return
<
String
,
dynamic
>{
// This is defined to return a STRING, not a boolean.
// This is defined to return a STRING, not a boolean.
...
@@ -396,10 +397,8 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
...
@@ -396,10 +397,8 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
},
},
);
);
// This returns 'true' when the first frame is rasterized, and the trace
// event 'Rasterized first useful frame' is sent out.
registerServiceExtension
(
registerServiceExtension
(
name:
'didSendFirstFrameRasterizedEvent'
,
name:
WidgetsServiceExtensions
.
didSendFirstFrameRasterizedEvent
.
name
,
callback:
(
_
)
async
{
callback:
(
_
)
async
{
return
<
String
,
dynamic
>{
return
<
String
,
dynamic
>{
// This is defined to return a STRING, not a boolean.
// This is defined to return a STRING, not a boolean.
...
@@ -411,7 +410,7 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
...
@@ -411,7 +410,7 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
);
);
registerServiceExtension
(
registerServiceExtension
(
name:
'fastReassemble'
,
name:
WidgetsServiceExtensions
.
fastReassemble
.
name
,
callback:
(
Map
<
String
,
Object
>
params
)
async
{
callback:
(
Map
<
String
,
Object
>
params
)
async
{
// This mirrors the implementation of the 'reassemble' callback registration
// This mirrors the implementation of the 'reassemble' callback registration
// in lib/src/foundation/binding.dart, but with the extra binding config used
// in lib/src/foundation/binding.dart, but with the extra binding config used
...
@@ -429,7 +428,7 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
...
@@ -429,7 +428,7 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
// Expose the ability to send Widget rebuilds as [Timeline] events.
// Expose the ability to send Widget rebuilds as [Timeline] events.
registerBoolServiceExtension
(
registerBoolServiceExtension
(
name:
'profileWidgetBuilds'
,
name:
WidgetsServiceExtensions
.
profileWidgetBuilds
.
name
,
getter:
()
async
=>
debugProfileBuildsEnabled
,
getter:
()
async
=>
debugProfileBuildsEnabled
,
setter:
(
bool
value
)
async
{
setter:
(
bool
value
)
async
{
if
(
debugProfileBuildsEnabled
!=
value
)
{
if
(
debugProfileBuildsEnabled
!=
value
)
{
...
@@ -438,7 +437,7 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
...
@@ -438,7 +437,7 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
},
},
);
);
registerBoolServiceExtension
(
registerBoolServiceExtension
(
name:
'profileUserWidgetBuilds'
,
name:
WidgetsServiceExtensions
.
profileUserWidgetBuilds
.
name
,
getter:
()
async
=>
debugProfileBuildsEnabledUserWidgets
,
getter:
()
async
=>
debugProfileBuildsEnabledUserWidgets
,
setter:
(
bool
value
)
async
{
setter:
(
bool
value
)
async
{
if
(
debugProfileBuildsEnabledUserWidgets
!=
value
)
{
if
(
debugProfileBuildsEnabledUserWidgets
!=
value
)
{
...
@@ -450,7 +449,7 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
...
@@ -450,7 +449,7 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
assert
(()
{
assert
(()
{
registerBoolServiceExtension
(
registerBoolServiceExtension
(
name:
'debugAllowBanner'
,
name:
WidgetsServiceExtensions
.
debugAllowBanner
.
name
,
getter:
()
=>
Future
<
bool
>.
value
(
WidgetsApp
.
debugAllowBannerOverride
),
getter:
()
=>
Future
<
bool
>.
value
(
WidgetsApp
.
debugAllowBannerOverride
),
setter:
(
bool
value
)
{
setter:
(
bool
value
)
{
if
(
WidgetsApp
.
debugAllowBannerOverride
==
value
)
{
if
(
WidgetsApp
.
debugAllowBannerOverride
==
value
)
{
...
@@ -461,20 +460,6 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
...
@@ -461,20 +460,6 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
},
},
);
);
// This service extension is deprecated and will be removed by 12/1/2018.
// Use ext.flutter.inspector.show instead.
registerBoolServiceExtension
(
name:
'debugWidgetInspector'
,
getter:
()
async
=>
WidgetsApp
.
debugShowWidgetInspectorOverride
,
setter:
(
bool
value
)
{
if
(
WidgetsApp
.
debugShowWidgetInspectorOverride
==
value
)
{
return
Future
<
void
>.
value
();
}
WidgetsApp
.
debugShowWidgetInspectorOverride
=
value
;
return
_forceRebuild
();
},
);
WidgetInspectorService
.
instance
.
initServiceExtensions
(
registerServiceExtension
);
WidgetInspectorService
.
instance
.
initServiceExtensions
(
registerServiceExtension
);
return
true
;
return
true
;
...
...
packages/flutter/lib/src/widgets/service_extensions.dart
0 → 100644
View file @
c10164c4
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/// Service extension constants for the widgets library.
///
/// These constants will be used when registering service extensions in the
/// framework, and they will also be used by tools and services that call these
/// service extensions.
///
/// The String value for each of these extension names should be accessed by
/// calling the `.name` property on the enum value.
enum
WidgetsServiceExtensions
{
/// Name of service extension that, when called, will output a string
/// representation of this app's widget tree to console.
///
/// See also:
///
/// * [WidgetsBinding.initServiceExtensions], where the service extension is
/// registered.
debugDumpApp
,
/// Name of service extension that, when called, will overlay a performance
/// graph on top of this app.
///
/// See also:
///
/// * [WidgetsApp.showPerformanceOverlayOverride], which is the flag
/// that this service extension exposes.
/// * [WidgetsBinding.initServiceExtensions], where the service extension is
/// registered.
showPerformanceOverlay
,
/// Name of service extension that, when called, will return whether the first
/// 'Flutter.Frame' event has been reported on the Extension stream.
///
/// See also:
///
/// * [WidgetsBinding.initServiceExtensions], where the service extension is
/// registered.
didSendFirstFrameEvent
,
/// Name of service extension that, when called, will return whether the first
/// frame has been rasterized and the trace event 'Rasterized first useful
/// frame' has been sent out.
///
/// See also:
///
/// * [WidgetsBinding.initServiceExtensions], where the service extension is
/// registered.
didSendFirstFrameRasterizedEvent
,
/// Name of service extension that, when called, will reassemble the
/// application.
///
/// See also:
///
/// * [WidgetsBinding.initServiceExtensions], where the service extension is
/// registered.
fastReassemble
,
/// Name of service extension that, when called, will change the value of
/// [debugProfileBuildsEnabled], which adds [Timeline] events for every widget
/// built.
///
/// See also:
///
/// * [debugProfileBuildsEnabled], which is the flag that this service extension
/// exposes.
/// * [WidgetsBinding.initServiceExtensions], where the service extension is
/// registered.
profileWidgetBuilds
,
/// Name of service extension that, when called, will change the value of
/// [debugProfileBuildsEnabledUserWidgets], which adds [Timeline] events for
/// every user-created widget built.
///
/// See also:
/// * [debugProfileBuildsEnabledUserWidgets], which is the flag that this
/// service extension exposes.
/// * [WidgetsBinding.initServiceExtensions], where the service extension is
/// registered.
profileUserWidgetBuilds
,
/// Name of service extension that, when called, will change the value of
/// [WidgetsApp.debugAllowBannerOverride], which controls the visibility of the
/// debug banner for debug mode apps.
///
/// See also:
///
/// * [WidgetsApp.debugAllowBannerOverride], which is the flag that this service
/// extension exposes.
/// * [WidgetsBinding.initServiceExtensions], where the service extension is
/// registered.
debugAllowBanner
,
}
packages/flutter/lib/widgets.dart
View file @
c10164c4
...
@@ -116,6 +116,7 @@ export 'src/widgets/scrollbar.dart';
...
@@ -116,6 +116,7 @@ export 'src/widgets/scrollbar.dart';
export
'src/widgets/selectable_region.dart'
;
export
'src/widgets/selectable_region.dart'
;
export
'src/widgets/selection_container.dart'
;
export
'src/widgets/selection_container.dart'
;
export
'src/widgets/semantics_debugger.dart'
;
export
'src/widgets/semantics_debugger.dart'
;
export
'src/widgets/service_extensions.dart'
;
export
'src/widgets/shared_app_data.dart'
;
export
'src/widgets/shared_app_data.dart'
;
export
'src/widgets/shortcuts.dart'
;
export
'src/widgets/shortcuts.dart'
;
export
'src/widgets/single_child_scroll_view.dart'
;
export
'src/widgets/single_child_scroll_view.dart'
;
...
...
packages/flutter/test/foundation/service_extensions_test.dart
View file @
c10164c4
This diff is collapsed.
Click to expand it.
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