Flutter Engine
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_H_
6 #define FLUTTER_LIB_UI_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 
15 namespace 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_Port 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_Port 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_Port LookupIsolatePortByNameUnprotected(const std::string& name);
37 
38  mutable std::mutex mutex_;
39  std::map<std::string, Dart_Port> port_mapping_;
40 
41  FML_DISALLOW_COPY_AND_ASSIGN(IsolateNameServer);
42 };
43 
44 } // namespace flutter
45 
46 #endif // FLUTTER_LIB_UI_ISOLATE_NAME_SERVER_H_
Dart_Port LookupIsolatePortByName(const std::string &name)
DEF_SWITCHES_START snapshot asset Path to the directory containing the four files specified by VmSnapshotInstructions and IsolateSnapshotInstructions vm snapshot The VM instructions snapshot that will be memory mapped as read and executable SnapshotAssetPath must be present isolate snapshot The isolate instructions snapshot that will be memory mapped as read and executable SnapshotAssetPath must be present icu symbol Prefix for the symbols representing ICU data linked into the Flutter library dart Flags passed directly to the Dart VM without being interpreted by the Flutter shell observatory port
Definition: switches.h:75
bool RegisterIsolatePortWithName(Dart_Port port, const std::string &name)
bool RemoveIsolateNameMapping(const std::string &name)
const char * name
Definition: fuchsia.cc:50