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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 196443009: - First step in refactoring ports with the goal of moving (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 9 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/dart_api_impl.h ('k') | runtime/vm/dart_entry.h » ('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 34429)
+++ runtime/vm/dart_api_impl.cc (working copy)
@@ -1189,6 +1189,27 @@
}
+DART_EXPORT Dart_Handle Dart_PortGetId(Dart_Handle port, Dart_Port* port_id) {
+ Isolate* isolate = Isolate::Current();
+ DARTSCOPE(isolate);
+ CHECK_CALLBACK_STATE(isolate);
+ const Instance& port_instance = Api::UnwrapInstanceHandle(isolate, port);
+ if (port_instance.IsNull()) {
+ RETURN_TYPE_ERROR(isolate, port, Instance);
+ }
+ if (!DartLibraryCalls::IsSendPort(port_instance) &&
+ !DartLibraryCalls::IsReceivePort(port_instance)) {
+ return Api::NewError("expected an instance of RawReceivePort or SendPort.");
+ }
+ const Object& idObj = Object::Handle(
+ DartLibraryCalls::PortGetId(port_instance));
+ ASSERT(idObj.IsInteger());
+ const Integer& id = Integer::Cast(idObj);
+ *port_id = static_cast<Dart_Port>(id.AsInt64Value());
+ return Api::Success();
+}
+
+
DART_EXPORT Dart_Handle Dart_GetReceivePort(Dart_Port port_id) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
@@ -1200,7 +1221,7 @@
isolate, isolate_lib.PrivateName(Symbols::_RawReceivePortImpl()));
// TODO(asiva): Symbols should contain private keys.
const String& function_name =
- String::Handle(isolate_lib.PrivateName(Symbols::_get_or_create()));
+ String::Handle(isolate_lib.PrivateName(Symbols::_get()));
const int kNumArguments = 1;
const Function& function = Function::Handle(
isolate,
« no previous file with comments | « runtime/vm/dart_api_impl.h ('k') | runtime/vm/dart_entry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698