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
820fb0bf
Unverified
Commit
820fb0bf
authored
Feb 16, 2021
by
Jonah Williams
Committed by
GitHub
Feb 16, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] stop using throttled print for service extensions (#76022)
parent
f8cd24de
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
101 additions
and
85 deletions
+101
-85
binding.dart
packages/flutter/lib/src/rendering/binding.dart
+27
-17
proxy_box.dart
packages/flutter/lib/src/rendering/proxy_box.dart
+0
-1
binding.dart
packages/flutter/lib/src/widgets/binding.dart
+19
-14
service_extensions_test.dart
...ages/flutter/test/foundation/service_extensions_test.dart
+24
-33
resident_runner.dart
packages/flutter_tools/lib/src/resident_runner.dart
+10
-5
vmservice.dart
packages/flutter_tools/lib/src/vmservice.dart
+21
-15
No files found.
packages/flutter/lib/src/rendering/binding.dart
View file @
820fb0bf
...
...
@@ -111,11 +111,13 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
return
_forceRepaint
();
},
);
registerS
ignalS
erviceExtension
(
registerServiceExtension
(
name:
'debugDumpLayerTree'
,
callback:
()
{
debugDumpLayerTree
();
return
debugPrintDone
;
callback:
(
Map
<
String
,
String
>
parameters
)
async
{
final
String
data
=
RendererBinding
.
instance
?.
renderView
.
debugLayer
?.
toStringDeep
()
??
'Layer tree unavailable.'
;
return
<
String
,
Object
>{
'data'
:
data
,
};
},
);
return
true
;
...
...
@@ -123,27 +125,35 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
if
(!
kReleaseMode
)
{
// these service extensions work in debug or profile mode
registerS
ignalS
erviceExtension
(
registerServiceExtension
(
name:
'debugDumpRenderTree'
,
callback:
()
{
debugDumpRenderTree
();
return
debugPrintDone
;
},
callback:
(
Map
<
String
,
String
>
parameters
)
async
{
final
String
data
=
RendererBinding
.
instance
?.
renderView
.
toStringDeep
()
??
'Render tree unavailable.'
;
return
<
String
,
Object
>{
'data'
:
data
,
};
}
);
registerS
ignalS
erviceExtension
(
registerServiceExtension
(
name:
'debugDumpSemanticsTreeInTraversalOrder'
,
callback:
()
{
debugDumpSemanticsTree
(
DebugSemanticsDumpOrder
.
traversalOrder
);
return
debugPrintDone
;
callback:
(
Map
<
String
,
String
>
parameters
)
async
{
final
String
data
=
RendererBinding
.
instance
?.
renderView
.
debugSemantics
?.
toStringDeep
(
childOrder:
DebugSemanticsDumpOrder
.
traversalOrder
)
??
'Semantics not collected.'
;
return
<
String
,
Object
>{
'data'
:
data
,
};
},
);
registerS
ignalS
erviceExtension
(
registerServiceExtension
(
name:
'debugDumpSemanticsTreeInInverseHitTestOrder'
,
callback:
()
{
debugDumpSemanticsTree
(
DebugSemanticsDumpOrder
.
inverseHitTest
);
return
debugPrintDone
;
callback:
(
Map
<
String
,
String
>
parameters
)
async
{
final
String
data
=
RendererBinding
.
instance
?.
renderView
.
debugSemantics
?.
toStringDeep
(
childOrder:
DebugSemanticsDumpOrder
.
inverseHitTest
)
??
'Semantics not collected.'
;
return
<
String
,
Object
>{
'data'
:
data
,
};
},
);
}
...
...
packages/flutter/lib/src/rendering/proxy_box.dart
View file @
820fb0bf
...
...
@@ -11,7 +11,6 @@ import 'package:flutter/semantics.dart';
import
'package:vector_math/vector_math_64.dart'
;
import
'binding.dart'
;
import
'box.dart'
;
import
'layer.dart'
;
import
'layout_helper.dart'
;
...
...
packages/flutter/lib/src/widgets/binding.dart
View file @
820fb0bf
...
...
@@ -387,11 +387,13 @@ mixin WidgetsBinding on BindingBase, ServicesBinding, SchedulerBinding, GestureB
super
.
initServiceExtensions
();
if
(!
kReleaseMode
)
{
registerS
ignalS
erviceExtension
(
registerServiceExtension
(
name:
'debugDumpApp'
,
callback:
()
{
debugDumpApp
();
return
debugPrintDone
;
callback:
(
Map
<
String
,
String
>
parameters
)
async
{
final
String
data
=
_debugDumpAppString
();
return
<
String
,
Object
>{
'data'
:
data
,
};
},
);
...
...
@@ -1027,20 +1029,23 @@ void runApp(Widget app) {
..
scheduleWarmUpFrame
();
}
/// Print a string representation of the currently running app.
void
debugDumpApp
(
)
{
String
_debugDumpAppString
(
)
{
assert
(
WidgetsBinding
.
instance
!=
null
);
String
mode
=
'RELEASE MODE'
;
assert
(()
{
mode
=
'CHECKED MODE'
;
return
true
;
}());
debugPrint
(
'
${WidgetsBinding.instance.runtimeType}
-
$mode
'
);
const
String
mode
=
kDebugMode
?
'DEBUG MODE'
:
'PROFILE MODE'
;
final
StringBuffer
buffer
=
StringBuffer
();
buffer
.
writeln
(
'
${WidgetsBinding.instance.runtimeType}
-
$mode
'
);
if
(
WidgetsBinding
.
instance
!.
renderViewElement
!=
null
)
{
debugPrint
(
WidgetsBinding
.
instance
!.
renderViewElement
!.
toStringDeep
());
buffer
.
writeln
(
WidgetsBinding
.
instance
!.
renderViewElement
!.
toStringDeep
());
}
else
{
debugPrint
(
'<no tree currently mounted>'
);
buffer
.
writeln
(
'<no tree currently mounted>'
);
}
return
buffer
.
toString
();
}
/// Print a string representation of the currently running app.
void
debugDumpApp
(
)
{
final
String
value
=
_debugDumpAppString
();
debugPrint
(
value
);
}
/// A bridge from a [RenderObject] to an [Element] tree.
...
...
packages/flutter/test/foundation/service_extensions_test.dart
View file @
820fb0bf
...
...
@@ -226,22 +226,19 @@ void main() {
});
test
(
'Service extensions - debugDumpApp'
,
()
async
{
Map
<
String
,
dynamic
>
result
;
final
Map
<
String
,
dynamic
>
result
=
await
binding
.
testExtension
(
'debugDumpApp'
,
<
String
,
String
>{})
;
result
=
await
binding
.
testExtension
(
'debugDumpApp'
,
<
String
,
String
>{});
expect
(
result
,
<
String
,
String
>{});
expect
(
console
,
<
String
>[
'TestServiceExtensionsBinding - CHECKED MODE'
,
'<no tree currently mounted>'
]);
console
.
clear
();
expect
(
result
,
<
String
,
dynamic
>{
'data'
:
matches
(
'TestServiceExtensionsBinding - DEBUG MODE
\n
<no tree currently mounted>'
),
});
});
test
(
'Service extensions - debugDumpRenderTree'
,
()
async
{
Map
<
String
,
dynamic
>
result
;
await
binding
.
doFrame
();
result
=
await
binding
.
testExtension
(
'debugDumpRenderTree'
,
<
String
,
String
>{});
expect
(
result
,
<
String
,
String
>{});
expect
(
console
,
<
Matcher
>[
matches
(
final
Map
<
String
,
dynamic
>
result
=
await
binding
.
testExtension
(
'debugDumpRenderTree'
,
<
String
,
String
>{});
expect
(
result
,
<
String
,
dynamic
>{
'data'
:
matches
(
r'^'
r'RenderView#[0-9a-f]{5}\n'
r' debug mode enabled - [a-zA-Z]+\n'
...
...
@@ -250,18 +247,15 @@ void main() {
r' configuration: Size\(800\.0, 600\.0\) at 3\.0x \(in logical pixels\)\n'
r'$'
),
]);
console
.
clear
();
});
});
test
(
'Service extensions - debugDumpLayerTree'
,
()
async
{
Map
<
String
,
dynamic
>
result
;
await
binding
.
doFrame
();
result
=
await
binding
.
testExtension
(
'debugDumpLayerTree'
,
<
String
,
String
>{});
expect
(
result
,
<
String
,
String
>{});
expect
(
console
,
<
Matcher
>[
matches
(
final
Map
<
String
,
dynamic
>
result
=
await
binding
.
testExtension
(
'debugDumpLayerTree'
,
<
String
,
String
>{});
expect
(
result
,
<
String
,
dynamic
>{
'data'
:
matches
(
r'^'
r'TransformLayer#[0-9a-f]{5}\n'
r' owner: RenderView#[0-9a-f]{5}\n'
...
...
@@ -275,28 +269,25 @@ void main() {
r' \[3] 0\.0,0\.0,0\.0,1\.0\n'
r'$'
),
]);
console
.
clear
();
});
});
test
(
'Service extensions - debugDumpSemanticsTreeInTraversalOrder'
,
()
async
{
Map
<
String
,
dynamic
>
result
;
await
binding
.
doFrame
();
result
=
await
binding
.
testExtension
(
'debugDumpSemanticsTreeInTraversalOrder'
,
<
String
,
String
>{});
expect
(
result
,
<
String
,
String
>{});
expect
(
console
,
<
String
>[
'Semantics not collected.'
]);
console
.
clear
();
final
Map
<
String
,
dynamic
>
result
=
await
binding
.
testExtension
(
'debugDumpSemanticsTreeInTraversalOrder'
,
<
String
,
String
>{});
expect
(
result
,
<
String
,
String
>{
'data'
:
'Semantics not collected.'
});
});
test
(
'Service extensions - debugDumpSemanticsTreeInInverseHitTestOrder'
,
()
async
{
Map
<
String
,
dynamic
>
result
;
await
binding
.
doFrame
();
result
=
await
binding
.
testExtension
(
'debugDumpSemanticsTreeInInverseHitTestOrder'
,
<
String
,
String
>{});
expect
(
result
,
<
String
,
String
>{});
expect
(
console
,
<
String
>[
'Semantics not collected.'
]);
console
.
clear
();
final
Map
<
String
,
dynamic
>
result
=
await
binding
.
testExtension
(
'debugDumpSemanticsTreeInInverseHitTestOrder'
,
<
String
,
String
>{});
expect
(
result
,
<
String
,
String
>{
'data'
:
'Semantics not collected.'
});
});
test
(
'Service extensions - debugPaint'
,
()
async
{
...
...
packages/flutter_tools/lib/src/resident_runner.dart
View file @
820fb0bf
...
...
@@ -400,45 +400,50 @@ class FlutterDevice {
Future
<
void
>
debugDumpApp
()
async
{
final
List
<
FlutterView
>
views
=
await
vmService
.
getFlutterViews
();
for
(
final
FlutterView
view
in
views
)
{
await
vmService
.
flutterDebugDumpApp
(
final
String
data
=
await
vmService
.
flutterDebugDumpApp
(
isolateId:
view
.
uiIsolate
.
id
,
);
globals
.
printStatus
(
data
);
}
}
Future
<
void
>
debugDumpRenderTree
()
async
{
final
List
<
FlutterView
>
views
=
await
vmService
.
getFlutterViews
();
for
(
final
FlutterView
view
in
views
)
{
await
vmService
.
flutterDebugDumpRenderTree
(
final
String
data
=
await
vmService
.
flutterDebugDumpRenderTree
(
isolateId:
view
.
uiIsolate
.
id
,
);
globals
.
printStatus
(
data
);
}
}
Future
<
void
>
debugDumpLayerTree
()
async
{
final
List
<
FlutterView
>
views
=
await
vmService
.
getFlutterViews
();
for
(
final
FlutterView
view
in
views
)
{
await
vmService
.
flutterDebugDumpLayerTree
(
final
String
data
=
await
vmService
.
flutterDebugDumpLayerTree
(
isolateId:
view
.
uiIsolate
.
id
,
);
globals
.
printStatus
(
data
);
}
}
Future
<
void
>
debugDumpSemanticsTreeInTraversalOrder
()
async
{
final
List
<
FlutterView
>
views
=
await
vmService
.
getFlutterViews
();
for
(
final
FlutterView
view
in
views
)
{
await
vmService
.
flutterDebugDumpSemanticsTreeInTraversalOrder
(
final
String
data
=
await
vmService
.
flutterDebugDumpSemanticsTreeInTraversalOrder
(
isolateId:
view
.
uiIsolate
.
id
,
);
globals
.
printStatus
(
data
);
}
}
Future
<
void
>
debugDumpSemanticsTreeInInverseHitTestOrder
()
async
{
final
List
<
FlutterView
>
views
=
await
vmService
.
getFlutterViews
();
for
(
final
FlutterView
view
in
views
)
{
await
vmService
.
flutterDebugDumpSemanticsTreeInInverseHitTestOrder
(
final
String
data
=
await
vmService
.
flutterDebugDumpSemanticsTreeInInverseHitTestOrder
(
isolateId:
view
.
uiIsolate
.
id
,
);
globals
.
printStatus
(
data
);
}
}
...
...
packages/flutter_tools/lib/src/vmservice.dart
View file @
820fb0bf
...
...
@@ -515,49 +515,55 @@ extension FlutterVmService on vm_service.VmService {
await
onRunnable
;
}
Future
<
Map
<
String
,
dynamic
>
>
flutterDebugDumpApp
({
Future
<
String
>
flutterDebugDumpApp
({
@required
String
isolateId
,
})
{
return
invokeFlutterExtensionRpcRaw
(
})
async
{
final
Map
<
String
,
Object
>
response
=
await
invokeFlutterExtensionRpcRaw
(
'ext.flutter.debugDumpApp'
,
isolateId:
isolateId
,
);
return
response
[
'data'
]?.
toString
();
}
Future
<
Map
<
String
,
dynamic
>
>
flutterDebugDumpRenderTree
({
Future
<
String
>
flutterDebugDumpRenderTree
({
@required
String
isolateId
,
})
{
return
invokeFlutterExtensionRpcRaw
(
})
async
{
final
Map
<
String
,
Object
>
response
=
await
invokeFlutterExtensionRpcRaw
(
'ext.flutter.debugDumpRenderTree'
,
isolateId:
isolateId
,
args:
<
String
,
Object
>{}
);
return
response
[
'data'
]?.
toString
();
}
Future
<
Map
<
String
,
dynamic
>
>
flutterDebugDumpLayerTree
({
Future
<
String
>
flutterDebugDumpLayerTree
({
@required
String
isolateId
,
})
{
return
invokeFlutterExtensionRpcRaw
(
})
async
{
final
Map
<
String
,
Object
>
response
=
await
invokeFlutterExtensionRpcRaw
(
'ext.flutter.debugDumpLayerTree'
,
isolateId:
isolateId
,
);
return
response
[
'data'
]?.
toString
();
}
Future
<
Map
<
String
,
dynamic
>
>
flutterDebugDumpSemanticsTreeInTraversalOrder
({
Future
<
String
>
flutterDebugDumpSemanticsTreeInTraversalOrder
({
@required
String
isolateId
,
})
{
return
invokeFlutterExtensionRpcRaw
(
})
async
{
final
Map
<
String
,
Object
>
response
=
await
invokeFlutterExtensionRpcRaw
(
'ext.flutter.debugDumpSemanticsTreeInTraversalOrder'
,
isolateId:
isolateId
,
);
return
response
[
'data'
]?.
toString
();
}
Future
<
Map
<
String
,
dynamic
>
>
flutterDebugDumpSemanticsTreeInInverseHitTestOrder
({
Future
<
String
>
flutterDebugDumpSemanticsTreeInInverseHitTestOrder
({
@required
String
isolateId
,
})
{
return
invokeFlutterExtensionRpcRaw
(
})
async
{
final
Map
<
String
,
Object
>
response
=
await
invokeFlutterExtensionRpcRaw
(
'ext.flutter.debugDumpSemanticsTreeInInverseHitTestOrder'
,
isolateId:
isolateId
,
);
return
response
[
'data'
]?.
toString
();
}
Future
<
Map
<
String
,
dynamic
>>
_flutterToggle
(
String
name
,
{
...
...
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