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

Unified Diff: runtime/vm/dart_entry.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_entry.h ('k') | runtime/vm/symbols.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_entry.cc
===================================================================
--- runtime/vm/dart_entry.cc (revision 34429)
+++ runtime/vm/dart_entry.cc (working copy)
@@ -493,9 +493,9 @@
}
-bool DartLibraryCalls::IsSendPort(const Instance& send_port) {
+bool DartLibraryCalls::IsSendPort(const Instance& obj) {
// Get instance class.
- const Class& cls = Class::Handle(send_port.clazz());
+ const Class& cls = Class::Handle(obj.clazz());
// Get send port class from isolate library.
const Library& isolate_lib = Library::Handle(Library::IsolateLibrary());
const Class& send_port_cls = Class::Handle(
@@ -505,4 +505,17 @@
return cls.id() == send_port_cls.id();
}
+
+bool DartLibraryCalls::IsReceivePort(const Instance& obj) {
+ // Get instance class.
+ const Class& cls = Class::Handle(obj.clazz());
+ // Get send port class from isolate library.
+ const Library& isolate_lib = Library::Handle(Library::IsolateLibrary());
+ const Class& recv_port_cls = Class::Handle(
+ isolate_lib.LookupClassAllowPrivate(Symbols::_RawReceivePortImpl()));
+ // Check for the same class id.
+ ASSERT(!recv_port_cls.IsNull());
+ return cls.id() == recv_port_cls.id();
+}
+
} // namespace dart
« no previous file with comments | « runtime/vm/dart_entry.h ('k') | runtime/vm/symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698