Skip to content

Commit 4c455e7

Browse files
mkustermanncommit-bot@chromium.org
authored andcommitted
[VM] During hot-reload check if .packages was modified, tell IKG to re-load it if so
Change-Id: Ice7bbe0ccd98e450ec9c90a22259ec7b406b2c83 Reviewed-on: https://dart-review.googlesource.com/68360 Reviewed-by: Vyacheslav Egorov <[email protected]> Commit-Queue: Martin Kustermann <[email protected]>
1 parent 5a259ac commit 4c455e7

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

runtime/vm/isolate_reload.cc

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ void IsolateReloadContext::Reload(bool force_reload,
594594
intptr_t modified_scripts_count = 0;
595595

596596
FindModifiedSources(thread, force_reload, &modified_scripts,
597-
&modified_scripts_count);
597+
&modified_scripts_count, packages_url_);
598598

599599
Dart_KernelCompilationResult retval;
600600
{
@@ -1014,7 +1014,8 @@ void IsolateReloadContext::FindModifiedSources(
10141014
Thread* thread,
10151015
bool force_reload,
10161016
Dart_SourceFile** modified_sources,
1017-
intptr_t* count) {
1017+
intptr_t* count,
1018+
const char* packages_url) {
10181019
Zone* zone = thread->zone();
10191020
int64_t last_reload = I->last_reload_timestamp();
10201021
GrowableArray<const char*> modified_sources_uris;
@@ -1046,6 +1047,15 @@ void IsolateReloadContext::FindModifiedSources(
10461047
}
10471048
}
10481049

1050+
// In addition to all sources, we need to check if the .packages file
1051+
// contents have been modified.
1052+
if (packages_url != NULL) {
1053+
if (file_modified_callback_ == NULL ||
1054+
(*file_modified_callback_)(packages_url, last_reload)) {
1055+
modified_sources_uris.Add(packages_url);
1056+
}
1057+
}
1058+
10491059
*count = modified_sources_uris.length();
10501060
if (*count == 0) {
10511061
return;

runtime/vm/isolate_reload.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,8 @@ class IsolateReloadContext {
236236
void FindModifiedSources(Thread* thread,
237237
bool force_reload,
238238
Dart_SourceFile** modified_sources,
239-
intptr_t* count);
239+
intptr_t* count,
240+
const char* packages_url);
240241

241242
void CheckpointLibraries();
242243

0 commit comments

Comments
 (0)