| 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" |
| 11 #include "bin/thread.h" | 11 #include "bin/thread.h" |
| 12 #include "bin/utils.h" |
| 12 #include "bin/vmservice_impl.h" | 13 #include "bin/vmservice_impl.h" |
| 13 #include "zlib/zlib.h" | 14 #include "zlib/zlib.h" |
| 14 | 15 |
| 15 namespace dart { | 16 namespace dart { |
| 16 namespace bin { | 17 namespace bin { |
| 17 | 18 |
| 18 #define CHECK_RESULT(result) \ | 19 #define CHECK_RESULT(result) \ |
| 19 if (Dart_IsError(result)) { \ | 20 if (Dart_IsError(result)) { \ |
| 20 fprintf(stderr, "CHECK_RESULT failed: %s", Dart_GetError(result)); \ | 21 fprintf(stderr, "CHECK_RESULT failed: %s", Dart_GetError(result)); \ |
| 21 Dart_ExitScope(); \ | 22 Dart_ExitScope(); \ |
| 22 Dart_ShutdownIsolate(); \ | 23 Dart_ShutdownIsolate(); \ |
| 23 return 0; \ | 24 return 0; \ |
| 24 } \ | 25 } \ |
| 25 | 26 |
| 26 | 27 |
| 27 | 28 |
| 28 static const char* DEFAULT_VM_SERVICE_SERVER_IP = "127.0.0.1"; | 29 static const char* DEFAULT_VM_SERVICE_SERVER_IP = "127.0.0.1"; |
| 29 static const int DEFAULT_VM_SERVICE_SERVER_PORT = 0; | 30 static const int DEFAULT_VM_SERVICE_SERVER_PORT = 0; |
| 30 | 31 |
| 31 void VmServiceServer::Bootstrap() { | 32 void VmServiceServer::Bootstrap() { |
| 32 if (!Platform::Initialize()) { | 33 if (!Platform::Initialize()) { |
| 33 fprintf(stderr, "Platform::Initialize() failed\n"); | 34 fprintf(stderr, "Platform::Initialize() failed\n"); |
| 34 } | 35 } |
| 35 DartUtils::SetOriginalWorkingDirectory(); | 36 DartUtils::SetOriginalWorkingDirectory(); |
| 36 Thread::InitOnce(); | 37 Thread::InitOnce(); |
| 38 TimerUtils::InitOnce(); |
| 37 EventHandler::Start(); | 39 EventHandler::Start(); |
| 38 } | 40 } |
| 39 | 41 |
| 40 | 42 |
| 41 Dart_Isolate VmServiceServer::CreateIsolate(const uint8_t* snapshot_buffer) { | 43 Dart_Isolate VmServiceServer::CreateIsolate(const uint8_t* snapshot_buffer) { |
| 42 ASSERT(snapshot_buffer != NULL); | 44 ASSERT(snapshot_buffer != NULL); |
| 43 // Create the isolate. | 45 // Create the isolate. |
| 44 char* error = 0; | 46 char* error = 0; |
| 45 Dart_Isolate isolate = Dart_CreateIsolate(DART_VM_SERVICE_ISOLATE_NAME, | 47 Dart_Isolate isolate = Dart_CreateIsolate(DART_VM_SERVICE_ISOLATE_NAME, |
| 46 "main", | 48 "main", |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 } | 158 } |
| 157 | 159 |
| 158 /* DISALLOW_ALLOCATION */ | 160 /* DISALLOW_ALLOCATION */ |
| 159 void VmServiceServer::operator delete(void* pointer) { | 161 void VmServiceServer::operator delete(void* pointer) { |
| 160 fprintf(stderr, "unreachable code\n"); | 162 fprintf(stderr, "unreachable code\n"); |
| 161 abort(); | 163 abort(); |
| 162 } | 164 } |
| 163 | 165 |
| 164 } // namespace bin | 166 } // namespace bin |
| 165 } // namespace dart | 167 } // namespace dart |
| OLD | NEW |