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
672d04e0
Commit
672d04e0
authored
8 years ago
by
Dan Rubel
Committed by
GitHub
8 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
close sinks cleanup (#5838)
part of
https://github.com/flutter/flutter/issues/5789
parent
3e2a52bc
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
2 deletions
+33
-2
analyze.dart
packages/flutter_tools/lib/src/commands/analyze.dart
+5
-1
daemon.dart
packages/flutter_tools/lib/src/commands/daemon.dart
+8
-1
daemon_test.dart
packages/flutter_tools/test/daemon_test.dart
+15
-0
protocol_discovery_test.dart
packages/flutter_tools/test/protocol_discovery_test.dart
+1
-0
mocks.dart
packages/flutter_tools/test/src/mocks.dart
+4
-0
No files found.
packages/flutter_tools/lib/src/commands/analyze.dart
View file @
672d04e0
...
@@ -636,7 +636,11 @@ class AnalysisServer {
...
@@ -636,7 +636,11 @@ class AnalysisServer {
_errorsController
.
add
(
new
FileAnalysisErrors
(
file
,
errors
));
_errorsController
.
add
(
new
FileAnalysisErrors
(
file
,
errors
));
}
}
Future
<
bool
>
dispose
()
async
=>
_process
?.
kill
();
Future
<
bool
>
dispose
()
async
{
await
_analyzingController
.
close
();
await
_errorsController
.
close
();
return
_process
?.
kill
();
}
}
}
class
FileAnalysisErrors
{
class
FileAnalysisErrors
{
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/daemon.dart
View file @
672d04e0
...
@@ -100,7 +100,10 @@ class Daemon {
...
@@ -100,7 +100,10 @@ class Daemon {
// Start listening.
// Start listening.
commandStream
.
listen
(
commandStream
.
listen
(
(
Map
<
String
,
dynamic
>
request
)
=>
_handleRequest
(
request
),
(
Map
<
String
,
dynamic
>
request
)
=>
_handleRequest
(
request
),
onDone:
()
=>
_onExitCompleter
.
complete
(
0
)
onDone:
()
{
if
(!
_onExitCompleter
.
isCompleted
)
_onExitCompleter
.
complete
(
0
);
}
);
);
}
}
...
@@ -579,6 +582,10 @@ class NotifyingLogger extends Logger {
...
@@ -579,6 +582,10 @@ class NotifyingLogger extends Logger {
printStatus
(
message
);
printStatus
(
message
);
return
new
Status
();
return
new
Status
();
}
}
void
dispose
()
{
_messageController
.
close
();
}
}
}
/// A running application, started by this daemon.
/// A running application, started by this daemon.
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/daemon_test.dart
View file @
672d04e0
...
@@ -42,6 +42,7 @@ void main() {
...
@@ -42,6 +42,7 @@ void main() {
tearDown
(()
{
tearDown
(()
{
if
(
daemon
!=
null
)
if
(
daemon
!=
null
)
return
daemon
.
shutdown
();
return
daemon
.
shutdown
();
notifyingLogger
.
dispose
();
});
});
_testUsingContext
(
'daemon.version'
,
()
async
{
_testUsingContext
(
'daemon.version'
,
()
async
{
...
@@ -57,6 +58,8 @@ void main() {
...
@@ -57,6 +58,8 @@ void main() {
expect
(
response
[
'id'
],
0
);
expect
(
response
[
'id'
],
0
);
expect
(
response
[
'result'
],
isNotEmpty
);
expect
(
response
[
'result'
],
isNotEmpty
);
expect
(
response
[
'result'
]
is
String
,
true
);
expect
(
response
[
'result'
]
is
String
,
true
);
responses
.
close
();
commands
.
close
();
});
});
_testUsingContext
(
'daemon.logMessage'
,
()
{
_testUsingContext
(
'daemon.logMessage'
,
()
{
...
@@ -77,6 +80,8 @@ void main() {
...
@@ -77,6 +80,8 @@ void main() {
Map
<
String
,
String
>
logMessage
=
response
[
'params'
];
Map
<
String
,
String
>
logMessage
=
response
[
'params'
];
expect
(
logMessage
[
'level'
],
'error'
);
expect
(
logMessage
[
'level'
],
'error'
);
expect
(
logMessage
[
'message'
],
'daemon.logMessage test'
);
expect
(
logMessage
[
'message'
],
'daemon.logMessage test'
);
responses
.
close
();
commands
.
close
();
});
});
});
});
...
@@ -90,6 +95,8 @@ void main() {
...
@@ -90,6 +95,8 @@ void main() {
);
);
commands
.
add
(<
String
,
dynamic
>{
'id'
:
0
,
'method'
:
'daemon.shutdown'
});
commands
.
add
(<
String
,
dynamic
>{
'id'
:
0
,
'method'
:
'daemon.shutdown'
});
return
daemon
.
onExit
.
then
((
int
code
)
{
return
daemon
.
onExit
.
then
((
int
code
)
{
responses
.
close
();
commands
.
close
();
expect
(
code
,
0
);
expect
(
code
,
0
);
});
});
});
});
...
@@ -111,6 +118,8 @@ void main() {
...
@@ -111,6 +118,8 @@ void main() {
Map
<
String
,
dynamic
>
response
=
await
responses
.
stream
.
where
(
_notEvent
).
first
;
Map
<
String
,
dynamic
>
response
=
await
responses
.
stream
.
where
(
_notEvent
).
first
;
expect
(
response
[
'id'
],
0
);
expect
(
response
[
'id'
],
0
);
expect
(
response
[
'error'
],
contains
(
'deviceId is required'
));
expect
(
response
[
'error'
],
contains
(
'deviceId is required'
));
responses
.
close
();
commands
.
close
();
});
});
_testUsingContext
(
'daemon.restart'
,
()
async
{
_testUsingContext
(
'daemon.restart'
,
()
async
{
...
@@ -130,6 +139,8 @@ void main() {
...
@@ -130,6 +139,8 @@ void main() {
Map
<
String
,
dynamic
>
response
=
await
responses
.
stream
.
where
(
_notEvent
).
first
;
Map
<
String
,
dynamic
>
response
=
await
responses
.
stream
.
where
(
_notEvent
).
first
;
expect
(
response
[
'id'
],
0
);
expect
(
response
[
'id'
],
0
);
expect
(
response
[
'error'
],
contains
(
'appId is required'
));
expect
(
response
[
'error'
],
contains
(
'appId is required'
));
responses
.
close
();
commands
.
close
();
});
});
_testUsingContext
(
'daemon.stop'
,
()
async
{
_testUsingContext
(
'daemon.stop'
,
()
async
{
...
@@ -149,6 +160,8 @@ void main() {
...
@@ -149,6 +160,8 @@ void main() {
Map
<
String
,
dynamic
>
response
=
await
responses
.
stream
.
where
(
_notEvent
).
first
;
Map
<
String
,
dynamic
>
response
=
await
responses
.
stream
.
where
(
_notEvent
).
first
;
expect
(
response
[
'id'
],
0
);
expect
(
response
[
'id'
],
0
);
expect
(
response
[
'error'
],
contains
(
'appId is required'
));
expect
(
response
[
'error'
],
contains
(
'appId is required'
));
responses
.
close
();
commands
.
close
();
});
});
_testUsingContext
(
'device.getDevices'
,
()
async
{
_testUsingContext
(
'device.getDevices'
,
()
async
{
...
@@ -163,6 +176,8 @@ void main() {
...
@@ -163,6 +176,8 @@ void main() {
Map
<
String
,
dynamic
>
response
=
await
responses
.
stream
.
where
(
_notEvent
).
first
;
Map
<
String
,
dynamic
>
response
=
await
responses
.
stream
.
where
(
_notEvent
).
first
;
expect
(
response
[
'id'
],
0
);
expect
(
response
[
'id'
],
0
);
expect
(
response
[
'result'
],
isList
);
expect
(
response
[
'result'
],
isList
);
responses
.
close
();
commands
.
close
();
});
});
});
});
}
}
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/protocol_discovery_test.dart
View file @
672d04e0
...
@@ -48,6 +48,7 @@ void main() {
...
@@ -48,6 +48,7 @@ void main() {
expect
(
await
nextPort
,
52584
);
expect
(
await
nextPort
,
52584
);
discoverer
.
cancel
();
discoverer
.
cancel
();
logReader
.
dispose
();
});
});
});
});
}
}
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/src/mocks.dart
View file @
672d04e0
...
@@ -62,6 +62,10 @@ class MockDeviceLogReader extends DeviceLogReader {
...
@@ -62,6 +62,10 @@ class MockDeviceLogReader extends DeviceLogReader {
Stream
<
String
>
get
logLines
=>
_linesController
.
stream
;
Stream
<
String
>
get
logLines
=>
_linesController
.
stream
;
void
addLine
(
String
line
)
=>
_linesController
.
add
(
line
);
void
addLine
(
String
line
)
=>
_linesController
.
add
(
line
);
void
dispose
()
{
_linesController
.
close
();
}
}
}
void
applyMocksToCommand
(
FlutterCommand
command
)
{
void
applyMocksToCommand
(
FlutterCommand
command
)
{
...
...
This diff is collapsed.
Click to expand it.
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