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

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

Issue 15250009: Adapt gen_snapshot to the recent changes in bootstrap sources loading scheme. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 // Generate a snapshot file after loading all the scripts specified on the 5 // Generate a snapshot file after loading all the scripts specified on the
6 // command line. 6 // command line.
7 7
8 #include <stdlib.h> 8 #include <stdlib.h>
9 #include <string.h> 9 #include <string.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 library_url_string = DartUtils::GetStringValue(library_url); 285 library_url_string = DartUtils::GetStringValue(library_url);
286 } 286 }
287 287
288 if (!Dart_IsString(url)) { 288 if (!Dart_IsString(url)) {
289 return Dart_Error("url is not a string"); 289 return Dart_Error("url is not a string");
290 } 290 }
291 const char* url_string = DartUtils::GetStringValue(url); 291 const char* url_string = DartUtils::GetStringValue(url);
292 const char* mapped_url_string = DartUtils::MapLibraryUrl(url_mapping, 292 const char* mapped_url_string = DartUtils::MapLibraryUrl(url_mapping,
293 url_string); 293 url_string);
294 294
295 Builtin::BuiltinLibraryId builtinLibraryId = Builtin::kInvalidLibrary;
296 if (DartUtils::IsDartBuiltinLibURL(library_url_string)) {
297 builtinLibraryId = Builtin::kBuiltinLibrary;
298 } else if (DartUtils::IsDartIOLibURL(library_url_string)) {
299 builtinLibraryId = Builtin::kIOLibrary;
300 }
301
295 if (tag == kCanonicalizeUrl) { 302 if (tag == kCanonicalizeUrl) {
296 // Keep original names for libraries that have a mapping (e.g. dart:io). 303 // Keep original names for libraries that have a mapping (e.g. dart:io).
siva 2013/05/21 16:45:37 The comment (e.g: dart:io) seems wrong because you
podivilov 2013/05/22 08:54:44 Done.
297 if (mapped_url_string) { 304 if (mapped_url_string) {
298 return url; 305 return url;
299 } 306 }
307 // Parts of internal libraries are handled internally.
308 if (builtinLibraryId != Builtin::kInvalidLibrary) {
309 return url;
310 }
300 return ResolveUri(library_url_string, url_string); 311 return ResolveUri(library_url_string, url_string);
301 } 312 }
302 313
303 if (DartUtils::IsDartIOLibURL(url_string) && mapped_url_string == NULL) { 314 if (DartUtils::IsDartBuiltinLibURL(url_string)) {
304 // No url mapping for dart:io. Load original version. 315 return Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary);
siva 2013/05/21 16:45:37 You probably need a if (tag == kImportTag) { ret
podivilov 2013/05/22 08:54:44 Done.
316 }
317 if (DartUtils::IsDartIOLibURL(url_string)) {
305 return Builtin::LoadAndCheckLibrary(Builtin::kIOLibrary); 318 return Builtin::LoadAndCheckLibrary(Builtin::kIOLibrary);
siva 2013/05/21 16:45:37 Ditto comment here.
podivilov 2013/05/22 08:54:44 Done.
306 } 319 }
307 320
321 if (builtinLibraryId != Builtin::kInvalidLibrary) {
322 if (tag == kSourceTag) {
323 return Dart_LoadSource(
324 library, url, Builtin::PartSource(builtinLibraryId, url_string));
325 }
326 ASSERT(tag == kImportTag);
327 return Dart_Error("Unable to import '%s' ", url_string);
328 }
329
308 Dart_Handle resolved_url = url; 330 Dart_Handle resolved_url = url;
309 if (mapped_url_string != NULL) { 331 if (mapped_url_string != NULL) {
310 // Mapped urls are relative to working directory. 332 // Mapped urls are relative to working directory.
311 resolved_url = ResolveScriptUri(mapped_url_string); 333 resolved_url = ResolveScriptUri(mapped_url_string);
312 if (Dart_IsError(resolved_url)) { 334 if (Dart_IsError(resolved_url)) {
313 return resolved_url; 335 return resolved_url;
314 } 336 }
315 } 337 }
316 338
317 // Get the file path out of the url. 339 // Get the file path out of the url.
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 } 557 }
536 return 0; 558 return 0;
537 } 559 }
538 560
539 } // namespace bin 561 } // namespace bin
540 } // namespace dart 562 } // namespace dart
541 563
542 int main(int argc, char** argv) { 564 int main(int argc, char** argv) {
543 return dart::bin::main(argc, argv); 565 return dart::bin::main(argc, argv);
544 } 566 }
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