Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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_impl.h" | 5 #include "bin/vmservice_impl.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 | 8 |
| 9 #include "bin/builtin.h" | 9 #include "bin/builtin.h" |
| 10 #include "bin/dartutils.h" | 10 #include "bin/dartutils.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 static ResourcesEntry* ResourcesTable() { | 79 static ResourcesEntry* ResourcesTable() { |
| 80 return &__service_bin_resources_[0]; | 80 return &__service_bin_resources_[0]; |
| 81 } | 81 } |
| 82 | 82 |
| 83 DISALLOW_ALLOCATION(); | 83 DISALLOW_ALLOCATION(); |
| 84 DISALLOW_IMPLICIT_CONSTRUCTORS(Resources); | 84 DISALLOW_IMPLICIT_CONSTRUCTORS(Resources); |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 const char* VmService::error_msg_ = NULL; | 87 const char* VmService::error_msg_ = NULL; |
| 88 | 88 |
| 89 static void* embedder_request_callback_user_data = reinterpret_cast<void*>(0x3); | |
| 90 | |
| 91 static const char* embedder_request_callback(const char* name, | |
| 92 const char** arguments, | |
| 93 intptr_t num_arguments, | |
| 94 const char** option_keys, | |
| 95 const char** option_values, | |
| 96 intptr_t num_options, | |
| 97 void* user_data) { | |
| 98 ASSERT(user_data == embedder_request_callback_user_data); | |
| 99 return strdup("{\"type\": \"EmbedderString\",\"value\":\"Standalone\"}"); | |
|
turnidge
2014/02/18 21:27:05
Maybe Embedder or EmbedderId instead of EmbedderSt
Cutch
2014/02/18 22:18:51
Done.
| |
| 100 } | |
| 101 | |
| 102 | |
| 89 bool VmService::Start(intptr_t server_port) { | 103 bool VmService::Start(intptr_t server_port) { |
| 90 bool r = _Start(server_port); | 104 bool r = _Start(server_port); |
| 91 if (!r) { | 105 if (!r) { |
| 92 return r; | 106 return r; |
| 93 } | 107 } |
| 108 // Register an embedder provided request callback. | |
| 109 Dart_RegisterServiceRequestCallback( | |
| 110 "_embedder", | |
| 111 embedder_request_callback, | |
| 112 embedder_request_callback_user_data); | |
| 94 // Start processing messages in a new thread. | 113 // Start processing messages in a new thread. |
| 95 dart::Thread::Start(ThreadMain, NULL); | 114 dart::Thread::Start(ThreadMain, NULL); |
| 96 return true; | 115 return true; |
| 97 } | 116 } |
| 98 | 117 |
| 99 | 118 |
| 100 bool VmService::_Start(intptr_t server_port) { | 119 bool VmService::_Start(intptr_t server_port) { |
| 101 ASSERT(Dart_CurrentIsolate() == NULL); | 120 ASSERT(Dart_CurrentIsolate() == NULL); |
| 102 Dart_Isolate isolate = Dart_GetServiceIsolate(NULL); | 121 Dart_Isolate isolate = Dart_GetServiceIsolate(NULL); |
| 103 if (isolate == NULL) { | 122 if (isolate == NULL) { |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 274 printf("Service exited with an error:\n%s\n", Dart_GetError(result)); | 293 printf("Service exited with an error:\n%s\n", Dart_GetError(result)); |
| 275 } | 294 } |
| 276 Dart_ExitScope(); | 295 Dart_ExitScope(); |
| 277 Dart_ExitIsolate(); | 296 Dart_ExitIsolate(); |
| 278 } | 297 } |
| 279 | 298 |
| 280 | 299 |
| 281 | 300 |
| 282 } // namespace bin | 301 } // namespace bin |
| 283 } // namespace dart | 302 } // namespace dart |
| OLD | NEW |