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
763f8754
Unverified
Commit
763f8754
authored
Mar 27, 2020
by
Ferhat
Committed by
GitHub
Mar 27, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Treeshake debugFillProperties (#53303)
parent
64426111
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
242 additions
and
148 deletions
+242
-148
listener_helpers.dart
packages/flutter/lib/src/animation/listener_helpers.dart
+24
-14
diagnostics.dart
packages/flutter/lib/src/foundation/diagnostics.dart
+142
-98
pointer_router.dart
packages/flutter/lib/src/gestures/pointer_router.dart
+8
-3
pointer_signal_resolver.dart
...ges/flutter/lib/src/gestures/pointer_signal_resolver.dart
+8
-3
recognizer.dart
packages/flutter/lib/src/gestures/recognizer.dart
+9
-4
image_provider.dart
packages/flutter/lib/src/painting/image_provider.dart
+28
-13
binding.dart
packages/flutter/lib/src/scheduler/binding.dart
+11
-6
focus_manager.dart
packages/flutter/lib/src/widgets/focus_manager.dart
+12
-7
No files found.
packages/flutter/lib/src/animation/listener_helpers.dart
View file @
763f8754
...
...
@@ -119,6 +119,17 @@ mixin AnimationLocalListenersMixin {
void
notifyListeners
()
{
final
List
<
VoidCallback
>
localListeners
=
List
<
VoidCallback
>.
from
(
_listeners
);
for
(
final
VoidCallback
listener
in
localListeners
)
{
InformationCollector
collector
;
assert
(()
{
collector
=
()
sync
*
{
yield
DiagnosticsProperty
<
AnimationLocalListenersMixin
>(
'The
$runtimeType
notifying listeners was'
,
this
,
style:
DiagnosticsTreeStyle
.
errorProperty
,
);
};
return
true
;
}());
try
{
if
(
_listeners
.
contains
(
listener
))
listener
();
...
...
@@ -128,13 +139,7 @@ mixin AnimationLocalListenersMixin {
stack:
stack
,
library
:
'animation library'
,
context:
ErrorDescription
(
'while notifying listeners for
$runtimeType
'
),
informationCollector:
()
sync
*
{
yield
DiagnosticsProperty
<
AnimationLocalListenersMixin
>(
'The
$runtimeType
notifying listeners was'
,
this
,
style:
DiagnosticsTreeStyle
.
errorProperty
,
);
},
informationCollector:
collector
,
));
}
}
...
...
@@ -192,18 +197,23 @@ mixin AnimationLocalStatusListenersMixin {
if
(
_statusListeners
.
contains
(
listener
))
listener
(
status
);
}
catch
(
exception
,
stack
)
{
FlutterError
.
reportError
(
FlutterErrorDetails
(
exception:
exception
,
stack:
stack
,
library
:
'animation library'
,
context:
ErrorDescription
(
'while notifying status listeners for
$runtimeType
'
),
informationCollector:
()
sync
*
{
InformationCollector
collector
;
assert
(()
{
collector
=
()
sync
*
{
yield
DiagnosticsProperty
<
AnimationLocalStatusListenersMixin
>(
'The
$runtimeType
notifying status listeners was'
,
this
,
style:
DiagnosticsTreeStyle
.
errorProperty
,
);
},
};
return
true
;
}());
FlutterError
.
reportError
(
FlutterErrorDetails
(
exception:
exception
,
stack:
stack
,
library
:
'animation library'
,
context:
ErrorDescription
(
'while notifying status listeners for
$runtimeType
'
),
informationCollector:
collector
));
}
}
...
...
packages/flutter/lib/src/foundation/diagnostics.dart
View file @
763f8754
...
...
@@ -1112,7 +1112,21 @@ class TextTreeRenderer {
})
{
if
(
kReleaseMode
)
{
return
''
;
}
else
{
return
_debugRender
(
node
,
prefixLineOne:
prefixLineOne
,
prefixOtherLines:
prefixOtherLines
,
parentConfiguration:
parentConfiguration
);
}
}
String
_debugRender
(
DiagnosticsNode
node
,
{
String
prefixLineOne
=
''
,
String
prefixOtherLines
,
TextTreeConfiguration
parentConfiguration
,
})
{
final
bool
isSingleLine
=
_isSingleLine
(
node
.
style
)
&&
parentConfiguration
?.
lineBreakProperties
!=
true
;
prefixOtherLines
??=
prefixLineOne
;
if
(
node
.
linePrefix
!=
null
)
{
...
...
@@ -1536,49 +1550,51 @@ abstract class DiagnosticsNode {
/// plugin.
@mustCallSuper
Map
<
String
,
Object
>
toJsonMap
(
DiagnosticsSerializationDelegate
delegate
)
{
if
(
kReleaseMode
)
{
return
<
String
,
Object
>{};
}
final
bool
hasChildren
=
getChildren
().
isNotEmpty
;
return
<
String
,
Object
>{
'description'
:
toDescription
(),
'type'
:
runtimeType
.
toString
(),
if
(
name
!=
null
)
'name'
:
name
,
if
(!
showSeparator
)
'showSeparator'
:
showSeparator
,
if
(
level
!=
DiagnosticLevel
.
info
)
'level'
:
describeEnum
(
level
),
if
(
showName
==
false
)
'showName'
:
showName
,
if
(
emptyBodyDescription
!=
null
)
'emptyBodyDescription'
:
emptyBodyDescription
,
if
(
style
!=
DiagnosticsTreeStyle
.
sparse
)
'style'
:
describeEnum
(
style
),
if
(
allowTruncate
)
'allowTruncate'
:
allowTruncate
,
if
(
hasChildren
)
'hasChildren'
:
hasChildren
,
if
(
linePrefix
?.
isNotEmpty
==
true
)
'linePrefix'
:
linePrefix
,
if
(!
allowWrap
)
'allowWrap'
:
allowWrap
,
if
(
allowNameWrap
)
'allowNameWrap'
:
allowNameWrap
,
...
delegate
.
additionalNodeProperties
(
this
),
if
(
delegate
.
includeProperties
)
'properties'
:
toJsonList
(
delegate
.
filterProperties
(
getProperties
(),
this
),
this
,
delegate
,
),
if
(
delegate
.
subtreeDepth
>
0
)
'children'
:
toJsonList
(
delegate
.
filterChildren
(
getChildren
(),
this
),
this
,
delegate
,
),
};
Map
<
String
,
Object
>
result
=
<
String
,
Object
>{};
assert
(()
{
final
bool
hasChildren
=
getChildren
().
isNotEmpty
;
result
=
<
String
,
Object
>{
'description'
:
toDescription
(),
'type'
:
runtimeType
.
toString
(),
if
(
name
!=
null
)
'name'
:
name
,
if
(!
showSeparator
)
'showSeparator'
:
showSeparator
,
if
(
level
!=
DiagnosticLevel
.
info
)
'level'
:
describeEnum
(
level
),
if
(
showName
==
false
)
'showName'
:
showName
,
if
(
emptyBodyDescription
!=
null
)
'emptyBodyDescription'
:
emptyBodyDescription
,
if
(
style
!=
DiagnosticsTreeStyle
.
sparse
)
'style'
:
describeEnum
(
style
),
if
(
allowTruncate
)
'allowTruncate'
:
allowTruncate
,
if
(
hasChildren
)
'hasChildren'
:
hasChildren
,
if
(
linePrefix
?.
isNotEmpty
==
true
)
'linePrefix'
:
linePrefix
,
if
(!
allowWrap
)
'allowWrap'
:
allowWrap
,
if
(
allowNameWrap
)
'allowNameWrap'
:
allowNameWrap
,
...
delegate
.
additionalNodeProperties
(
this
),
if
(
delegate
.
includeProperties
)
'properties'
:
toJsonList
(
delegate
.
filterProperties
(
getProperties
(),
this
),
this
,
delegate
,
),
if
(
delegate
.
subtreeDepth
>
0
)
'children'
:
toJsonList
(
delegate
.
filterChildren
(
getChildren
(),
this
),
this
,
delegate
,
),
};
return
true
;
}());
return
result
;
}
/// Serializes a [List] of [DiagnosticsNode]s to a JSON list according to
...
...
@@ -1622,22 +1638,28 @@ abstract class DiagnosticsNode {
TextTreeConfiguration
parentConfiguration
,
DiagnosticLevel
minLevel
=
DiagnosticLevel
.
info
,
})
{
if
(
kReleaseMode
)
{
return
super
.
toString
();
}
String
result
=
super
.
toString
();
assert
(
style
!=
null
);
assert
(
minLevel
!=
null
);
if
(
_isSingleLine
(
style
))
return
toStringDeep
(
parentConfiguration:
parentConfiguration
,
minLevel:
minLevel
);
final
String
description
=
toDescription
(
parentConfiguration:
parentConfiguration
);
assert
(
description
!=
null
);
if
(
name
==
null
||
name
.
isEmpty
||
!
showName
)
return
description
;
assert
(()
{
if
(
_isSingleLine
(
style
))
{
result
=
toStringDeep
(
parentConfiguration:
parentConfiguration
,
minLevel:
minLevel
);
}
else
{
final
String
description
=
toDescription
(
parentConfiguration:
parentConfiguration
);
assert
(
description
!=
null
)
;
return
description
.
contains
(
'
\n
'
)
?
'
$name$_separator
\n
$description
'
:
'
$name$_separator
$description
'
;
if
(
name
==
null
||
name
.
isEmpty
||
!
showName
)
{
result
=
description
;
}
else
{
result
=
description
.
contains
(
'
\n
'
)
?
'
$name$_separator
\n
$description
'
:
'
$name$_separator
$description
'
;
}
}
return
true
;
}());
return
result
;
}
/// Returns a configuration specifying how this object should be rendered
...
...
@@ -1699,19 +1721,21 @@ abstract class DiagnosticsNode {
TextTreeConfiguration
parentConfiguration
,
DiagnosticLevel
minLevel
=
DiagnosticLevel
.
debug
,
})
{
if
(
kReleaseMode
)
{
return
''
;
}
return
TextTreeRenderer
(
minLevel:
minLevel
,
wrapWidth:
65
,
wrapWidthProperties:
65
,
).
render
(
this
,
prefixLineOne:
prefixLineOne
,
prefixOtherLines:
prefixOtherLines
,
parentConfiguration:
parentConfiguration
,
);
String
result
=
''
;
assert
(()
{
result
=
TextTreeRenderer
(
minLevel:
minLevel
,
wrapWidth:
65
,
wrapWidthProperties:
65
,
).
render
(
this
,
prefixLineOne:
prefixLineOne
,
prefixOtherLines:
prefixOtherLines
,
parentConfiguration:
parentConfiguration
,
);
return
true
;
}());
return
result
;
}
}
...
...
@@ -2893,13 +2917,18 @@ class DiagnosticableNode<T extends Diagnosticable> extends DiagnosticsNode {
///
/// It will cache the result to prevent duplicate operation.
DiagnosticPropertiesBuilder
get
builder
{
if
(
kReleaseMode
)
if
(
kReleaseMode
)
{
return
null
;
if
(
_cachedBuilder
==
null
)
{
_cachedBuilder
=
DiagnosticPropertiesBuilder
();
value
?.
debugFillProperties
(
_cachedBuilder
);
}
else
{
assert
(()
{
if
(
_cachedBuilder
==
null
)
{
_cachedBuilder
=
DiagnosticPropertiesBuilder
();
value
?.
debugFillProperties
(
_cachedBuilder
);
}
return
true
;
}());
return
_cachedBuilder
;
}
return
_cachedBuilder
;
}
@override
...
...
@@ -2920,10 +2949,12 @@ class DiagnosticableNode<T extends Diagnosticable> extends DiagnosticsNode {
@override
String
toDescription
({
TextTreeConfiguration
parentConfiguration
})
{
if
(
kReleaseMode
)
{
return
''
;
}
return
value
.
toStringShort
();
String
result
=
''
;
assert
(()
{
result
=
value
.
toStringShort
();
return
true
;
}());
return
result
;
}
}
...
...
@@ -3002,9 +3033,10 @@ class DiagnosticPropertiesBuilder {
/// Add a property to the list of properties.
void
add
(
DiagnosticsNode
property
)
{
if
(!
kReleaseMode
)
{
assert
((
)
{
properties
.
add
(
property
);
}
return
true
;
}());
}
/// List of properties accumulated so far.
...
...
@@ -3376,15 +3408,21 @@ abstract class DiagnosticableTree with Diagnosticable {
if
(
kReleaseMode
)
{
return
toString
();
}
final
StringBuffer
result
=
StringBuffer
();
result
.
write
(
toString
());
result
.
write
(
joiner
);
final
DiagnosticPropertiesBuilder
builder
=
DiagnosticPropertiesBuilder
();
debugFillProperties
(
builder
);
result
.
write
(
builder
.
properties
.
where
((
DiagnosticsNode
n
)
=>
!
n
.
isFiltered
(
minLevel
)).
join
(
joiner
),
);
return
result
.
toString
();
String
shallowString
;
assert
(()
{
final
StringBuffer
result
=
StringBuffer
();
result
.
write
(
toString
());
result
.
write
(
joiner
);
final
DiagnosticPropertiesBuilder
builder
=
DiagnosticPropertiesBuilder
();
debugFillProperties
(
builder
);
result
.
write
(
builder
.
properties
.
where
((
DiagnosticsNode
n
)
=>
!
n
.
isFiltered
(
minLevel
))
.
join
(
joiner
),
);
shallowString
=
result
.
toString
();
return
true
;
}());
return
shallowString
;
}
/// Returns a string representation of this node and its descendants.
...
...
@@ -3463,15 +3501,21 @@ mixin DiagnosticableTreeMixin implements DiagnosticableTree {
if
(
kReleaseMode
)
{
return
toString
();
}
final
StringBuffer
result
=
StringBuffer
();
result
.
write
(
toStringShort
());
result
.
write
(
joiner
);
final
DiagnosticPropertiesBuilder
builder
=
DiagnosticPropertiesBuilder
();
debugFillProperties
(
builder
);
result
.
write
(
builder
.
properties
.
where
((
DiagnosticsNode
n
)
=>
!
n
.
isFiltered
(
minLevel
)).
join
(
joiner
),
);
return
result
.
toString
();
String
shallowString
;
assert
(()
{
final
StringBuffer
result
=
StringBuffer
();
result
.
write
(
toStringShort
());
result
.
write
(
joiner
);
final
DiagnosticPropertiesBuilder
builder
=
DiagnosticPropertiesBuilder
();
debugFillProperties
(
builder
);
result
.
write
(
builder
.
properties
.
where
((
DiagnosticsNode
n
)
=>
!
n
.
isFiltered
(
minLevel
))
.
join
(
joiner
),
);
shallowString
=
result
.
toString
();
return
true
;
}());
return
shallowString
;
}
@override
...
...
packages/flutter/lib/src/gestures/pointer_router.dart
View file @
763f8754
...
...
@@ -75,6 +75,13 @@ class PointerRouter {
event
=
event
.
transformed
(
transform
);
route
(
event
);
}
catch
(
exception
,
stack
)
{
InformationCollector
collector
;
assert
(()
{
collector
=
()
sync
*
{
yield
DiagnosticsProperty
<
PointerEvent
>(
'Event'
,
event
,
style:
DiagnosticsTreeStyle
.
errorProperty
);
};
return
true
;
}());
FlutterError
.
reportError
(
FlutterErrorDetailsForPointerRouter
(
exception:
exception
,
stack:
stack
,
...
...
@@ -83,9 +90,7 @@ class PointerRouter {
router:
this
,
route:
route
,
event:
event
,
informationCollector:
()
sync
*
{
yield
DiagnosticsProperty
<
PointerEvent
>(
'Event'
,
event
,
style:
DiagnosticsTreeStyle
.
errorProperty
);
},
informationCollector:
collector
));
}
}
...
...
packages/flutter/lib/src/gestures/pointer_signal_resolver.dart
View file @
763f8754
...
...
@@ -55,14 +55,19 @@ class PointerSignalResolver {
try
{
_firstRegisteredCallback
(
_currentEvent
);
}
catch
(
exception
,
stack
)
{
InformationCollector
collector
;
assert
(()
{
collector
=
()
sync
*
{
yield
DiagnosticsProperty
<
PointerSignalEvent
>(
'Event'
,
event
,
style:
DiagnosticsTreeStyle
.
errorProperty
);
};
return
true
;
}());
FlutterError
.
reportError
(
FlutterErrorDetails
(
exception:
exception
,
stack:
stack
,
library
:
'gesture library'
,
context:
ErrorDescription
(
'while resolving a PointerSignalEvent'
),
informationCollector:
()
sync
*
{
yield
DiagnosticsProperty
<
PointerSignalEvent
>(
'Event'
,
event
,
style:
DiagnosticsTreeStyle
.
errorProperty
);
},
informationCollector:
collector
));
}
_firstRegisteredCallback
=
null
;
...
...
packages/flutter/lib/src/gestures/recognizer.dart
View file @
763f8754
...
...
@@ -181,15 +181,20 @@ abstract class GestureRecognizer extends GestureArenaMember with DiagnosticableT
}());
result
=
callback
();
}
catch
(
exception
,
stack
)
{
InformationCollector
collector
;
assert
(()
{
collector
=
()
sync
*
{
yield
StringProperty
(
'Handler'
,
name
);
yield
DiagnosticsProperty
<
GestureRecognizer
>(
'Recognizer'
,
this
,
style:
DiagnosticsTreeStyle
.
errorProperty
);
};
return
true
;
}());
FlutterError
.
reportError
(
FlutterErrorDetails
(
exception:
exception
,
stack:
stack
,
library
:
'gesture'
,
context:
ErrorDescription
(
'while handling a gesture'
),
informationCollector:
()
sync
*
{
yield
StringProperty
(
'Handler'
,
name
);
yield
DiagnosticsProperty
<
GestureRecognizer
>(
'Recognizer'
,
this
,
style:
DiagnosticsTreeStyle
.
errorProperty
);
},
informationCollector:
collector
));
}
return
result
;
...
...
packages/flutter/lib/src/painting/image_provider.dart
View file @
763f8754
...
...
@@ -333,16 +333,21 @@ abstract class ImageProvider<T> {
await
null
;
// wait an event turn in case a listener has been added to the image stream.
final
_ErrorImageCompleter
imageCompleter
=
_ErrorImageCompleter
();
stream
.
setCompleter
(
imageCompleter
);
InformationCollector
collector
;
assert
(()
{
collector
=
()
sync
*
{
yield
DiagnosticsProperty
<
ImageProvider
>(
'Image provider'
,
this
);
yield
DiagnosticsProperty
<
ImageConfiguration
>(
'Image configuration'
,
configuration
);
yield
DiagnosticsProperty
<
T
>(
'Image key'
,
key
,
defaultValue:
null
);
};
return
true
;
}());
imageCompleter
.
setError
(
exception:
exception
,
stack:
stack
,
context:
ErrorDescription
(
'while resolving an image'
),
silent:
true
,
// could be a network error or whatnot
informationCollector:
()
sync
*
{
yield
DiagnosticsProperty
<
ImageProvider
>(
'Image provider'
,
this
);
yield
DiagnosticsProperty
<
ImageConfiguration
>(
'Image configuration'
,
configuration
);
yield
DiagnosticsProperty
<
T
>(
'Image key'
,
key
,
defaultValue:
null
);
},
informationCollector:
collector
);
},
);
...
...
@@ -384,13 +389,18 @@ abstract class ImageProvider<T> {
if
(
handleError
!=
null
)
{
handleError
(
exception
,
stack
);
}
else
{
FlutterError
.
onError
(
FlutterErrorDetails
(
context:
ErrorDescription
(
'while checking the cache location of an image'
),
informationCollector:
()
sync
*
{
InformationCollector
collector
;
assert
(()
{
collector
=
()
sync
*
{
yield
DiagnosticsProperty
<
ImageProvider
>(
'Image provider'
,
this
);
yield
DiagnosticsProperty
<
ImageConfiguration
>(
'Image configuration'
,
configuration
);
yield
DiagnosticsProperty
<
T
>(
'Image key'
,
key
,
defaultValue:
null
);
},
};
return
true
;
}());
FlutterError
.
onError
(
FlutterErrorDetails
(
context:
ErrorDescription
(
'while checking the cache location of an image'
),
informationCollector:
collector
,
exception:
exception
,
stack:
stack
,
));
...
...
@@ -626,13 +636,18 @@ abstract class AssetBundleImageProvider extends ImageProvider<AssetBundleImageKe
/// image using [loadAsync].
@override
ImageStreamCompleter
load
(
AssetBundleImageKey
key
,
DecoderCallback
decode
)
{
InformationCollector
collector
;
assert
(()
{
collector
=
()
sync
*
{
yield
DiagnosticsProperty
<
ImageProvider
>(
'Image provider'
,
this
);
yield
DiagnosticsProperty
<
AssetBundleImageKey
>(
'Image key'
,
key
);
};
return
true
;
}());
return
MultiFrameImageStreamCompleter
(
codec:
_loadAsync
(
key
,
decode
),
scale:
key
.
scale
,
informationCollector:
()
sync
*
{
yield
DiagnosticsProperty
<
ImageProvider
>(
'Image provider'
,
this
);
yield
DiagnosticsProperty
<
AssetBundleImageKey
>(
'Image key'
,
key
);
},
informationCollector:
collector
);
}
...
...
packages/flutter/lib/src/scheduler/binding.dart
View file @
763f8754
...
...
@@ -254,17 +254,22 @@ mixin SchedulerBinding on BindingBase, ServicesBinding {
callback
(
timings
);
}
}
catch
(
exception
,
stack
)
{
FlutterError
.
reportError
(
FlutterErrorDetails
(
exception:
exception
,
stack:
stack
,
context:
ErrorDescription
(
'while executing callbacks for FrameTiming'
),
informationCollector:
()
sync
*
{
InformationCollector
collector
;
assert
(()
{
collector
=
()
sync
*
{
yield
DiagnosticsProperty
<
TimingsCallback
>(
'The TimingsCallback that gets executed was'
,
callback
,
style:
DiagnosticsTreeStyle
.
errorProperty
,
);
},
};
return
true
;
}());
FlutterError
.
reportError
(
FlutterErrorDetails
(
exception:
exception
,
stack:
stack
,
context:
ErrorDescription
(
'while executing callbacks for FrameTiming'
),
informationCollector:
collector
));
}
}
...
...
packages/flutter/lib/src/widgets/focus_manager.dart
View file @
763f8754
...
...
@@ -1469,18 +1469,23 @@ class FocusManager with DiagnosticableTreeMixin, ChangeNotifier {
listener
(
_highlightMode
);
}
}
catch
(
exception
,
stack
)
{
FlutterError
.
reportError
(
FlutterErrorDetails
(
exception:
exception
,
stack:
stack
,
library
:
'widgets library'
,
context:
ErrorDescription
(
'while dispatching notifications for
$runtimeType
'
),
informationCollector:
()
sync
*
{
InformationCollector
collector
;
assert
(()
{
collector
=
()
sync
*
{
yield
DiagnosticsProperty
<
FocusManager
>(
'The
$runtimeType
sending notification was'
,
this
,
style:
DiagnosticsTreeStyle
.
errorProperty
,
);
},
};
return
true
;
}());
FlutterError
.
reportError
(
FlutterErrorDetails
(
exception:
exception
,
stack:
stack
,
library
:
'widgets library'
,
context:
ErrorDescription
(
'while dispatching notifications for
$runtimeType
'
),
informationCollector:
collector
,
));
}
}
...
...
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