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

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

Issue 203073004: Prefix io part uri's with 'dart:io/'. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 #include "bin/dartutils.h" 5 #include "bin/dartutils.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 9
10 #include "platform/assert.h" 10 #include "platform/assert.h"
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 " on the stand-alone VM.\n", url_string); 516 " on the stand-alone VM.\n", url_string);
517 } else { 517 } else {
518 ASSERT(tag == Dart_kSourceTag); 518 ASSERT(tag == Dart_kSourceTag);
519 return NewError("Unable to load source '%s' ", url_string); 519 return NewError("Unable to load source '%s' ", url_string);
520 } 520 }
521 } 521 }
522 522
523 // Handle 'part' of IO library. 523 // Handle 'part' of IO library.
524 if (is_io_library) { 524 if (is_io_library) {
525 if (tag == Dart_kSourceTag) { 525 if (tag == Dart_kSourceTag) {
526 // Prepend the library URI to form a unique script URI for the part.
527 intptr_t len = snprintf(NULL, 0, "%s/%s", library_url_string, url_string);
528 char* part_uri = reinterpret_cast<char*>(malloc(len + 1));
529 snprintf(part_uri, len + 1, "%s/%s", library_url_string, url_string);
530 Dart_Handle part_uri_obj = DartUtils::NewString(part_uri);
531 free(part_uri);
526 return Dart_LoadSource( 532 return Dart_LoadSource(
527 library, url, Builtin::PartSource(Builtin::kIOLibrary, url_string)); 533 library,
534 part_uri_obj,
535 Builtin::PartSource(Builtin::kIOLibrary, url_string));
528 } else { 536 } else {
529 ASSERT(tag == Dart_kImportTag); 537 ASSERT(tag == Dart_kImportTag);
530 return NewError("Unable to import '%s' ", url_string); 538 return NewError("Unable to import '%s' ", url_string);
531 } 539 }
532 } 540 }
533 541
534 Dart_Handle builtin_lib = 542 Dart_Handle builtin_lib =
535 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary); 543 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary);
536 if (DartUtils::IsDartExtensionSchemeURL(url_string)) { 544 if (DartUtils::IsDartExtensionSchemeURL(url_string)) {
537 // Load a native code shared library to use in a native extension 545 // Load a native code shared library to use in a native extension
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 new CObjectString(CObject::NewString(os_error->message())); 1120 new CObjectString(CObject::NewString(os_error->message()));
1113 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); 1121 CObjectArray* result = new CObjectArray(CObject::NewArray(3));
1114 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); 1122 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError)));
1115 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); 1123 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code())));
1116 result->SetAt(2, error_message); 1124 result->SetAt(2, error_message);
1117 return result; 1125 return result;
1118 } 1126 }
1119 1127
1120 } // namespace bin 1128 } // namespace bin
1121 } // namespace dart 1129 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698