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
85df73d0
Unverified
Commit
85df73d0
authored
Jun 04, 2021
by
Jonah Williams
Committed by
GitHub
Jun 04, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter] ensure vmservice binding is registered in profile mode (#83913)
parent
f41fa9dd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
138 additions
and
21 deletions
+138
-21
devtools_profile_start_test.dart
dev/devicelab/bin/tasks/devtools_profile_start_test.dart
+15
-0
perf_tests.dart
dev/devicelab/lib/tasks/perf_tests.dart
+102
-0
binding.dart
packages/flutter/lib/src/foundation/binding.dart
+21
-21
No files found.
dev/devicelab/bin/tasks/devtools_profile_start_test.dart
0 → 100644
View file @
85df73d0
// 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.
import
'package:flutter_devicelab/framework/adb.dart'
;
import
'package:flutter_devicelab/framework/framework.dart'
;
import
'package:flutter_devicelab/framework/utils.dart'
;
import
'package:flutter_devicelab/tasks/perf_tests.dart'
;
Future
<
void
>
main
()
async
{
deviceOperatingSystem
=
DeviceOperatingSystem
.
android
;
await
task
(
DevtoolsStartupTest
(
'
${flutterDirectory.path}
/examples/hello_world'
,
).
run
);
}
dev/devicelab/lib/tasks/perf_tests.dart
View file @
85df73d0
...
...
@@ -15,6 +15,8 @@ import 'package:flutter_devicelab/framework/utils.dart';
import
'package:meta/meta.dart'
;
import
'package:path/path.dart'
as
path
;
import
'../common.dart'
;
/// Must match flutter_driver/lib/src/common.dart.
///
/// Redefined here to avoid taking a dependency on flutter_driver.
...
...
@@ -615,6 +617,106 @@ class StartupTest {
}
}
/// A one-off test to verify that devtools starts in profile mode.
class
DevtoolsStartupTest
{
const
DevtoolsStartupTest
(
this
.
testDirectory
);
final
String
testDirectory
;
Future
<
TaskResult
>
run
()
async
{
return
inDirectory
<
TaskResult
>(
testDirectory
,
()
async
{
final
Device
device
=
await
devices
.
workingDevice
;
section
(
'Building application'
);
String
applicationBinaryPath
;
switch
(
deviceOperatingSystem
)
{
case
DeviceOperatingSystem
.
android
:
await
flutter
(
'build'
,
options:
<
String
>[
'apk'
,
'-v'
,
'--profile'
,
'--target-platform=android-arm,android-arm64'
,
]);
applicationBinaryPath
=
'
$testDirectory
/build/app/outputs/flutter-apk/app-profile.apk'
;
break
;
case
DeviceOperatingSystem
.
androidArm
:
await
flutter
(
'build'
,
options:
<
String
>[
'apk'
,
'-v'
,
'--profile'
,
'--target-platform=android-arm'
,
]);
applicationBinaryPath
=
'
$testDirectory
/build/app/outputs/flutter-apk/app-profile.apk'
;
break
;
case
DeviceOperatingSystem
.
androidArm64
:
await
flutter
(
'build'
,
options:
<
String
>[
'apk'
,
'-v'
,
'--profile'
,
'--target-platform=android-arm64'
,
]);
applicationBinaryPath
=
'
$testDirectory
/build/app/outputs/flutter-apk/app-profile.apk'
;
break
;
case
DeviceOperatingSystem
.
ios
:
await
flutter
(
'build'
,
options:
<
String
>[
'ios'
,
'-v'
,
'--profile'
,
]);
applicationBinaryPath
=
_findIosAppInBuildDirectory
(
'
$testDirectory
/build/ios/iphoneos'
);
break
;
case
DeviceOperatingSystem
.
fuchsia
:
case
DeviceOperatingSystem
.
fake
:
break
;
}
final
Process
process
=
await
startProcess
(
path
.
join
(
flutterDirectory
.
path
,
'bin'
,
'flutter'
),
<
String
>[
'run'
,
'--no-android-gradle-daemon'
,
'--no-publish-port'
,
'--verbose'
,
'--profile'
,
'-d'
,
device
.
deviceId
,
if
(
applicationBinaryPath
!=
null
)
'--use-application-binary=
$applicationBinaryPath
'
,
]);
final
Completer
<
void
>
completer
=
Completer
<
void
>();
bool
sawLine
=
false
;
process
.
stdout
.
transform
(
utf8
.
decoder
)
.
transform
(
const
LineSplitter
())
.
listen
((
String
line
)
{
print
(
'[STDOUT]:
$line
'
);
// Wait for devtools output.
if
(
line
.
contains
(
'The Flutter DevTools debugger and profiler'
))
{
sawLine
=
true
;
completer
.
complete
();
}
});
bool
didExit
=
false
;
unawaited
(
process
.
exitCode
.
whenComplete
(()
{
didExit
=
true
;
}));
await
Future
.
any
(<
Future
<
void
>>[
completer
.
future
,
Future
<
void
>.
delayed
(
const
Duration
(
minutes:
5
)),
process
.
exitCode
]);
if
(!
didExit
)
{
process
.
stdin
.
writeln
(
'q'
);
await
process
.
exitCode
;
}
await
flutter
(
'install'
,
options:
<
String
>[
'--uninstall-only'
,
'-d'
,
device
.
deviceId
,
]);
if
(
sawLine
)
return
TaskResult
.
success
(
null
,
benchmarkScoreKeys:
<
String
>[]);
return
TaskResult
.
failure
(
'Did not see line "The Flutter DevTools debugger and profiler" in output'
);
});
}
}
/// Measures application runtime performance, specifically per-frame
/// performance.
class
PerfTest
{
...
...
packages/flutter/lib/src/foundation/binding.dart
View file @
85df73d0
...
...
@@ -169,10 +169,27 @@ abstract class BindingBase {
return
true
;
}());
if
(!
kReleaseMode
&&
!
kIsWeb
)
{
registerSignalServiceExtension
(
name:
'exit'
,
callback:
_exitApplication
,
if
(!
kReleaseMode
)
{
if
(!
kIsWeb
)
{
registerSignalServiceExtension
(
name:
'exit'
,
callback:
_exitApplication
,
);
}
// These service extensions are used in profile mode applications.
registerStringServiceExtension
(
name:
'connectedVmServiceUri'
,
getter:
()
async
=>
connectedVmServiceUri
??
''
,
setter:
(
String
uri
)
async
{
connectedVmServiceUri
=
uri
;
},
);
registerStringServiceExtension
(
name:
'activeDevToolsServerAddress'
,
getter:
()
async
=>
activeDevToolsServerAddress
??
''
,
setter:
(
String
serverAddress
)
async
{
activeDevToolsServerAddress
=
serverAddress
;
},
);
}
...
...
@@ -245,23 +262,6 @@ abstract class BindingBase {
};
},
);
registerStringServiceExtension
(
name:
'connectedVmServiceUri'
,
getter:
()
async
=>
connectedVmServiceUri
??
''
,
setter:
(
String
uri
)
async
{
connectedVmServiceUri
=
uri
;
},
);
registerStringServiceExtension
(
name:
'activeDevToolsServerAddress'
,
getter:
()
async
=>
activeDevToolsServerAddress
??
''
,
setter:
(
String
serverAddress
)
async
{
activeDevToolsServerAddress
=
serverAddress
;
},
);
return
true
;
}());
assert
(()
{
...
...
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