Flutter Engine
 
Loading...
Searching...
No Matches
isolate_name_server.h
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
5#ifndef FLUTTER_LIB_UI_ISOLATE_NAME_SERVER_ISOLATE_NAME_SERVER_H_
6#define FLUTTER_LIB_UI_ISOLATE_NAME_SERVER_ISOLATE_NAME_SERVER_H_
7
8#include <map>
9#include <mutex>
10#include <string>
11
12#include "flutter/fml/macros.h"
13#include "third_party/dart/runtime/include/dart_api.h"
14
15namespace flutter {
16
18 public:
20
22
23 // Looks up the Dart_Port associated with a given name. Returns ILLEGAL_PORT
24 // if the name does not exist.
25 Dart_PortEx LookupIsolatePortByName(const std::string& name);
26
27 // Registers a Dart_Port with a given name. Returns true if registration is
28 // successful, false if the name entry already exists.
29 bool RegisterIsolatePortWithName(Dart_PortEx port, const std::string& name);
30
31 // Removes a name to Dart_Port mapping given a name. Returns true if the
32 // mapping was successfully removed, false if the mapping does not exist.
33 bool RemoveIsolateNameMapping(const std::string& name);
34
35 private:
36 Dart_PortEx LookupIsolatePortByNameUnprotected(const std::string& name);
37
38 mutable std::mutex mutex_;
39 std::map<std::string, Dart_PortEx> port_mapping_;
40
42};
43
44} // namespace flutter
45
46#endif // FLUTTER_LIB_UI_ISOLATE_NAME_SERVER_ISOLATE_NAME_SERVER_H_
bool RegisterIsolatePortWithName(Dart_PortEx port, const std::string &name)
Dart_PortEx LookupIsolatePortByName(const std::string &name)
bool RemoveIsolateNameMapping(const std::string &name)
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27
DEF_SWITCHES_START aot vmservice shared library name
Definition switch_defs.h:27