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
f41f7956
Unverified
Commit
f41f7956
authored
Jun 18, 2020
by
Jenn Magder
Committed by
GitHub
Jun 18, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up PollingDeviceDiscovery dispose (#59709)
parent
339f0363
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
14 deletions
+31
-14
daemon.dart
packages/flutter_tools/lib/src/commands/daemon.dart
+8
-8
device.dart
packages/flutter_tools/lib/src/device.dart
+1
-1
devices.dart
packages/flutter_tools/lib/src/ios/devices.dart
+0
-5
devices_test.dart
...es/flutter_tools/test/general.shard/ios/devices_test.dart
+22
-0
No files found.
packages/flutter_tools/lib/src/commands/daemon.dart
View file @
f41f7956
...
...
@@ -179,10 +179,10 @@ class Daemon {
void
_send
(
Map
<
String
,
dynamic
>
map
)
=>
sendCommand
(
map
);
void
shutdown
({
dynamic
error
})
{
_commandSubscription
?.
cancel
();
Future
<
void
>
shutdown
({
dynamic
error
})
async
{
await
_commandSubscription
?.
cancel
();
for
(
final
Domain
domain
in
_domainMap
.
values
)
{
domain
.
dispose
();
await
domain
.
dispose
();
}
if
(!
_onExitCompleter
.
isCompleted
)
{
if
(
error
==
null
)
{
...
...
@@ -273,7 +273,7 @@ abstract class Domain {
return
val
as
int
;
}
void
dispose
()
{
}
Future
<
void
>
dispose
()
async
{
}
}
/// This domain responds to methods like [version] and [shutdown].
...
...
@@ -351,8 +351,8 @@ class DaemonDomain extends Domain {
}
@override
void
dispose
()
{
_subscription
?.
cancel
();
Future
<
void
>
dispose
()
async
{
await
_subscription
?.
cancel
();
}
/// Enumerates the platforms supported by the provided project.
...
...
@@ -828,9 +828,9 @@ class DeviceDomain extends Domain {
}
@override
void
dispose
()
{
Future
<
void
>
dispose
()
async
{
for
(
final
PollingDeviceDiscovery
discoverer
in
_discoverers
)
{
discoverer
.
dispose
();
await
discoverer
.
dispose
();
}
}
...
...
packages/flutter_tools/lib/src/device.dart
View file @
f41f7956
...
...
@@ -352,7 +352,7 @@ abstract class PollingDeviceDiscovery extends DeviceDiscovery {
return
deviceNotifier
.
onRemoved
;
}
void
dispose
()
=>
stopPolling
();
Future
<
void
>
dispose
()
async
=>
await
stopPolling
();
@override
String
toString
()
=>
'
$name
device discovery'
;
...
...
packages/flutter_tools/lib/src/ios/devices.dart
View file @
f41f7956
...
...
@@ -43,11 +43,6 @@ class IOSDevices extends PollingDeviceDiscovery {
_logger
=
logger
??
globals
.
logger
,
super
(
'iOS devices'
);
@override
void
dispose
()
{
_observedDeviceEventsSubscription
?.
cancel
();
}
final
Platform
_platform
;
final
XCDevice
_xcdevice
;
final
IOSWorkflow
_iosWorkflow
;
...
...
packages/flutter_tools/test/general.shard/ios/devices_test.dart
View file @
f41f7956
...
...
@@ -482,6 +482,28 @@ void main() {
expect
(
rescheduledStream
.
hasListener
,
isFalse
);
});
testWithoutContext
(
'dispose cancels polling subscription'
,
()
async
{
final
IOSDevices
iosDevices
=
IOSDevices
(
platform:
macPlatform
,
xcdevice:
mockXcdevice
,
iosWorkflow:
mockIosWorkflow
,
logger:
logger
,
);
when
(
mockXcdevice
.
isInstalled
).
thenReturn
(
true
);
when
(
mockXcdevice
.
getAvailableIOSDevices
())
.
thenAnswer
((
Invocation
invocation
)
=>
Future
<
List
<
IOSDevice
>>.
value
(<
IOSDevice
>[]));
final
StreamController
<
Map
<
XCDeviceEvent
,
String
>>
eventStream
=
StreamController
<
Map
<
XCDeviceEvent
,
String
>>();
when
(
mockXcdevice
.
observedDeviceEvents
()).
thenAnswer
((
_
)
=>
eventStream
.
stream
);
await
iosDevices
.
startPolling
();
expect
(
iosDevices
.
deviceNotifier
.
items
,
isEmpty
);
expect
(
eventStream
.
hasListener
,
isTrue
);
await
iosDevices
.
dispose
();
expect
(
eventStream
.
hasListener
,
isFalse
);
});
final
List
<
Platform
>
unsupportedPlatforms
=
<
Platform
>[
linuxPlatform
,
windowsPlatform
];
for
(
final
Platform
unsupportedPlatform
in
unsupportedPlatforms
)
{
testWithoutContext
(
'pollingGetDevices throws Unsupported Operation exception on
${unsupportedPlatform.operatingSystem}
'
,
()
async
{
...
...
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