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

Unified Diff: runtime/vm/port.h

Issue 9169063: Add support for native ports in the vm. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 11 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/native_message_handler.cc ('k') | runtime/vm/port.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/port.h
===================================================================
--- runtime/vm/port.h (revision 3743)
+++ runtime/vm/port.h (working copy)
@@ -13,23 +13,26 @@
class Isolate;
class Message;
+class MessageHandler;
class Mutex;
class PortMapTestPeer;
class PortMap: public AllStatic {
public:
- // Allocate a port in the current isolate and return its VM-global id.
- static Dart_Port CreatePort();
+ // Allocate a port for the provided handler and return its VM-global id.
+ static Dart_Port CreatePort(MessageHandler* handler);
// Indicates that a port has had a ReceivePort created for it at the
// dart language level. The port remains live until it is closed.
static void SetLive(Dart_Port id);
// Close the port with id. All pending messages will be dropped.
- static void ClosePort(Dart_Port id);
+ //
+ // Returns true if the port is successfully closed.
+ static bool ClosePort(Dart_Port id);
- // Close all the ports of the current isolate.
- static void ClosePorts();
+ // Close all the ports for the provided handler.
+ static void ClosePorts(MessageHandler* handler);
// Enqueues the message in the port with id. Returns false if the port is not
// active any longer.
@@ -42,12 +45,13 @@
private:
friend class dart::PortMapTestPeer;
- // Mapping between port numbers and isolates.
- // Free entries have id == 0 and isolate == NULL. Deleted entries have id == 0
- // and isolate == deleted_entry_.
+ // Mapping between port numbers and handlers.
+ //
+ // Free entries have id == 0 and handler == NULL. Deleted entries
+ // have id == 0 and handler == deleted_entry_.
typedef struct {
Dart_Port port;
- Isolate* isolate;
+ MessageHandler* handler;
bool live;
} Entry;
@@ -67,7 +71,7 @@
// Hashmap of ports.
static Entry* map_;
- static Isolate* deleted_entry_;
+ static MessageHandler* deleted_entry_;
static intptr_t capacity_;
static intptr_t used_;
static intptr_t deleted_;
« no previous file with comments | « runtime/vm/native_message_handler.cc ('k') | runtime/vm/port.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698