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

Side by Side Diff: runtime/vm/dart_api_impl.cc

Issue 889443002: Service isolate rework take 2 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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
« no previous file with comments | « runtime/vm/dart.cc ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "include/dart_api.h" 5 #include "include/dart_api.h"
6 #include "include/dart_mirrors_api.h" 6 #include "include/dart_mirrors_api.h"
7 #include "include/dart_native_api.h" 7 #include "include/dart_native_api.h"
8 8
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 1197
1198 DART_EXPORT bool Dart_Initialize( 1198 DART_EXPORT bool Dart_Initialize(
1199 Dart_IsolateCreateCallback create, 1199 Dart_IsolateCreateCallback create,
1200 Dart_IsolateInterruptCallback interrupt, 1200 Dart_IsolateInterruptCallback interrupt,
1201 Dart_IsolateUnhandledExceptionCallback unhandled, 1201 Dart_IsolateUnhandledExceptionCallback unhandled,
1202 Dart_IsolateShutdownCallback shutdown, 1202 Dart_IsolateShutdownCallback shutdown,
1203 Dart_FileOpenCallback file_open, 1203 Dart_FileOpenCallback file_open,
1204 Dart_FileReadCallback file_read, 1204 Dart_FileReadCallback file_read,
1205 Dart_FileWriteCallback file_write, 1205 Dart_FileWriteCallback file_write,
1206 Dart_FileCloseCallback file_close, 1206 Dart_FileCloseCallback file_close,
1207 Dart_EntropySource entropy_source, 1207 Dart_EntropySource entropy_source) {
1208 Dart_ServiceIsolateCreateCalback service_create) {
1209 const char* err_msg = Dart::InitOnce(create, interrupt, unhandled, shutdown, 1208 const char* err_msg = Dart::InitOnce(create, interrupt, unhandled, shutdown,
1210 file_open, file_read, file_write, 1209 file_open, file_read, file_write,
1211 file_close, entropy_source, 1210 file_close, entropy_source);
1212 service_create);
1213 if (err_msg != NULL) { 1211 if (err_msg != NULL) {
1214 OS::PrintErr("Dart_Initialize: %s\n", err_msg); 1212 OS::PrintErr("Dart_Initialize: %s\n", err_msg);
1215 return false; 1213 return false;
1216 } 1214 }
1217 return true; 1215 return true;
1218 } 1216 }
1219 1217
1220 1218
1221 DART_EXPORT bool Dart_Cleanup() { 1219 DART_EXPORT bool Dart_Cleanup() {
1222 CHECK_NO_ISOLATE(Isolate::Current()); 1220 CHECK_NO_ISOLATE(Isolate::Current());
(...skipping 22 matching lines...) Expand all
1245 const char* main) { 1243 const char* main) {
1246 if (script_uri == NULL) { 1244 if (script_uri == NULL) {
1247 // Just use the main as the name. 1245 // Just use the main as the name.
1248 if (main == NULL) { 1246 if (main == NULL) {
1249 return strdup("isolate"); 1247 return strdup("isolate");
1250 } else { 1248 } else {
1251 return strdup(main); 1249 return strdup(main);
1252 } 1250 }
1253 } 1251 }
1254 1252
1253 if (Service::IsServiceIsolateName(script_uri)) {
1254 return strdup(script_uri);
1255 }
1256
1255 // Skip past any slashes and backslashes in the script uri. 1257 // Skip past any slashes and backslashes in the script uri.
1256 const char* last_slash = strrchr(script_uri, '/'); 1258 const char* last_slash = strrchr(script_uri, '/');
1257 if (last_slash != NULL) { 1259 if (last_slash != NULL) {
1258 script_uri = last_slash + 1; 1260 script_uri = last_slash + 1;
1259 } 1261 }
1260 const char* last_backslash = strrchr(script_uri, '\\'); 1262 const char* last_backslash = strrchr(script_uri, '\\');
1261 if (last_backslash != NULL) { 1263 if (last_backslash != NULL) {
1262 script_uri = last_backslash + 1; 1264 script_uri = last_backslash + 1;
1263 } 1265 }
1264 if (main == NULL) { 1266 if (main == NULL) {
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1514 ml.Wait(); 1516 ml.Wait();
1515 } 1517 }
1516 } 1518 }
1517 if (isolate->object_store()->sticky_error() != Object::null()) { 1519 if (isolate->object_store()->sticky_error() != Object::null()) {
1518 Dart_Handle error = Api::NewHandle(isolate, 1520 Dart_Handle error = Api::NewHandle(isolate,
1519 isolate->object_store()->sticky_error()); 1521 isolate->object_store()->sticky_error());
1520 isolate->object_store()->clear_sticky_error(); 1522 isolate->object_store()->clear_sticky_error();
1521 return error; 1523 return error;
1522 } 1524 }
1523 if (FLAG_print_class_table) { 1525 if (FLAG_print_class_table) {
1526 HANDLESCOPE(isolate);
1524 isolate->class_table()->Print(); 1527 isolate->class_table()->Print();
1525 } 1528 }
1526 return Api::Success(); 1529 return Api::Success();
1527 } 1530 }
1528 1531
1529 1532
1530 DART_EXPORT Dart_Handle Dart_HandleMessage() { 1533 DART_EXPORT Dart_Handle Dart_HandleMessage() {
1531 Isolate* isolate = Isolate::Current(); 1534 Isolate* isolate = Isolate::Current();
1532 CHECK_ISOLATE_SCOPE(isolate); 1535 CHECK_ISOLATE_SCOPE(isolate);
1533 CHECK_CALLBACK_STATE(isolate); 1536 CHECK_CALLBACK_STATE(isolate);
(...skipping 3865 matching lines...) Expand 10 before | Expand all | Expand 10 after
5399 NoGCScope no_gc; 5402 NoGCScope no_gc;
5400 RawObject* raw_obj = obj.raw(); 5403 RawObject* raw_obj = obj.raw();
5401 isolate->heap()->SetPeer(raw_obj, peer); 5404 isolate->heap()->SetPeer(raw_obj, peer);
5402 } 5405 }
5403 return Api::Success(); 5406 return Api::Success();
5404 } 5407 }
5405 5408
5406 5409
5407 // --- Service support --- 5410 // --- Service support ---
5408 5411
5409 DART_EXPORT Dart_Isolate Dart_GetServiceIsolate(void* callback_data) { 5412 DART_EXPORT bool Dart_IsServiceIsolate(Dart_Isolate isolate) {
5410 return Api::CastIsolate(Service::GetServiceIsolate(callback_data)); 5413 Isolate* iso = reinterpret_cast<Isolate*>(isolate);
5414 return Service::IsServiceIsolate(iso);
5411 } 5415 }
5412 5416
5413 5417
5414 DART_EXPORT bool Dart_IsServiceRunning() { 5418 DART_EXPORT Dart_Port Dart_ServiceWaitForLoadPort() {
5415 return Service::IsRunning(); 5419 return Service::WaitForLoadPort();
5416 } 5420 }
5417 5421
5418 5422
5419 DART_EXPORT void Dart_RegisterIsolateServiceRequestCallback( 5423 DART_EXPORT void Dart_RegisterIsolateServiceRequestCallback(
5420 const char* name, 5424 const char* name,
5421 Dart_ServiceRequestCallback callback, 5425 Dart_ServiceRequestCallback callback,
5422 void* user_data) { 5426 void* user_data) {
5423 Service::RegisterIsolateEmbedderCallback(name, callback, user_data); 5427 Service::RegisterIsolateEmbedderCallback(name, callback, user_data);
5424 } 5428 }
5425 5429
5426 5430
5427 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( 5431 DART_EXPORT void Dart_RegisterRootServiceRequestCallback(
5428 const char* name, 5432 const char* name,
5429 Dart_ServiceRequestCallback callback, 5433 Dart_ServiceRequestCallback callback,
5430 void* user_data) { 5434 void* user_data) {
5431 Service::RegisterRootEmbedderCallback(name, callback, user_data); 5435 Service::RegisterRootEmbedderCallback(name, callback, user_data);
5432 } 5436 }
5433 5437
5434 } // namespace dart 5438 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart.cc ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698