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
af42e7d7
Unverified
Commit
af42e7d7
authored
Jun 28, 2021
by
Lau Ching Jun
Committed by
GitHub
Jun 28, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only set assets directory after assets are uploaded onto devfs. (#85418)
parent
b0462184
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
104 additions
and
36 deletions
+104
-36
devfs.dart
packages/flutter_tools/lib/src/devfs.dart
+3
-0
devfs_web.dart
packages/flutter_tools/lib/src/isolated/devfs_web.dart
+4
-0
run_hot.dart
packages/flutter_tools/lib/src/run_hot.dart
+20
-10
resident_runner_test.dart
...lutter_tools/test/general.shard/resident_runner_test.dart
+77
-26
No files found.
packages/flutter_tools/lib/src/devfs.dart
View file @
af42e7d7
...
...
@@ -480,6 +480,9 @@ class DevFS {
final
Directory
rootDirectory
;
final
Set
<
String
>
assetPathsToEvict
=
<
String
>{};
// A flag to indicate whether we have called `setAssetDirectory` on the target device.
bool
hasSetAssetDirectory
=
false
;
List
<
Uri
>
sources
=
<
Uri
>[];
DateTime
lastCompiled
;
DateTime
_previousCompiled
;
...
...
packages/flutter_tools/lib/src/isolated/devfs_web.dart
View file @
af42e7d7
...
...
@@ -660,6 +660,10 @@ class WebDevFS implements DevFS {
Dwds
get
dwds
=>
webAssetServer
.
dwds
;
// A flag to indicate whether we have called `setAssetDirectory` on the target device.
@override
bool
hasSetAssetDirectory
=
false
;
Future
<
DebugConnection
>
_cachedExtensionFuture
;
StreamSubscription
<
void
>
_connectedApps
;
...
...
packages/flutter_tools/lib/src/run_hot.dart
View file @
af42e7d7
...
...
@@ -279,14 +279,6 @@ class HotRunner extends ResidentRunner {
device
.
generator
.
accept
();
}
final
List
<
FlutterView
>
views
=
await
device
.
vmService
.
getFlutterViews
();
final
Uri
deviceAssetsDirectoryUri
=
device
.
devFS
.
baseUri
.
resolveUri
(
globals
.
fs
.
path
.
toUri
(
getAssetBuildDirectory
()));
await
Future
.
wait
<
void
>(
views
.
map
<
Future
<
void
>>(
(
FlutterView
view
)
=>
device
.
vmService
.
setAssetDirectory
(
assetsDirectory:
deviceAssetsDirectoryUri
,
uiIsolateId:
view
.
uiIsolate
.
id
,
viewId:
view
.
id
,
)
));
for
(
final
FlutterView
view
in
views
)
{
globals
.
printTrace
(
'Connected to
$view
.'
);
}
...
...
@@ -896,7 +888,7 @@ class HotRunner extends ResidentRunner {
}
reloadVMTimer
.
stop
();
await
_
evictDirtyAssets
();
await
evictDirtyAssets
();
final
Stopwatch
reassembleTimer
=
_stopwatchFactory
.
createStopwatch
(
'reloadSources:reassemble'
)..
start
();
...
...
@@ -997,13 +989,31 @@ class HotRunner extends ResidentRunner {
printDebuggerList
();
}
Future
<
void
>
_evictDirtyAssets
()
async
{
@visibleForTesting
Future
<
void
>
evictDirtyAssets
()
async
{
final
List
<
Future
<
Map
<
String
,
dynamic
>>>
futures
=
<
Future
<
Map
<
String
,
dynamic
>>>[];
for
(
final
FlutterDevice
device
in
flutterDevices
)
{
if
(
device
.
devFS
.
assetPathsToEvict
.
isEmpty
)
{
continue
;
}
final
List
<
FlutterView
>
views
=
await
device
.
vmService
.
getFlutterViews
();
// If this is the first time we update the assets, make sure to call the setAssetDirectory
if
(!
device
.
devFS
.
hasSetAssetDirectory
)
{
final
Uri
deviceAssetsDirectoryUri
=
device
.
devFS
.
baseUri
.
resolveUri
(
globals
.
fs
.
path
.
toUri
(
getAssetBuildDirectory
()));
await
Future
.
wait
<
void
>(
views
.
map
<
Future
<
void
>>(
(
FlutterView
view
)
=>
device
.
vmService
.
setAssetDirectory
(
assetsDirectory:
deviceAssetsDirectoryUri
,
uiIsolateId:
view
.
uiIsolate
.
id
,
viewId:
view
.
id
,
)
));
for
(
final
FlutterView
view
in
views
)
{
globals
.
printTrace
(
'Set asset directory in
$view
.'
);
}
device
.
devFS
.
hasSetAssetDirectory
=
true
;
}
if
(
views
.
first
.
uiIsolate
==
null
)
{
globals
.
printError
(
'Application isolate not found for
$device
'
);
continue
;
...
...
packages/flutter_tools/test/general.shard/resident_runner_test.dart
View file @
af42e7d7
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