Chromium Code Reviews| Index: runtime/bin/loader.cc |
| diff --git a/runtime/bin/loader.cc b/runtime/bin/loader.cc |
| index de82be482639d729dd82c52a08cf82a723711f37..102fa47fec8e4b37d3b67f113fd17011837ee801 100644 |
| --- a/runtime/bin/loader.cc |
| +++ b/runtime/bin/loader.cc |
| @@ -290,19 +290,37 @@ void Loader::AddDependencyLocked(Loader* loader, const char* resolved_uri) { |
| if (dependencies == NULL) { |
| return; |
| } |
| - uint8_t* scoped_file_path = NULL; |
| - intptr_t scoped_file_path_length = -1; |
| - Dart_Handle uri = Dart_NewStringFromCString(resolved_uri); |
| - ASSERT(!Dart_IsError(uri)); |
| - Dart_Handle result = Loader::ResolveAsFilePath(uri, &scoped_file_path, |
| - &scoped_file_path_length); |
| - if (Dart_IsError(result)) { |
| - Log::Print("Error resolving dependency: %s\n", Dart_GetError(result)); |
| + dependencies->Add(strdup(resolved_uri)); |
| +} |
| + |
|
zra
2017/04/26 20:25:01
two newlines between functions.
rmacnak
2017/04/26 20:34:06
Done.
|
| +void Loader::ResolveDependenciesAsFilePaths() { |
| + IsolateData* isolate_data = |
| + reinterpret_cast<IsolateData*>(Dart_CurrentIsolateData()); |
| + ASSERT(isolate_data != NULL); |
| + MallocGrowableArray<char*>* dependencies = isolate_data->dependencies(); |
| + if (dependencies == NULL) { |
| return; |
| } |
| - dependencies->Add(StringUtils::StrNDup( |
| - reinterpret_cast<const char*>(scoped_file_path), |
| - scoped_file_path_length)); |
| + |
| + for (intptr_t i = 0; i < dependencies->length(); i++) { |
| + char* resolved_uri = (*dependencies)[i]; |
| + |
| + uint8_t* scoped_file_path = NULL; |
| + intptr_t scoped_file_path_length = -1; |
| + Dart_Handle uri = Dart_NewStringFromCString(resolved_uri); |
| + ASSERT(!Dart_IsError(uri)); |
| + Dart_Handle result = Loader::ResolveAsFilePath(uri, &scoped_file_path, |
| + &scoped_file_path_length); |
| + if (Dart_IsError(result)) { |
| + Log::Print("Error resolving dependency: %s\n", Dart_GetError(result)); |
| + return; |
| + } |
| + |
| + (*dependencies)[i] = |
| + StringUtils::StrNDup(reinterpret_cast<const char*>(scoped_file_path), |
| + scoped_file_path_length); |
| + free(resolved_uri); |
| + } |
| } |