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

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

Issue 10905102: Rename Builtin::LoadLibrary to Builtin::LoadAndCheckLibrary as the name (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 | « runtime/bin/gen_snapshot.cc ('k') | runtime/vm/unit_test.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) 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 <stdlib.h> 5 #include <stdlib.h>
6 #include <string.h> 6 #include <string.h>
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include "include/dart_api.h" 9 #include "include/dart_api.h"
10 #include "include/dart_debugger_api.h" 10 #include "include/dart_debugger_api.h"
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 Dart_Isolate isolate = 377 Dart_Isolate isolate =
378 Dart_CreateIsolate(script_uri, main, snapshot_buffer, data, error); 378 Dart_CreateIsolate(script_uri, main, snapshot_buffer, data, error);
379 if (isolate == NULL) { 379 if (isolate == NULL) {
380 return false; 380 return false;
381 } 381 }
382 382
383 Dart_EnterScope(); 383 Dart_EnterScope();
384 384
385 if (snapshot_buffer != NULL) { 385 if (snapshot_buffer != NULL) {
386 // Setup the native resolver as the snapshot does not carry it. 386 // Setup the native resolver as the snapshot does not carry it.
387 Builtin::SetupLibrary(Builtin::LoadLibrary(Builtin::kBuiltinLibrary), 387 Builtin::SetupLibrary(
388 Builtin::kBuiltinLibrary); 388 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary),
389 Builtin::SetupLibrary(Builtin::LoadLibrary(Builtin::kIOLibrary), 389 Builtin::kBuiltinLibrary);
390 Builtin::SetupLibrary(Builtin::LoadAndCheckLibrary(Builtin::kIOLibrary),
390 Builtin::kIOLibrary); 391 Builtin::kIOLibrary);
391 } 392 }
392 393
393 // Set up the library tag handler for this isolate. 394 // Set up the library tag handler for this isolate.
394 Dart_Handle result = Dart_SetLibraryTagHandler(DartUtils::LibraryTagHandler); 395 Dart_Handle result = Dart_SetLibraryTagHandler(DartUtils::LibraryTagHandler);
395 CHECK_RESULT(result); 396 CHECK_RESULT(result);
396 397
397 // Load the specified application script into the newly created isolate. 398 // Load the specified application script into the newly created isolate.
398 Dart_Handle library; 399 Dart_Handle library;
399 if (use_script_snapshot) { 400 if (use_script_snapshot) {
(...skipping 10 matching lines...) Expand all
410 delete snapshot_file; 411 delete snapshot_file;
411 snapshot_file = NULL; 412 snapshot_file = NULL;
412 use_script_snapshot = false; 413 use_script_snapshot = false;
413 *error = strdup("Unable to read contents of script snapshot file"); 414 *error = strdup("Unable to read contents of script snapshot file");
414 Dart_ExitScope(); 415 Dart_ExitScope();
415 Dart_ShutdownIsolate(); 416 Dart_ShutdownIsolate();
416 return false; 417 return false;
417 } 418 }
418 // Prepare for script loading by setting up the 'print' and 'timer' 419 // Prepare for script loading by setting up the 'print' and 'timer'
419 // closures and setting up 'package root' for URI resolution. 420 // closures and setting up 'package root' for URI resolution.
420 Dart_Handle builtin_lib = Builtin::LoadLibrary(Builtin::kBuiltinLibrary); 421 Dart_Handle builtin_lib =
422 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary);
421 DartUtils::PrepareForScriptLoading(package_root, builtin_lib); 423 DartUtils::PrepareForScriptLoading(package_root, builtin_lib);
422 424
423 snapshot_file->ReadFully(buffer, len); 425 snapshot_file->ReadFully(buffer, len);
424 library = Dart_LoadScriptFromSnapshot(buffer); 426 library = Dart_LoadScriptFromSnapshot(buffer);
425 free(buffer); 427 free(buffer);
426 delete snapshot_file; 428 delete snapshot_file;
427 snapshot_file = NULL; 429 snapshot_file = NULL;
428 use_script_snapshot = false; // No further usage of script snapshots. 430 use_script_snapshot = false; // No further usage of script snapshots.
429 } else { 431 } else {
430 // Prepare builtin and its dependent libraries for use to resolve URIs. 432 // Prepare builtin and its dependent libraries for use to resolve URIs.
431 Dart_Handle uri_lib = Builtin::LoadLibrary(Builtin::kUriLibrary); 433 Dart_Handle uri_lib = Builtin::LoadAndCheckLibrary(Builtin::kUriLibrary);
432 CHECK_RESULT(uri_lib); 434 CHECK_RESULT(uri_lib);
433 Dart_Handle builtin_lib = Builtin::LoadLibrary(Builtin::kBuiltinLibrary); 435 Dart_Handle builtin_lib =
436 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary);
434 CHECK_RESULT(builtin_lib); 437 CHECK_RESULT(builtin_lib);
435 438
436 // Prepare for script loading by setting up the 'print' and 'timer' 439 // Prepare for script loading by setting up the 'print' and 'timer'
437 // closures and setting up 'package root' for URI resolution. 440 // closures and setting up 'package root' for URI resolution.
438 result = DartUtils::PrepareForScriptLoading(package_root, builtin_lib); 441 result = DartUtils::PrepareForScriptLoading(package_root, builtin_lib);
439 CHECK_RESULT(result); 442 CHECK_RESULT(result);
440 443
441 library = DartUtils::LoadScript(script_uri, resolve_script, builtin_lib); 444 library = DartUtils::LoadScript(script_uri, resolve_script, builtin_lib);
442 } 445 }
443 CHECK_RESULT(library); 446 CHECK_RESULT(library);
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 Dart_ExitScope(); 663 Dart_ExitScope();
661 // Dump symbol information for the profiler. 664 // Dump symbol information for the profiler.
662 DumpPprofSymbolInfo(); 665 DumpPprofSymbolInfo();
663 // Shutdown the isolate. 666 // Shutdown the isolate.
664 Dart_ShutdownIsolate(); 667 Dart_ShutdownIsolate();
665 // Terminate process exit-code handler. 668 // Terminate process exit-code handler.
666 Process::TerminateExitCodeHandler(); 669 Process::TerminateExitCodeHandler();
667 670
668 return 0; 671 return 0;
669 } 672 }
OLDNEW
« no previous file with comments | « runtime/bin/gen_snapshot.cc ('k') | runtime/vm/unit_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698