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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 359673002: - Remove Dart_ReceivePortGetId, Dart_GetReceivePort and Dart_PostMessage. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/custom_isolate_test.cc ('k') | runtime/vm/snapshot_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl.cc
===================================================================
--- runtime/vm/dart_api_impl.cc (revision 37823)
+++ runtime/vm/dart_api_impl.cc (working copy)
@@ -1580,50 +1580,23 @@
}
-DART_EXPORT Dart_Handle Dart_ReceivePortGetId(Dart_Handle port,
- Dart_Port* port_id) {
+DART_EXPORT Dart_Handle Dart_SendPortGetId(Dart_Handle port,
+ Dart_Port* port_id) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
CHECK_CALLBACK_STATE(isolate);
- const ReceivePort& receive_port = Api::UnwrapReceivePortHandle(isolate, port);
- if (receive_port.IsNull()) {
- RETURN_TYPE_ERROR(isolate, port, ReceivePort);
+ const SendPort& send_port = Api::UnwrapSendPortHandle(isolate, port);
+ if (send_port.IsNull()) {
+ RETURN_TYPE_ERROR(isolate, port, SendPort);
}
if (port_id == NULL) {
RETURN_NULL_ERROR(port_id);
}
- *port_id = receive_port.Id();
+ *port_id = send_port.Id();
return Api::Success();
}
-DART_EXPORT Dart_Handle Dart_GetReceivePort(Dart_Port port_id) {
- Isolate* isolate = Isolate::Current();
- DARTSCOPE(isolate);
- CHECK_CALLBACK_STATE(isolate);
-
- Library& isolate_lib = Library::Handle(isolate, Library::IsolateLibrary());
- ASSERT(!isolate_lib.IsNull());
- const String& class_name = String::Handle(
- isolate, isolate_lib.PrivateName(Symbols::_RawReceivePortImpl()));
- // TODO(asiva): Symbols should contain private keys.
- const String& function_name =
- String::Handle(isolate_lib.PrivateName(Symbols::_get()));
- const int kNumArguments = 1;
- const Function& function = Function::Handle(
- isolate,
- Resolver::ResolveStatic(isolate_lib,
- class_name,
- function_name,
- kNumArguments,
- Object::empty_array()));
- ASSERT(!function.IsNull());
- const Array& args = Array::Handle(isolate, Array::New(kNumArguments));
- args.SetAt(0, Integer::Handle(isolate, Integer::New(port_id)));
- return Api::NewHandle(isolate, DartEntry::InvokeFunction(function, args));
-}
-
-
DART_EXPORT Dart_Port Dart_GetMainPortId() {
Isolate* isolate = Isolate::Current();
CHECK_ISOLATE(isolate);
@@ -1631,28 +1604,6 @@
}
-DART_EXPORT Dart_Handle Dart_PostMessage(Dart_Handle port,
- Dart_Handle object) {
- Isolate* isolate = Isolate::Current();
- DARTSCOPE(isolate);
- const SendPort& send_port = Api::UnwrapSendPortHandle(isolate, port);
- if (send_port.IsNull()) {
- RETURN_TYPE_ERROR(isolate, port, SendPort);
- }
- Dart_Port port_id = send_port.Id();
- uint8_t* data = NULL;
- MessageWriter writer(&data, &allocator);
- Object& msg_object = Object::Handle(Api::UnwrapHandle(object));
- writer.WriteMessage(msg_object);
- intptr_t len = writer.BytesWritten();
- bool r = PortMap::PostMessage(
- new Message(port_id, data, len, Message::kNormalPriority));
- if (r) {
- return Api::Success();
- }
- return Api::NewError("Dart_PostMessage failed.");
-}
-
// --- Scopes ----
DART_EXPORT void Dart_EnterScope() {
« no previous file with comments | « runtime/vm/custom_isolate_test.cc ('k') | runtime/vm/snapshot_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698