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

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

Issue 1130753006: Hide Isolate pointer from embedder (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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
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 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 ASSERT(script_uri != NULL); 585 ASSERT(script_uri != NULL);
586 IsolateData* isolate_data = new IsolateData(script_uri, package_root); 586 IsolateData* isolate_data = new IsolateData(script_uri, package_root);
587 Dart_Isolate isolate = NULL; 587 Dart_Isolate isolate = NULL;
588 588
589 isolate = Dart_CreateIsolate(script_uri, 589 isolate = Dart_CreateIsolate(script_uri,
590 main, 590 main,
591 isolate_snapshot_buffer, 591 isolate_snapshot_buffer,
592 isolate_data, 592 isolate_data,
593 error); 593 error);
594 594
595 if (isolate == NULL) { 595 if (isolate == ILLEGAL_ISOLATE) {
596 return NULL; 596 return ILLEGAL_ISOLATE;
597 } 597 }
598 598
599 Dart_EnterScope(); 599 Dart_EnterScope();
600 600
601 if (isolate_snapshot_buffer != NULL) { 601 if (isolate_snapshot_buffer != NULL) {
602 // Setup the native resolver as the snapshot does not carry it. 602 // Setup the native resolver as the snapshot does not carry it.
603 Builtin::SetNativeResolver(Builtin::kBuiltinLibrary); 603 Builtin::SetNativeResolver(Builtin::kBuiltinLibrary);
604 Builtin::SetNativeResolver(Builtin::kIOLibrary); 604 Builtin::SetNativeResolver(Builtin::kIOLibrary);
605 } 605 }
606 606
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 // Call CreateIsolateAndSetup which creates an isolate and loads up 988 // Call CreateIsolateAndSetup which creates an isolate and loads up
989 // the specified application script. 989 // the specified application script.
990 char* error = NULL; 990 char* error = NULL;
991 int exit_code = 0; 991 int exit_code = 0;
992 char* isolate_name = BuildIsolateName(script_name, "main"); 992 char* isolate_name = BuildIsolateName(script_name, "main");
993 Dart_Isolate isolate = CreateIsolateAndSetupHelper(script_name, 993 Dart_Isolate isolate = CreateIsolateAndSetupHelper(script_name,
994 "main", 994 "main",
995 commandline_package_root, 995 commandline_package_root,
996 &error, 996 &error,
997 &exit_code); 997 &exit_code);
998 if (isolate == NULL) { 998 if (isolate == ILLEGAL_ISOLATE) {
999 Log::PrintErr("%s\n", error); 999 Log::PrintErr("%s\n", error);
1000 free(error); 1000 free(error);
1001 delete [] isolate_name; 1001 delete [] isolate_name;
1002 exit((exit_code != 0) ? exit_code : kErrorExitCode); 1002 exit((exit_code != 0) ? exit_code : kErrorExitCode);
1003 } 1003 }
1004 delete [] isolate_name; 1004 delete [] isolate_name;
1005 1005
1006 Dart_EnterIsolate(isolate); 1006 Dart_EnterIsolate(isolate);
1007 ASSERT(isolate == Dart_CurrentIsolate()); 1007 ASSERT(isolate == Dart_CurrentIsolate());
1008 ASSERT(isolate != NULL); 1008 ASSERT(isolate != ILLEGAL_ISOLATE);
1009 Dart_Handle result; 1009 Dart_Handle result;
1010 1010
1011 Dart_EnterScope(); 1011 Dart_EnterScope();
1012 1012
1013 if (generate_script_snapshot) { 1013 if (generate_script_snapshot) {
1014 // First create a snapshot. 1014 // First create a snapshot.
1015 Dart_Handle result; 1015 Dart_Handle result;
1016 uint8_t* buffer = NULL; 1016 uint8_t* buffer = NULL;
1017 intptr_t size = 0; 1017 intptr_t size = 0;
1018 result = Dart_CreateScriptSnapshot(&buffer, &size); 1018 result = Dart_CreateScriptSnapshot(&buffer, &size);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 exit(Process::GlobalExitCode()); 1123 exit(Process::GlobalExitCode());
1124 } 1124 }
1125 1125
1126 } // namespace bin 1126 } // namespace bin
1127 } // namespace dart 1127 } // namespace dart
1128 1128
1129 int main(int argc, char** argv) { 1129 int main(int argc, char** argv) {
1130 dart::bin::main(argc, argv); 1130 dart::bin::main(argc, argv);
1131 UNREACHABLE(); 1131 UNREACHABLE();
1132 } 1132 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698