OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_PORT_H_ | 5 #ifndef VM_PORT_H_ |
6 #define VM_PORT_H_ | 6 #define VM_PORT_H_ |
7 | 7 |
8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
9 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
10 #include "vm/globals.h" | 10 #include "vm/globals.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 // Close all the ports for the provided handler. | 34 // Close all the ports for the provided handler. |
35 static void ClosePorts(MessageHandler* handler); | 35 static void ClosePorts(MessageHandler* handler); |
36 | 36 |
37 // Enqueues the message in the port with id. Returns false if the port is not | 37 // Enqueues the message in the port with id. Returns false if the port is not |
38 // active any longer. | 38 // active any longer. |
39 // | 39 // |
40 // Claims ownership of 'message'. | 40 // Claims ownership of 'message'. |
41 static bool PostMessage(Message* message); | 41 static bool PostMessage(Message* message); |
42 | 42 |
| 43 // Returns whether a port is local to the current isolate. |
| 44 static bool IsLocalPort(Dart_Port id); |
| 45 |
43 static void InitOnce(); | 46 static void InitOnce(); |
44 | 47 |
45 private: | 48 private: |
46 friend class dart::PortMapTestPeer; | 49 friend class dart::PortMapTestPeer; |
47 | 50 |
48 // Mapping between port numbers and handlers. | 51 // Mapping between port numbers and handlers. |
49 // | 52 // |
50 // Free entries have id == 0 and handler == NULL. Deleted entries | 53 // Free entries have id == 0 and handler == NULL. Deleted entries |
51 // have id == 0 and handler == deleted_entry_. | 54 // have id == 0 and handler == deleted_entry_. |
52 typedef struct { | 55 typedef struct { |
(...skipping 22 matching lines...) Expand all Loading... |
75 static intptr_t capacity_; | 78 static intptr_t capacity_; |
76 static intptr_t used_; | 79 static intptr_t used_; |
77 static intptr_t deleted_; | 80 static intptr_t deleted_; |
78 | 81 |
79 static Dart_Port next_port_; | 82 static Dart_Port next_port_; |
80 }; | 83 }; |
81 | 84 |
82 } // namespace dart | 85 } // namespace dart |
83 | 86 |
84 #endif // VM_PORT_H_ | 87 #endif // VM_PORT_H_ |
OLD | NEW |