Index: runtime/vm/dart_api_impl.cc |
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc |
index 02cf5125698ae4a8372245e1c68895dff208071e..a0eda6918df779112e6a0a5e99488a8860919138 100644 |
--- a/runtime/vm/dart_api_impl.cc |
+++ b/runtime/vm/dart_api_impl.cc |
@@ -27,6 +27,7 @@ |
#include "vm/port.h" |
#include "vm/resolver.h" |
#include "vm/reusable_handles.h" |
+#include "vm/service.h" |
#include "vm/stack_frame.h" |
#include "vm/symbols.h" |
#include "vm/timer.h" |
@@ -793,10 +794,12 @@ DART_EXPORT bool Dart_Initialize( |
Dart_FileReadCallback file_read, |
Dart_FileWriteCallback file_write, |
Dart_FileCloseCallback file_close, |
- Dart_EntropySource entropy_source) { |
+ Dart_EntropySource entropy_source, |
+ Dart_ServiceIsolateCreateCallback service_create) { |
const char* err_msg = Dart::InitOnce(create, interrupt, unhandled, shutdown, |
file_open, file_read, file_write, |
- file_close, entropy_source); |
+ file_close, entropy_source, |
+ service_create); |
if (err_msg != NULL) { |
OS::PrintErr("Dart_Initialize: %s\n", err_msg); |
return false; |
@@ -1169,6 +1172,33 @@ DART_EXPORT Dart_Port Dart_GetMainPortId() { |
} |
+DART_EXPORT bool Dart_IsSendPort(Dart_Handle send_port) { |
+ Isolate* isolate = Isolate::Current(); |
+ DARTSCOPE(isolate); |
+ Instance& port = Instance::Handle(); |
+ port ^= Api::UnwrapHandle(send_port); |
+ return DartLibraryCalls::IsSendPort(port); |
+} |
+ |
+ |
+DART_EXPORT bool Dart_SendPortSend(Dart_Handle send_port, Dart_Handle object) { |
siva
2014/01/10 00:01:54
Dart_Handle Dart_PostMessage(....)
This function
|
+ Isolate* isolate = Isolate::Current(); |
+ DARTSCOPE(isolate); |
+ Instance& port_instance = Instance::Handle(); |
+ port_instance ^= Api::UnwrapHandle(send_port); |
+ const Object& idObj = Object::Handle( |
+ DartLibraryCalls::PortGetId(port_instance)); |
+ if (idObj.IsError()) { |
+ // Not a valid port. |
+ return false; |
+ } |
+ Integer& id = Integer::Handle(); |
+ id ^= idObj.raw(); |
+ Dart_Port port = static_cast<Dart_Port>(id.AsInt64Value()); |
+ return Dart_Post(port, object); |
+} |
+ |
+ |
// --- Scopes ---- |
DART_EXPORT void Dart_EnterScope() { |
@@ -4495,4 +4525,23 @@ DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void* peer) { |
return Api::Success(); |
} |
+ |
+// --- Service support --- |
+ |
+DART_EXPORT Dart_Isolate Dart_GetServiceIsolate(void* callback_data) { |
+ return Api::CastIsolate(Service::GetServiceIsolate(callback_data)); |
+} |
+ |
+ |
+DART_EXPORT void Dart_RegisterWithService() { |
+ CHECK_ISOLATE(Isolate::Current()); |
+ Service::SendIsolateStartupMessage(); |
+} |
+ |
+ |
+DART_EXPORT void Dart_UnregisterFromService() { |
+ CHECK_ISOLATE(Isolate::Current()); |
+ Service::SendIsolateShutdownMessage(); |
+} |
+ |
} // namespace dart |