20Mutex* PortMap::mutex_ =
nullptr;
21PortSet<PortMap::Entry>* PortMap::ports_ =
nullptr;
22Random* PortMap::prng_ =
nullptr;
56 ASSERT(handler !=
nullptr);
58 if (ports_ ==
nullptr) {
63 handler->CheckAccess();
70 MessageHandler::PortSetEntry isolate_entry;
71 isolate_entry.port =
port;
72 handler->ports_.
Insert(isolate_entry);
76 entry.handler = handler;
79 if (FLAG_trace_isolates) {
81 "[+] Opening port: \n"
83 "\tport: %" Pd64 "\n",
84 handler->
name(), entry.port);
91 if (message_handler !=
nullptr) *message_handler =
nullptr;
96 if (ports_ ==
nullptr) {
100 if (it == ports_->
end()) {
104 handler = entry.handler;
105 ASSERT(handler !=
nullptr);
108 handler->CheckAccess();
119 ASSERT(isolate_it != handler->ports_.
end());
124 if (message_handler !=
nullptr) *message_handler = handler;
131 if (ports_ ==
nullptr) {
136 for (
auto isolate_it = handler->ports_.
begin();
137 isolate_it != handler->ports_.
end(); ++isolate_it) {
138 auto it = ports_->
TryLookup((*isolate_it).port);
141 ASSERT(entry.port == (*isolate_it).port);
142 ASSERT(entry.handler == handler);
153 bool before_events) {
155 if (ports_ ==
nullptr) {
159 if (it == ports_->
end()) {
165 ASSERT(handler !=
nullptr);
173 if (ports_ ==
nullptr) {
177 return it != ports_->
end();
183 if (ports_ ==
nullptr) {
187 if (it == ports_->
end()) {
198 if (ports_ ==
nullptr) {
202 if (it == ports_->
end()) {
209 if (isolate ==
nullptr) {
219 if (ports_ ==
nullptr) {
224 return !handler->ports_.
IsEmpty();
231 if (ports_ ==
nullptr) {
236 if (it == ports_->
end()) {
240 auto isolate = (*it).handler->isolate();
241 if (isolate ==
nullptr) {
245 return isolate->group() ==
group;
249 if (mutex_ ==
nullptr) {
250 mutex_ =
new Mutex();
252 ASSERT(mutex_ !=
nullptr);
253 if (prng_ ==
nullptr) {
256 if (ports_ ==
nullptr) {
262 ASSERT(ports_ !=
nullptr);
264 for (
auto it = ports_->
begin(); it != ports_->
end(); ++it) {
265 const auto& entry = *it;
266 ASSERT(entry.handler !=
nullptr);
267 delete entry.handler;
289 if (ports_ ==
nullptr) {
292 for (
auto& entry : *ports_) {
293 if (entry.handler == handler) {
295 port.AddProperty(
"type",
"_Port");
296 port.AddPropertyF(
"name",
"Isolate Port (%" Pd64 ")", entry.port);
298 port.AddProperty(
"handler", msg_handler);
307 if (ports_ ==
nullptr) {
311 for (
auto& entry : *ports_) {
312 if (entry.handler == handler) {
static ObjectPtr LookupHandler(Dart_Port port_id)
void AddProperty(const char *name, bool b) const
void PostMessage(std::unique_ptr< Message > message, bool before_events=false)
virtual const char * name() const
virtual Isolate * isolate() const
void ClosePort(Dart_Port port)
bool IsOwnedByCurrentThread() const
static void static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
virtual const char * ToCString() const
static Dart_Port GetOriginId(Dart_Port id)
static void DebugDumpForMessageHandler(MessageHandler *handler)
static bool PostMessage(std::unique_ptr< Message > message, bool before_events=false)
static Isolate * GetIsolate(Dart_Port id)
static void PrintPortsForMessageHandler(MessageHandler *handler, JSONStream *stream)
static bool ClosePort(Dart_Port id, MessageHandler **message_handler=nullptr)
static bool IsReceiverInThisIsolateGroupOrClosed(Dart_Port receiver, IsolateGroup *group)
static void ClosePorts(MessageHandler *handler)
static Dart_Port CreatePort(MessageHandler *handler)
void Insert(const T &entry)
static constexpr Dart_Port kDeletedPort
Iterator TryLookup(Dart_Port port)
DART_FORCE_INLINE Iterator begin()
DART_FORCE_INLINE Iterator end()
bool Contains(Dart_Port port)
static constexpr Dart_Port kFreePort
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service port