Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: runtime/bin/loader.cc

Issue 2837873005: Fix some assertion failures on Fuchsia (Closed)
Patch Set: . Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/bin/loader.h ('k') | runtime/bin/main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 5
6 #include "bin/loader.h" 6 #include "bin/loader.h"
7 7
8 #include "bin/builtin.h" 8 #include "bin/builtin.h"
9 #include "bin/dartutils.h" 9 #include "bin/dartutils.h"
10 #include "bin/extensions.h" 10 #include "bin/extensions.h"
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 (strstr(path, File::PathSeparator()) != NULL)); 283 (strstr(path, File::PathSeparator()) != NULL));
284 } 284 }
285 285
286 286
287 void Loader::AddDependencyLocked(Loader* loader, const char* resolved_uri) { 287 void Loader::AddDependencyLocked(Loader* loader, const char* resolved_uri) {
288 MallocGrowableArray<char*>* dependencies = 288 MallocGrowableArray<char*>* dependencies =
289 loader->isolate_data_->dependencies(); 289 loader->isolate_data_->dependencies();
290 if (dependencies == NULL) { 290 if (dependencies == NULL) {
291 return; 291 return;
292 } 292 }
293 uint8_t* scoped_file_path = NULL; 293 dependencies->Add(strdup(resolved_uri));
294 intptr_t scoped_file_path_length = -1; 294 }
295 Dart_Handle uri = Dart_NewStringFromCString(resolved_uri); 295
zra 2017/04/26 20:25:01 two newlines between functions.
rmacnak 2017/04/26 20:34:06 Done.
296 ASSERT(!Dart_IsError(uri)); 296 void Loader::ResolveDependenciesAsFilePaths() {
297 Dart_Handle result = Loader::ResolveAsFilePath(uri, &scoped_file_path, 297 IsolateData* isolate_data =
298 &scoped_file_path_length); 298 reinterpret_cast<IsolateData*>(Dart_CurrentIsolateData());
299 if (Dart_IsError(result)) { 299 ASSERT(isolate_data != NULL);
300 Log::Print("Error resolving dependency: %s\n", Dart_GetError(result)); 300 MallocGrowableArray<char*>* dependencies = isolate_data->dependencies();
301 if (dependencies == NULL) {
301 return; 302 return;
302 } 303 }
303 dependencies->Add(StringUtils::StrNDup( 304
304 reinterpret_cast<const char*>(scoped_file_path), 305 for (intptr_t i = 0; i < dependencies->length(); i++) {
305 scoped_file_path_length)); 306 char* resolved_uri = (*dependencies)[i];
307
308 uint8_t* scoped_file_path = NULL;
309 intptr_t scoped_file_path_length = -1;
310 Dart_Handle uri = Dart_NewStringFromCString(resolved_uri);
311 ASSERT(!Dart_IsError(uri));
312 Dart_Handle result = Loader::ResolveAsFilePath(uri, &scoped_file_path,
313 &scoped_file_path_length);
314 if (Dart_IsError(result)) {
315 Log::Print("Error resolving dependency: %s\n", Dart_GetError(result));
316 return;
317 }
318
319 (*dependencies)[i] =
320 StringUtils::StrNDup(reinterpret_cast<const char*>(scoped_file_path),
321 scoped_file_path_length);
322 free(resolved_uri);
323 }
306 } 324 }
307 325
308 326
309 bool Loader::ProcessResultLocked(Loader* loader, Loader::IOResult* result) { 327 bool Loader::ProcessResultLocked(Loader* loader, Loader::IOResult* result) {
310 // We have to copy everything we care about out of |result| because after 328 // We have to copy everything we care about out of |result| because after
311 // dropping the lock below |result| may no longer valid. 329 // dropping the lock below |result| may no longer valid.
312 Dart_Handle uri = 330 Dart_Handle uri =
313 Dart_NewStringFromCString(reinterpret_cast<char*>(result->uri)); 331 Dart_NewStringFromCString(reinterpret_cast<char*>(result->uri));
314 Dart_Handle resolved_uri = 332 Dart_Handle resolved_uri =
315 Dart_NewStringFromCString(reinterpret_cast<char*>(result->resolved_uri)); 333 Dart_NewStringFromCString(reinterpret_cast<char*>(result->resolved_uri));
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 MutexLocker ml(loader_infos_lock_); 889 MutexLocker ml(loader_infos_lock_);
872 Loader* loader = LoaderForLocked(dest_port_id); 890 Loader* loader = LoaderForLocked(dest_port_id);
873 if (loader == NULL) { 891 if (loader == NULL) {
874 return; 892 return;
875 } 893 }
876 loader->QueueMessage(message); 894 loader->QueueMessage(message);
877 } 895 }
878 896
879 } // namespace bin 897 } // namespace bin
880 } // namespace dart 898 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/loader.h ('k') | runtime/bin/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698