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
8fa2a5e8
Unverified
Commit
8fa2a5e8
authored
Oct 14, 2021
by
Kenzie (Schmoll) Davisson
Committed by
GitHub
Oct 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add `profileRenderObjectPaints` and `profileRenderObjectLayouts` service extensions (#91822)
parent
ccc82614
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
81 additions
and
13 deletions
+81
-13
binding.dart
packages/flutter/lib/src/rendering/binding.dart
+16
-2
debug.dart
packages/flutter/lib/src/rendering/debug.dart
+2
-3
object.dart
packages/flutter/lib/src/rendering/object.dart
+4
-7
service_extensions_test.dart
...ages/flutter/test/foundation/service_extensions_test.dart
+59
-1
No files found.
packages/flutter/lib/src/rendering/binding.dart
View file @
8fa2a5e8
...
...
@@ -153,7 +153,6 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
};
},
);
registerServiceExtension
(
name:
'debugDumpSemanticsTreeInTraversalOrder'
,
callback:
(
Map
<
String
,
String
>
parameters
)
async
{
...
...
@@ -164,7 +163,6 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
};
},
);
registerServiceExtension
(
name:
'debugDumpSemanticsTreeInInverseHitTestOrder'
,
callback:
(
Map
<
String
,
String
>
parameters
)
async
{
...
...
@@ -175,6 +173,22 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
};
},
);
registerBoolServiceExtension
(
name:
'profileRenderObjectPaints'
,
getter:
()
async
=>
debugProfilePaintsEnabled
,
setter:
(
bool
value
)
async
{
if
(
debugProfilePaintsEnabled
!=
value
)
debugProfilePaintsEnabled
=
value
;
},
);
registerBoolServiceExtension
(
name:
'profileRenderObjectLayouts'
,
getter:
()
async
=>
debugProfileLayoutsEnabled
,
setter:
(
bool
value
)
async
{
if
(
debugProfileLayoutsEnabled
!=
value
)
debugProfileLayoutsEnabled
=
value
;
},
);
}
}
...
...
packages/flutter/lib/src/rendering/debug.dart
View file @
8fa2a5e8
...
...
@@ -111,9 +111,8 @@ bool debugProfileLayoutsEnabled = false;
/// Adds [dart:developer.Timeline] events for every [RenderObject] painted.
///
/// This is only enabled in debug builds. The timing information this exposes is
/// not representative of actual paints. However, it can expose unexpected
/// painting in the timeline.
/// The timing information this flag exposes is not representative of actual
/// paints. However, it can expose unexpected painting in the timeline.
///
/// For details on how to use [dart:developer.Timeline] events in the Dart
/// Observatory to optimize your app, see:
...
...
packages/flutter/lib/src/rendering/object.dart
View file @
8fa2a5e8
...
...
@@ -175,9 +175,9 @@ class PaintingContext extends ClipContext {
/// into the layer subtree associated with this painting context. Otherwise,
/// the child will be painted into the current PictureLayer for this context.
void
paintChild
(
RenderObject
child
,
Offset
offset
)
{
assert
(()
{
if
(
debugProfilePaintsEnabled
)
if
(!
kReleaseMode
&&
debugProfilePaintsEnabled
)
Timeline
.
startSync
(
'
${child.runtimeType}
'
,
arguments:
timelineArgumentsIndicatingLandmarkEvent
);
assert
(()
{
debugOnProfilePaint
?.
call
(
child
);
return
true
;
}());
...
...
@@ -189,11 +189,8 @@ class PaintingContext extends ClipContext {
child
.
_paintWithContext
(
this
,
offset
);
}
assert
(()
{
if
(
debugProfilePaintsEnabled
)
if
(!
kReleaseMode
&&
debugProfilePaintsEnabled
)
Timeline
.
finishSync
();
return
true
;
}());
}
void
_compositeChild
(
RenderObject
child
,
Offset
offset
)
{
...
...
packages/flutter/test/foundation/service_extensions_test.dart
View file @
8fa2a5e8
...
...
@@ -173,7 +173,7 @@ void main() {
const
int
disabledExtensions
=
kIsWeb
?
2
:
0
;
// If you add a service extension... TEST IT! :-)
// ...then increment this number.
expect
(
binding
.
extensions
.
length
,
3
3
+
widgetInspectorExtensionCount
-
disabledExtensions
);
expect
(
binding
.
extensions
.
length
,
3
5
+
widgetInspectorExtensionCount
-
disabledExtensions
);
expect
(
console
,
isEmpty
);
debugPrint
=
debugPrintThrottled
;
...
...
@@ -442,6 +442,64 @@ void main() {
expect
(
binding
.
frameScheduled
,
isFalse
);
});
test
(
'Service extensions - profileRenderObjectPaints'
,
()
async
{
Map
<
String
,
dynamic
>
result
;
expect
(
binding
.
frameScheduled
,
isFalse
);
expect
(
debugProfileBuildsEnabled
,
false
);
result
=
await
binding
.
testExtension
(
'profileRenderObjectPaints'
,
<
String
,
String
>{});
expect
(
result
,
<
String
,
String
>{
'enabled'
:
'false'
});
expect
(
debugProfilePaintsEnabled
,
false
);
result
=
await
binding
.
testExtension
(
'profileRenderObjectPaints'
,
<
String
,
String
>{
'enabled'
:
'true'
});
expect
(
result
,
<
String
,
String
>{
'enabled'
:
'true'
});
expect
(
debugProfilePaintsEnabled
,
true
);
result
=
await
binding
.
testExtension
(
'profileRenderObjectPaints'
,
<
String
,
String
>{});
expect
(
result
,
<
String
,
String
>{
'enabled'
:
'true'
});
expect
(
debugProfilePaintsEnabled
,
true
);
result
=
await
binding
.
testExtension
(
'profileRenderObjectPaints'
,
<
String
,
String
>{
'enabled'
:
'false'
});
expect
(
result
,
<
String
,
String
>{
'enabled'
:
'false'
});
expect
(
debugProfilePaintsEnabled
,
false
);
result
=
await
binding
.
testExtension
(
'profileRenderObjectPaints'
,
<
String
,
String
>{});
expect
(
result
,
<
String
,
String
>{
'enabled'
:
'false'
});
expect
(
debugProfilePaintsEnabled
,
false
);
expect
(
binding
.
frameScheduled
,
isFalse
);
});
test
(
'Service extensions - profileRenderObjectLayouts'
,
()
async
{
Map
<
String
,
dynamic
>
result
;
expect
(
binding
.
frameScheduled
,
isFalse
);
expect
(
debugProfileLayoutsEnabled
,
false
);
result
=
await
binding
.
testExtension
(
'profileRenderObjectLayouts'
,
<
String
,
String
>{});
expect
(
result
,
<
String
,
String
>{
'enabled'
:
'false'
});
expect
(
debugProfileLayoutsEnabled
,
false
);
result
=
await
binding
.
testExtension
(
'profileRenderObjectLayouts'
,
<
String
,
String
>{
'enabled'
:
'true'
});
expect
(
result
,
<
String
,
String
>{
'enabled'
:
'true'
});
expect
(
debugProfileLayoutsEnabled
,
true
);
result
=
await
binding
.
testExtension
(
'profileRenderObjectLayouts'
,
<
String
,
String
>{});
expect
(
result
,
<
String
,
String
>{
'enabled'
:
'true'
});
expect
(
debugProfileLayoutsEnabled
,
true
);
result
=
await
binding
.
testExtension
(
'profileRenderObjectLayouts'
,
<
String
,
String
>{
'enabled'
:
'false'
});
expect
(
result
,
<
String
,
String
>{
'enabled'
:
'false'
});
expect
(
debugProfileLayoutsEnabled
,
false
);
result
=
await
binding
.
testExtension
(
'profileRenderObjectLayouts'
,
<
String
,
String
>{});
expect
(
result
,
<
String
,
String
>{
'enabled'
:
'false'
});
expect
(
debugProfileLayoutsEnabled
,
false
);
expect
(
binding
.
frameScheduled
,
isFalse
);
});
test
(
'Service extensions - evict'
,
()
async
{
Map
<
String
,
dynamic
>
result
;
bool
completed
;
...
...
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