| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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/vmservice_dartium.h" | 5 #include "bin/vmservice_dartium.h" |
| 6 | 6 |
| 7 #include "bin/builtin.h" | 7 #include "bin/builtin.h" |
| 8 #include "bin/dartutils.h" | 8 #include "bin/dartutils.h" |
| 9 #include "bin/eventhandler.h" | 9 #include "bin/eventhandler.h" |
| 10 #include "bin/platform.h" | 10 #include "bin/platform.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 DartUtils::SetOriginalWorkingDirectory(); | 36 DartUtils::SetOriginalWorkingDirectory(); |
| 37 Thread::InitOnce(); | 37 Thread::InitOnce(); |
| 38 TimerUtils::InitOnce(); | 38 TimerUtils::InitOnce(); |
| 39 EventHandler::Start(); | 39 EventHandler::Start(); |
| 40 } | 40 } |
| 41 | 41 |
| 42 | 42 |
| 43 Dart_Isolate VmServiceServer::CreateIsolate(const uint8_t* snapshot_buffer) { | 43 Dart_Isolate VmServiceServer::CreateIsolate(const uint8_t* snapshot_buffer) { |
| 44 ASSERT(snapshot_buffer != NULL); | 44 ASSERT(snapshot_buffer != NULL); |
| 45 // Create the isolate. | 45 // Create the isolate. |
| 46 IsolateData* isolate_data = new IsolateData(DART_VM_SERVICE_ISOLATE_NAME, |
| 47 NULL, |
| 48 NULL); |
| 46 char* error = 0; | 49 char* error = 0; |
| 47 Dart_Isolate isolate = Dart_CreateIsolate(DART_VM_SERVICE_ISOLATE_NAME, | 50 Dart_Isolate isolate = Dart_CreateIsolate(DART_VM_SERVICE_ISOLATE_NAME, |
| 48 "main", | 51 "main", |
| 49 snapshot_buffer, | 52 snapshot_buffer, |
| 50 NULL, | 53 NULL, |
| 51 NULL, | 54 isolate_data, |
| 52 &error); | 55 &error); |
| 53 if (!isolate) { | 56 if (!isolate) { |
| 54 fprintf(stderr, "Dart_CreateIsolate failed: %s\n", error); | 57 fprintf(stderr, "Dart_CreateIsolate failed: %s\n", error); |
| 55 return 0; | 58 return 0; |
| 56 } | 59 } |
| 57 | 60 |
| 58 Dart_EnterScope(); | 61 Dart_EnterScope(); |
| 59 Builtin::SetNativeResolver(Builtin::kBuiltinLibrary); | 62 Builtin::SetNativeResolver(Builtin::kBuiltinLibrary); |
| 60 Builtin::SetNativeResolver(Builtin::kIOLibrary); | 63 Builtin::SetNativeResolver(Builtin::kIOLibrary); |
| 61 | 64 |
| 62 Dart_Handle builtin_lib = | |
| 63 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary); | |
| 64 CHECK_RESULT(builtin_lib); | |
| 65 | |
| 66 Dart_Handle result; | 65 Dart_Handle result; |
| 67 | 66 |
| 68 // Prepare for script loading by setting up the 'print' and 'timer' | 67 // Prepare for script loading by setting up the 'print' and 'timer' |
| 69 // closures and setting up 'package root' for URI resolution. | 68 // closures and setting up 'package root' for URI resolution. |
| 70 result = DartUtils::PrepareForScriptLoading( | 69 result = DartUtils::PrepareForScriptLoading(true, false); |
| 71 NULL, NULL, true, false, builtin_lib); | |
| 72 CHECK_RESULT(result); | 70 CHECK_RESULT(result); |
| 73 | 71 |
| 74 ASSERT(Dart_IsServiceIsolate(isolate)); | 72 ASSERT(Dart_IsServiceIsolate(isolate)); |
| 75 if (!VmService::Setup(DEFAULT_VM_SERVICE_SERVER_IP, | 73 if (!VmService::Setup(DEFAULT_VM_SERVICE_SERVER_IP, |
| 76 DEFAULT_VM_SERVICE_SERVER_PORT, | 74 DEFAULT_VM_SERVICE_SERVER_PORT, |
| 77 false /* running_precompiled */)) { | 75 false /* running_precompiled */)) { |
| 78 fprintf(stderr, | 76 fprintf(stderr, |
| 79 "Vmservice::Setup failed: %s\n", VmService::GetErrorMessage()); | 77 "Vmservice::Setup failed: %s\n", VmService::GetErrorMessage()); |
| 80 isolate = NULL; | 78 isolate = NULL; |
| 81 } | 79 } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 } | 156 } |
| 159 | 157 |
| 160 /* DISALLOW_ALLOCATION */ | 158 /* DISALLOW_ALLOCATION */ |
| 161 void VmServiceServer::operator delete(void* pointer) { | 159 void VmServiceServer::operator delete(void* pointer) { |
| 162 fprintf(stderr, "unreachable code\n"); | 160 fprintf(stderr, "unreachable code\n"); |
| 163 abort(); | 161 abort(); |
| 164 } | 162 } |
| 165 | 163 |
| 166 } // namespace bin | 164 } // namespace bin |
| 167 } // namespace dart | 165 } // namespace dart |
| OLD | NEW |