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

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

Issue 10532123: - Move the Timer interface to the dart:isolate library so that it (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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
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 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 Dart_Isolate isolate = 498 Dart_Isolate isolate =
499 Dart_CreateIsolate(script_uri, main, snapshot_buffer, data, error); 499 Dart_CreateIsolate(script_uri, main, snapshot_buffer, data, error);
500 if (isolate == NULL) { 500 if (isolate == NULL) {
501 return false; 501 return false;
502 } 502 }
503 503
504 Dart_EnterScope(); 504 Dart_EnterScope();
505 505
506 if (snapshot_buffer != NULL) { 506 if (snapshot_buffer != NULL) {
507 // Setup the native resolver as the snapshot does not carry it. 507 // Setup the native resolver as the snapshot does not carry it.
508 Builtin::SetNativeResolver(Builtin::kBuiltinLibrary); 508 Builtin::SetupLibrary(Builtin::LoadLibrary(Builtin::kBuiltinLibrary),
509 Builtin::SetNativeResolver(Builtin::kIOLibrary); 509 Builtin::kBuiltinLibrary);
510 Builtin::SetupLibrary(Builtin::LoadLibrary(Builtin::kIOLibrary),
511 Builtin::kIOLibrary);
siva 2012/06/13 17:05:23 I would prefer if we did a Dart_LookupLibrary here
Ivan Posva 2012/06/21 16:17:06 Agreed, but this needs a whole restructuring of th
510 } 512 }
511 513
512 // Set up the library tag handler for this isolate. 514 // Set up the library tag handler for this isolate.
513 Dart_Handle result = Dart_SetLibraryTagHandler(LibraryTagHandler); 515 Dart_Handle result = Dart_SetLibraryTagHandler(LibraryTagHandler);
514 if (Dart_IsError(result)) { 516 if (Dart_IsError(result)) {
515 *error = strdup(Dart_GetError(result)); 517 *error = strdup(Dart_GetError(result));
516 Dart_ExitScope(); 518 Dart_ExitScope();
517 Dart_ShutdownIsolate(); 519 Dart_ShutdownIsolate();
518 return false; 520 return false;
519 } 521 }
(...skipping 16 matching lines...) Expand all
536 return false; 538 return false;
537 } 539 }
538 Dart_Handle builtin_lib = Builtin::LoadLibrary(Builtin::kBuiltinLibrary); 540 Dart_Handle builtin_lib = Builtin::LoadLibrary(Builtin::kBuiltinLibrary);
539 if (Dart_IsError(builtin_lib)) { 541 if (Dart_IsError(builtin_lib)) {
540 *error = strdup(Dart_GetError(builtin_lib)); 542 *error = strdup(Dart_GetError(builtin_lib));
541 Dart_ExitScope(); 543 Dart_ExitScope();
542 Dart_ShutdownIsolate(); 544 Dart_ShutdownIsolate();
543 return false; 545 return false;
544 } 546 }
545 547
548 // Setup the IO library.
549 Dart_Handle io_lib = Builtin::LoadLibrary(Builtin::kIOLibrary);
550 Builtin::SetupIOLibrary(io_lib);
551
546 if (package_root != NULL) { 552 if (package_root != NULL) {
547 const int kNumArgs = 1; 553 const int kNumArgs = 1;
548 Dart_Handle dart_args[kNumArgs]; 554 Dart_Handle dart_args[kNumArgs];
549 555
550 Dart_Handle handle = Dart_NewString(package_root); 556 Dart_Handle handle = Dart_NewString(package_root);
551 if (Dart_IsError(handle)) { 557 if (Dart_IsError(handle)) {
552 *error = strdup(Dart_GetError(handle)); 558 *error = strdup(Dart_GetError(handle));
553 Dart_ExitScope(); 559 Dart_ExitScope();
554 Dart_ShutdownIsolate(); 560 Dart_ShutdownIsolate();
555 return false; 561 return false;
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 DumpPprofSymbolInfo(); 788 DumpPprofSymbolInfo();
783 // Shutdown the isolate. 789 // Shutdown the isolate.
784 Dart_ShutdownIsolate(); 790 Dart_ShutdownIsolate();
785 // Terminate process exit-code handler. 791 // Terminate process exit-code handler.
786 Process::TerminateExitCodeHandler(); 792 Process::TerminateExitCodeHandler();
787 793
788 free(const_cast<char*>(original_working_directory)); 794 free(const_cast<char*>(original_working_directory));
789 795
790 return 0; 796 return 0;
791 } 797 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698