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
cc9b614e
Unverified
Commit
cc9b614e
authored
Sep 03, 2019
by
Jonah Williams
Committed by
GitHub
Sep 03, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor cleanup and prevent multiple exit (#39751)
parent
d33cf115
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
17 deletions
+40
-17
resident_web_runner.dart
...utter_tools/lib/src/build_runner/resident_web_runner.dart
+5
-0
chrome.dart
packages/flutter_tools/lib/src/web/chrome.dart
+16
-17
resident_web_runner_test.dart
...er_tools/test/general.shard/resident_web_runner_test.dart
+19
-0
No files found.
packages/flutter_tools/lib/src/build_runner/resident_web_runner.dart
View file @
cc9b614e
...
@@ -73,6 +73,7 @@ class ResidentWebRunner extends ResidentRunner {
...
@@ -73,6 +73,7 @@ class ResidentWebRunner extends ResidentRunner {
WebFs
_webFs
;
WebFs
_webFs
;
DebugConnection
_debugConnection
;
DebugConnection
_debugConnection
;
StreamSubscription
<
vmservice
.
Event
>
_stdOutSub
;
StreamSubscription
<
vmservice
.
Event
>
_stdOutSub
;
bool
_exited
=
false
;
vmservice
.
VmService
get
_vmService
=>
_debugConnection
.
vmService
;
vmservice
.
VmService
get
_vmService
=>
_debugConnection
.
vmService
;
...
@@ -101,9 +102,13 @@ class ResidentWebRunner extends ResidentRunner {
...
@@ -101,9 +102,13 @@ class ResidentWebRunner extends ResidentRunner {
}
}
Future
<
void
>
_cleanup
()
async
{
Future
<
void
>
_cleanup
()
async
{
if
(
_exited
)
{
return
;
}
await
_debugConnection
?.
close
();
await
_debugConnection
?.
close
();
await
_stdOutSub
?.
cancel
();
await
_stdOutSub
?.
cancel
();
await
_webFs
?.
stop
();
await
_webFs
?.
stop
();
_exited
=
true
;
}
}
@override
@override
...
...
packages/flutter_tools/lib/src/web/chrome.dart
View file @
cc9b614e
...
@@ -155,11 +155,11 @@ class ChromeLauncher {
...
@@ -155,11 +155,11 @@ class ChromeLauncher {
static
Future
<
Chrome
>
get
connectedInstance
=>
_currentCompleter
.
future
;
static
Future
<
Chrome
>
get
connectedInstance
=>
_currentCompleter
.
future
;
/// Returns the full URL of the Chrome remote debugger for the main page.
/// Returns the full URL of the Chrome remote debugger for the main page.
///
///
/// This takes the [base] remote debugger URL (which points to a browser-wide
/// This takes the [base] remote debugger URL (which points to a browser-wide
/// page) and uses its JSON API to find the resolved URL for debugging the host
/// page) and uses its JSON API to find the resolved URL for debugging the host
/// page.
/// page.
Future
<
Uri
>
_getRemoteDebuggerUrl
(
Uri
base
)
async
{
Future
<
Uri
>
_getRemoteDebuggerUrl
(
Uri
base
)
async
{
try
{
try
{
final
HttpClient
client
=
HttpClient
();
final
HttpClient
client
=
HttpClient
();
final
HttpClientRequest
request
=
await
client
.
getUrl
(
base
.
resolve
(
'/json/list'
));
final
HttpClientRequest
request
=
await
client
.
getUrl
(
base
.
resolve
(
'/json/list'
));
...
@@ -171,8 +171,7 @@ Future<Uri> _getRemoteDebuggerUrl(Uri base) async {
...
@@ -171,8 +171,7 @@ Future<Uri> _getRemoteDebuggerUrl(Uri base) async {
// the raw URL rather than crashing.
// the raw URL rather than crashing.
return
base
;
return
base
;
}
}
}
}
}
}
/// A class for managing an instance of Chrome.
/// A class for managing an instance of Chrome.
...
...
packages/flutter_tools/test/general.shard/resident_web_runner_test.dart
View file @
cc9b614e
...
@@ -338,6 +338,25 @@ void main() {
...
@@ -338,6 +338,25 @@ void main() {
verify
(
mockVmService
.
callServiceExtension
(
'ext.flutter.profileWidgetBuilds'
,
verify
(
mockVmService
.
callServiceExtension
(
'ext.flutter.profileWidgetBuilds'
,
args:
<
String
,
Object
>{
'enabled'
:
true
})).
called
(
1
);
args:
<
String
,
Object
>{
'enabled'
:
true
})).
called
(
1
);
}));
}));
test
(
'cleanup of resources is safe to call multiple times'
,
()
=>
testbed
.
run
(()
async
{
_setupMocks
();
bool
debugClosed
=
false
;
when
(
mockDebugConnection
.
close
()).
thenAnswer
((
Invocation
invocation
)
async
{
if
(
debugClosed
)
{
throw
StateError
(
'debug connection closed twice'
);
}
debugClosed
=
true
;
});
final
Completer
<
DebugConnectionInfo
>
connectionInfoCompleter
=
Completer
<
DebugConnectionInfo
>();
unawaited
(
residentWebRunner
.
run
(
connectionInfoCompleter:
connectionInfoCompleter
,
));
await
connectionInfoCompleter
.
future
;
await
residentWebRunner
.
exit
();
await
residentWebRunner
.
exit
();
}));
}
}
...
...
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