Flutter Engine
 
Loading...
Searching...
No Matches
isolate_name_server_natives.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
6
7#include <string>
8
13
14namespace flutter {
15
17 const std::string& name) {
18 auto name_server = UIDartState::Current()->GetIsolateNameServer();
19 if (!name_server) {
20 return Dart_Null();
21 }
22 Dart_PortEx port = name_server->LookupIsolatePortByName(name);
23 if (port.port_id == ILLEGAL_PORT) {
24 return Dart_Null();
25 }
26 return Dart_NewSendPortEx(port);
27}
28
30 const std::string& name) {
31 auto name_server = UIDartState::Current()->GetIsolateNameServer();
32 if (!name_server) {
33 return false;
34 }
35 Dart_PortEx port;
36 Dart_SendPortGetIdEx(port_handle, &port);
37 if (!name_server->RegisterIsolatePortWithName(port, name)) {
38 return false;
39 }
40 return true;
41}
42
44 auto name_server = UIDartState::Current()->GetIsolateNameServer();
45 if (!name_server || !name_server->RemoveIsolateNameMapping(name)) {
46 return false;
47 }
48 return true;
49}
50
51} // namespace flutter
static Dart_Handle LookupPortByName(const std::string &name)
static bool RegisterPortWithName(Dart_Handle port_handle, const std::string &name)
static bool RemovePortNameMapping(const std::string &name)
std::shared_ptr< IsolateNameServer > GetIsolateNameServer() const
static UIDartState * Current()
DEF_SWITCHES_START aot vmservice shared library name
Definition switch_defs.h:27