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
1f1adcaa
Commit
1f1adcaa
authored
Nov 03, 2016
by
Dan Rubel
Committed by
GitHub
Nov 03, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor app.* daemon events (#6679)
parent
984b6239
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
8 deletions
+32
-8
daemon.dart
packages/flutter_tools/lib/src/commands/daemon.dart
+15
-6
hot.dart
packages/flutter_tools/lib/src/hot.dart
+9
-0
resident_runner.dart
packages/flutter_tools/lib/src/resident_runner.dart
+1
-0
run.dart
packages/flutter_tools/lib/src/run.dart
+7
-2
No files found.
packages/flutter_tools/lib/src/commands/daemon.dart
View file @
1f1adcaa
...
@@ -361,16 +361,25 @@ class AppDomain extends Domain {
...
@@ -361,16 +361,25 @@ class AppDomain extends Domain {
_sendAppEvent
(
app
,
'debugPort'
,
params
);
_sendAppEvent
(
app
,
'debugPort'
,
params
);
});
});
}
}
Completer
<
Null
>
appStartedCompleter
=
new
Completer
<
Null
>();
appStartedCompleter
.
future
.
then
((
_
)
{
_sendAppEvent
(
app
,
'started'
);
});
app
.
_runInZone
(
this
,
()
{
app
.
_runInZone
(
this
,
()
async
{
runner
.
run
(
connectionInfoCompleter:
connectionInfoCompleter
,
route:
route
).
then
((
_
)
{
try
{
await
runner
.
run
(
connectionInfoCompleter:
connectionInfoCompleter
,
appStartedCompleter:
appStartedCompleter
,
route:
route
,
);
_sendAppEvent
(
app
,
'stop'
);
_sendAppEvent
(
app
,
'stop'
);
}
).
catchError
((
dynamic
error
)
{
}
catch
(
error
)
{
_sendAppEvent
(
app
,
'stop'
,
<
String
,
dynamic
>{
'error'
:
error
.
toString
()
});
_sendAppEvent
(
app
,
'stop'
,
<
String
,
dynamic
>{
'error'
:
error
.
toString
()
});
}
).
whenComplete
(()
{
}
finally
{
Directory
.
current
=
cwd
;
Directory
.
current
=
cwd
;
_apps
.
remove
(
app
);
_apps
.
remove
(
app
);
}
);
}
});
});
return
app
;
return
app
;
...
...
packages/flutter_tools/lib/src/hot.dart
View file @
1f1adcaa
...
@@ -139,6 +139,7 @@ class HotRunner extends ResidentRunner {
...
@@ -139,6 +139,7 @@ class HotRunner extends ResidentRunner {
@override
@override
Future
<
int
>
run
({
Future
<
int
>
run
({
Completer
<
DebugConnectionInfo
>
connectionInfoCompleter
,
Completer
<
DebugConnectionInfo
>
connectionInfoCompleter
,
Completer
<
Null
>
appStartedCompleter
,
String
route
,
String
route
,
bool
shouldBuild:
true
bool
shouldBuild:
true
})
{
})
{
...
@@ -146,6 +147,7 @@ class HotRunner extends ResidentRunner {
...
@@ -146,6 +147,7 @@ class HotRunner extends ResidentRunner {
return
Chain
.
capture
(()
{
return
Chain
.
capture
(()
{
return
_run
(
return
_run
(
connectionInfoCompleter:
connectionInfoCompleter
,
connectionInfoCompleter:
connectionInfoCompleter
,
appStartedCompleter:
appStartedCompleter
,
route:
route
,
route:
route
,
shouldBuild:
shouldBuild
shouldBuild:
shouldBuild
);
);
...
@@ -173,6 +175,7 @@ class HotRunner extends ResidentRunner {
...
@@ -173,6 +175,7 @@ class HotRunner extends ResidentRunner {
Future
<
int
>
_run
({
Future
<
int
>
_run
({
Completer
<
DebugConnectionInfo
>
connectionInfoCompleter
,
Completer
<
DebugConnectionInfo
>
connectionInfoCompleter
,
Completer
<
Null
>
appStartedCompleter
,
String
route
,
String
route
,
bool
shouldBuild:
true
bool
shouldBuild:
true
})
async
{
})
async
{
...
@@ -304,6 +307,12 @@ class HotRunner extends ResidentRunner {
...
@@ -304,6 +307,12 @@ class HotRunner extends ResidentRunner {
registerSignalHandlers
();
registerSignalHandlers
();
printTrace
(
'Finishing file synchronization'
);
// Finish the file sync now.
await
_updateDevFS
();
appStartedCompleter
?.
complete
();
if
(
benchmarkMode
)
{
if
(
benchmarkMode
)
{
// We are running in benchmark mode.
// We are running in benchmark mode.
printStatus
(
'Running in benchmark mode.'
);
printStatus
(
'Running in benchmark mode.'
);
...
...
packages/flutter_tools/lib/src/resident_runner.dart
View file @
1f1adcaa
...
@@ -40,6 +40,7 @@ abstract class ResidentRunner {
...
@@ -40,6 +40,7 @@ abstract class ResidentRunner {
/// Start the app and keep the process running during its lifetime.
/// Start the app and keep the process running during its lifetime.
Future
<
int
>
run
({
Future
<
int
>
run
({
Completer
<
DebugConnectionInfo
>
connectionInfoCompleter
,
Completer
<
DebugConnectionInfo
>
connectionInfoCompleter
,
Completer
<
Null
>
appStartedCompleter
,
String
route
,
String
route
,
bool
shouldBuild:
true
bool
shouldBuild:
true
});
});
...
...
packages/flutter_tools/lib/src/run.dart
View file @
1f1adcaa
...
@@ -45,6 +45,7 @@ class RunAndStayResident extends ResidentRunner {
...
@@ -45,6 +45,7 @@ class RunAndStayResident extends ResidentRunner {
@override
@override
Future
<
int
>
run
({
Future
<
int
>
run
({
Completer
<
DebugConnectionInfo
>
connectionInfoCompleter
,
Completer
<
DebugConnectionInfo
>
connectionInfoCompleter
,
Completer
<
Null
>
appStartedCompleter
,
String
route
,
String
route
,
bool
shouldBuild:
true
bool
shouldBuild:
true
})
{
})
{
...
@@ -55,6 +56,7 @@ class RunAndStayResident extends ResidentRunner {
...
@@ -55,6 +56,7 @@ class RunAndStayResident extends ResidentRunner {
traceStartup:
traceStartup
,
traceStartup:
traceStartup
,
benchmark:
benchmark
,
benchmark:
benchmark
,
connectionInfoCompleter:
connectionInfoCompleter
,
connectionInfoCompleter:
connectionInfoCompleter
,
appStartedCompleter:
appStartedCompleter
,
route:
route
,
route:
route
,
shouldBuild:
shouldBuild
shouldBuild:
shouldBuild
);
);
...
@@ -101,6 +103,7 @@ class RunAndStayResident extends ResidentRunner {
...
@@ -101,6 +103,7 @@ class RunAndStayResident extends ResidentRunner {
bool
traceStartup:
false
,
bool
traceStartup:
false
,
bool
benchmark:
false
,
bool
benchmark:
false
,
Completer
<
DebugConnectionInfo
>
connectionInfoCompleter
,
Completer
<
DebugConnectionInfo
>
connectionInfoCompleter
,
Completer
<
Null
>
appStartedCompleter
,
String
route
,
String
route
,
bool
shouldBuild:
true
bool
shouldBuild:
true
})
async
{
})
async
{
...
@@ -185,8 +188,8 @@ class RunAndStayResident extends ResidentRunner {
...
@@ -185,8 +188,8 @@ class RunAndStayResident extends ResidentRunner {
startTime
.
stop
();
startTime
.
stop
();
if
(
connectionInfoCompleter
!=
null
&&
_result
.
hasObservatory
)
if
(
_result
.
hasObservatory
)
connectionInfoCompleter
.
complete
(
new
DebugConnectionInfo
(
_result
.
observatoryPort
));
connectionInfoCompleter
?
.
complete
(
new
DebugConnectionInfo
(
_result
.
observatoryPort
));
// Connect to observatory.
// Connect to observatory.
if
(
debuggingOptions
.
debuggingEnabled
)
{
if
(
debuggingOptions
.
debuggingEnabled
)
{
...
@@ -218,6 +221,8 @@ class RunAndStayResident extends ResidentRunner {
...
@@ -218,6 +221,8 @@ class RunAndStayResident extends ResidentRunner {
registerSignalHandlers
();
registerSignalHandlers
();
}
}
appStartedCompleter
?.
complete
();
if
(
benchmark
)
{
if
(
benchmark
)
{
await
new
Future
<
Null
>.
delayed
(
new
Duration
(
seconds:
4
));
await
new
Future
<
Null
>.
delayed
(
new
Duration
(
seconds:
4
));
...
...
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