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
db84df23
Commit
db84df23
authored
May 12, 2017
by
Ian Hickson
Committed by
GitHub
May 12, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some tools to dump other trees. (#9999)
parent
4773a8cd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
96 additions
and
14 deletions
+96
-14
binding.dart
packages/flutter/lib/src/rendering/binding.dart
+10
-0
service_extensions_test.dart
...ages/flutter/test/foundation/service_extensions_test.dart
+37
-1
resident_runner.dart
packages/flutter_tools/lib/src/resident_runner.dart
+41
-13
vmservice.dart
packages/flutter_tools/lib/src/vmservice.dart
+8
-0
No files found.
packages/flutter/lib/src/rendering/binding.dart
View file @
db84df23
...
@@ -68,6 +68,16 @@ abstract class RendererBinding extends BindingBase implements SchedulerBinding,
...
@@ -68,6 +68,16 @@ abstract class RendererBinding extends BindingBase implements SchedulerBinding,
callback:
()
{
debugDumpRenderTree
();
return
debugPrintDone
;
}
callback:
()
{
debugDumpRenderTree
();
return
debugPrintDone
;
}
);
);
registerSignalServiceExtension
(
name:
'debugDumpLayerTree'
,
callback:
()
{
debugDumpLayerTree
();
return
debugPrintDone
;
}
);
registerSignalServiceExtension
(
name:
'debugDumpSemanticsTree'
,
callback:
()
{
debugDumpSemanticsTree
();
return
debugPrintDone
;
}
);
assert
(()
{
assert
(()
{
// this service extension only works in checked mode
// this service extension only works in checked mode
registerBoolServiceExtension
(
registerBoolServiceExtension
(
...
...
packages/flutter/test/foundation/service_extensions_test.dart
View file @
db84df23
...
@@ -142,16 +142,52 @@ void main() {
...
@@ -142,16 +142,52 @@ void main() {
expect
(
result
,
<
String
,
String
>{});
expect
(
result
,
<
String
,
String
>{});
expect
(
console
,
<
Matcher
>[
expect
(
console
,
<
Matcher
>[
matches
(
matches
(
r'^'
r'RenderView#[0-9]+\n'
r'RenderView#[0-9]+\n'
r' debug mode enabled - [a-zA-Z]+\n'
r' debug mode enabled - [a-zA-Z]+\n'
r' window size: Size\(800\.0, 600\.0\) \(in physical pixels\)\n'
r' window size: Size\(800\.0, 600\.0\) \(in physical pixels\)\n'
r' device pixel ratio: 1\.0 \(physical pixels per logical pixel\)\n'
r' device pixel ratio: 1\.0 \(physical pixels per logical pixel\)\n'
r' configuration: Size\(800\.0, 600\.0\) at 1\.0x \(in logical pixels\)\n'
r' configuration: Size\(800\.0, 600\.0\) at 1\.0x \(in logical pixels\)\n'
r'$'
),
),
]);
]);
console
.
clear
();
console
.
clear
();
});
});
test
(
'Service extensions - debugDumpLayerTree'
,
()
async
{
Map
<
String
,
String
>
result
;
await
binding
.
doFrame
();
result
=
await
binding
.
testExtension
(
'debugDumpLayerTree'
,
<
String
,
String
>{});
expect
(
result
,
<
String
,
String
>{});
expect
(
console
,
<
Matcher
>[
matches
(
r'^'
r'TransformLayer#[0-9]+\n'
r' owner: RenderView#[0-9]+\n'
r' creator: RenderView\n'
r' offset: Offset\(0\.0, 0\.0\)\n'
r' transform:\n'
r' \[0] 1\.0,0\.0,0\.0,0\.0\n'
r' \[1] 0\.0,1\.0,0\.0,0\.0\n'
r' \[2] 0\.0,0\.0,1\.0,0\.0\n'
r' \[3] 0\.0,0\.0,0\.0,1\.0\n'
r'$'
),
]);
console
.
clear
();
});
test
(
'Service extensions - debugDumpSemanticsTree'
,
()
async
{
Map
<
String
,
String
>
result
;
await
binding
.
doFrame
();
result
=
await
binding
.
testExtension
(
'debugDumpSemanticsTree'
,
<
String
,
String
>{});
expect
(
result
,
<
String
,
String
>{});
expect
(
console
,
<
String
>[
'Semantics not collected.'
]);
console
.
clear
();
});
test
(
'Service extensions - debugPaint'
,
()
async
{
test
(
'Service extensions - debugPaint'
,
()
async
{
Map
<
String
,
String
>
result
;
Map
<
String
,
String
>
result
;
Future
<
Map
<
String
,
String
>>
pendingResult
;
Future
<
Map
<
String
,
String
>>
pendingResult
;
...
@@ -381,7 +417,7 @@ void main() {
...
@@ -381,7 +417,7 @@ void main() {
test
(
'Service extensions - posttest'
,
()
async
{
test
(
'Service extensions - posttest'
,
()
async
{
// If you add a service extension... TEST IT! :-)
// If you add a service extension... TEST IT! :-)
// ...then increment this number.
// ...then increment this number.
expect
(
binding
.
extensions
.
length
,
1
2
);
expect
(
binding
.
extensions
.
length
,
1
4
);
expect
(
console
,
isEmpty
);
expect
(
console
,
isEmpty
);
debugPrint
=
debugPrintThrottled
;
debugPrint
=
debugPrintThrottled
;
...
...
packages/flutter_tools/lib/src/resident_runner.dart
View file @
db84df23
...
@@ -147,12 +147,22 @@ class FlutterDevice {
...
@@ -147,12 +147,22 @@ class FlutterDevice {
await
view
.
uiIsolate
.
flutterDebugDumpRenderTree
();
await
view
.
uiIsolate
.
flutterDebugDumpRenderTree
();
}
}
Future
<
Null
>
debugDumpLayerTree
()
async
{
for
(
FlutterView
view
in
views
)
await
view
.
uiIsolate
.
flutterDebugDumpLayerTree
();
}
Future
<
Null
>
debugDumpSemanticsTree
()
async
{
for
(
FlutterView
view
in
views
)
await
view
.
uiIsolate
.
flutterDebugDumpSemanticsTree
();
}
Future
<
Null
>
toggleDebugPaintSizeEnabled
()
async
{
Future
<
Null
>
toggleDebugPaintSizeEnabled
()
async
{
for
(
FlutterView
view
in
views
)
for
(
FlutterView
view
in
views
)
await
view
.
uiIsolate
.
flutterToggleDebugPaintSizeEnabled
();
await
view
.
uiIsolate
.
flutterToggleDebugPaintSizeEnabled
();
}
}
Future
<
String
>
togglePlatform
({
String
from
})
async
{
Future
<
String
>
togglePlatform
({
String
from
})
async
{
String
to
;
String
to
;
switch
(
from
)
{
switch
(
from
)
{
case
'iOS'
:
case
'iOS'
:
...
@@ -163,9 +173,8 @@ class FlutterDevice {
...
@@ -163,9 +173,8 @@ class FlutterDevice {
to
=
'iOS'
;
to
=
'iOS'
;
break
;
break
;
}
}
for
(
FlutterView
view
in
views
)
{
for
(
FlutterView
view
in
views
)
await
view
.
uiIsolate
.
flutterPlatformOverride
(
to
);
await
view
.
uiIsolate
.
flutterPlatformOverride
(
to
);
}
return
to
;
return
to
;
}
}
...
@@ -415,6 +424,18 @@ abstract class ResidentRunner {
...
@@ -415,6 +424,18 @@ abstract class ResidentRunner {
await
device
.
debugDumpRenderTree
();
await
device
.
debugDumpRenderTree
();
}
}
Future
<
Null
>
_debugDumpLayerTree
()
async
{
await
refreshViews
();
for
(
FlutterDevice
device
in
flutterDevices
)
await
device
.
debugDumpLayerTree
();
}
Future
<
Null
>
_debugDumpSemanticsTree
()
async
{
await
refreshViews
();
for
(
FlutterDevice
device
in
flutterDevices
)
await
device
.
debugDumpSemanticsTree
();
}
Future
<
Null
>
_debugToggleDebugPaintSizeEnabled
()
async
{
Future
<
Null
>
_debugToggleDebugPaintSizeEnabled
()
async
{
await
refreshViews
();
await
refreshViews
();
for
(
FlutterDevice
device
in
flutterDevices
)
for
(
FlutterDevice
device
in
flutterDevices
)
...
@@ -505,9 +526,8 @@ abstract class ResidentRunner {
...
@@ -505,9 +526,8 @@ abstract class ResidentRunner {
}
}
Future
<
Null
>
connectToServiceProtocol
({
String
viewFilter
})
async
{
Future
<
Null
>
connectToServiceProtocol
({
String
viewFilter
})
async
{
if
(!
debuggingOptions
.
debuggingEnabled
)
{
if
(!
debuggingOptions
.
debuggingEnabled
)
return
new
Future
<
Null
>.
error
(
'Error the service protocol is not enabled.'
);
return
new
Future
<
Null
>.
error
(
'Error the service protocol is not enabled.'
);
}
bool
viewFound
=
false
;
bool
viewFound
=
false
;
for
(
FlutterDevice
device
in
flutterDevices
)
{
for
(
FlutterDevice
device
in
flutterDevices
)
{
...
@@ -564,12 +584,22 @@ abstract class ResidentRunner {
...
@@ -564,12 +584,22 @@ abstract class ResidentRunner {
await
_debugDumpRenderTree
();
await
_debugDumpRenderTree
();
return
true
;
return
true
;
}
}
}
else
if
(
character
==
'L'
)
{
if
(
supportsServiceProtocol
)
{
await
_debugDumpLayerTree
();
return
true
;
}
}
else
if
(
character
==
'S'
)
{
if
(
supportsServiceProtocol
)
{
await
_debugDumpSemanticsTree
();
return
true
;
}
}
else
if
(
lower
==
'p'
)
{
}
else
if
(
lower
==
'p'
)
{
if
(
supportsServiceProtocol
&&
isRunningDebug
)
{
if
(
supportsServiceProtocol
&&
isRunningDebug
)
{
await
_debugToggleDebugPaintSizeEnabled
();
await
_debugToggleDebugPaintSizeEnabled
();
return
true
;
return
true
;
}
}
}
else
if
(
low
er
==
's'
)
{
}
else
if
(
charact
er
==
's'
)
{
for
(
FlutterDevice
device
in
flutterDevices
)
{
for
(
FlutterDevice
device
in
flutterDevices
)
{
if
(
device
.
device
.
supportsScreenshot
)
if
(
device
.
device
.
supportsScreenshot
)
await
_screenshot
(
device
);
await
_screenshot
(
device
);
...
@@ -656,16 +686,13 @@ abstract class ResidentRunner {
...
@@ -656,16 +686,13 @@ abstract class ResidentRunner {
final
DependencyChecker
dependencyChecker
=
final
DependencyChecker
dependencyChecker
=
new
DependencyChecker
(
dartDependencySetBuilder
,
assetBundle
);
new
DependencyChecker
(
dartDependencySetBuilder
,
assetBundle
);
final
String
path
=
device
.
package
.
packagePath
;
final
String
path
=
device
.
package
.
packagePath
;
if
(
path
==
null
)
{
if
(
path
==
null
)
return
true
;
return
true
;
}
final
FileStat
stat
=
fs
.
file
(
path
).
statSync
();
final
FileStat
stat
=
fs
.
file
(
path
).
statSync
();
if
(
stat
.
type
!=
FileSystemEntityType
.
FILE
)
{
if
(
stat
.
type
!=
FileSystemEntityType
.
FILE
)
return
true
;
return
true
;
}
if
(!
fs
.
file
(
path
).
existsSync
())
if
(!
fs
.
file
(
path
).
existsSync
())
{
return
true
;
return
true
;
}
final
DateTime
lastBuildTime
=
stat
.
modified
;
final
DateTime
lastBuildTime
=
stat
.
modified
;
return
dependencyChecker
.
check
(
lastBuildTime
);
return
dependencyChecker
.
check
(
lastBuildTime
);
}
}
...
@@ -683,8 +710,9 @@ abstract class ResidentRunner {
...
@@ -683,8 +710,9 @@ abstract class ResidentRunner {
void
printHelpDetails
()
{
void
printHelpDetails
()
{
if
(
supportsServiceProtocol
)
{
if
(
supportsServiceProtocol
)
{
printStatus
(
'
To dump the widget hierarchy of the app (debugDumpApp), press
"w".'
);
printStatus
(
'
You can dump the widget hierarchy of the app (debugDumpApp) by pressing
"w".'
);
printStatus
(
'To dump the rendering tree of the app (debugDumpRenderTree), press "t".'
);
printStatus
(
'To dump the rendering tree of the app (debugDumpRenderTree), press "t".'
);
printStatus
(
'For layers (debugDumpLayerTree), use "L"; accessibility (debugDumpSemantics), "S".'
);
if
(
isRunningDebug
)
{
if
(
isRunningDebug
)
{
printStatus
(
'To toggle the display of construction lines (debugPaintSizeEnabled), press "p".'
);
printStatus
(
'To toggle the display of construction lines (debugPaintSizeEnabled), press "p".'
);
printStatus
(
'To simulate different operating systems, (defaultTargetPlatform), press "o".'
);
printStatus
(
'To simulate different operating systems, (defaultTargetPlatform), press "o".'
);
...
...
packages/flutter_tools/lib/src/vmservice.dart
View file @
db84df23
...
@@ -998,6 +998,14 @@ class Isolate extends ServiceObjectOwner {
...
@@ -998,6 +998,14 @@ class Isolate extends ServiceObjectOwner {
return
invokeFlutterExtensionRpcRaw
(
'ext.flutter.debugDumpRenderTree'
,
timeout:
kLongRequestTimeout
);
return
invokeFlutterExtensionRpcRaw
(
'ext.flutter.debugDumpRenderTree'
,
timeout:
kLongRequestTimeout
);
}
}
Future
<
Map
<
String
,
dynamic
>>
flutterDebugDumpLayerTree
()
{
return
invokeFlutterExtensionRpcRaw
(
'ext.flutter.debugDumpLayerTree'
,
timeout:
kLongRequestTimeout
);
}
Future
<
Map
<
String
,
dynamic
>>
flutterDebugDumpSemanticsTree
()
{
return
invokeFlutterExtensionRpcRaw
(
'ext.flutter.debugDumpSemanticsTree'
,
timeout:
kLongRequestTimeout
);
}
Future
<
Map
<
String
,
dynamic
>>
flutterToggleDebugPaintSizeEnabled
()
async
{
Future
<
Map
<
String
,
dynamic
>>
flutterToggleDebugPaintSizeEnabled
()
async
{
Map
<
String
,
dynamic
>
state
=
await
invokeFlutterExtensionRpcRaw
(
'ext.flutter.debugPaint'
);
Map
<
String
,
dynamic
>
state
=
await
invokeFlutterExtensionRpcRaw
(
'ext.flutter.debugPaint'
);
if
(
state
!=
null
&&
state
.
containsKey
(
'enabled'
)
&&
state
[
'enabled'
]
is
String
)
{
if
(
state
!=
null
&&
state
.
containsKey
(
'enabled'
)
&&
state
[
'enabled'
]
is
String
)
{
...
...
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