Flutter Engine
connection_collection.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 SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_CONNECTION_COLLECTION_H_
6 #define SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_CONNECTION_COLLECTION_H_
7 
8 #include <cstdint>
9 #include <map>
10 #include <string>
11 
12 namespace flutter {
13 
14 /// Maintains a current integer assigned to a name (connections).
16  public:
17  typedef int64_t Connection;
18  static const Connection kInvalidConnection = 0;
19 
20  Connection AquireConnection(const std::string& name);
21  ///\returns the name of the channel when cleanup is successful, otherwise
22  /// the empty string.
23  std::string CleanupConnection(Connection connection);
24 
25  static bool IsValidConnection(Connection connection);
26 
27  static Connection MakeErrorConnection(int errCode);
28 
29  private:
30  std::map<std::string, Connection> connections_;
31  Connection counter_ = 0;
32 };
33 
34 } // namespace flutter
35 
36 #endif // SHELL_PLATFORM_IOS_FRAMEWORK_SOURCE_CONNECTION_COLLECTION_H_
Maintains a current integer assigned to a name (connections).
std::string CleanupConnection(Connection connection)
static bool IsValidConnection(Connection connection)
const char * name
Definition: fuchsia.cc:50
static Connection MakeErrorConnection(int errCode)
Connection AquireConnection(const std::string &name)
static const Connection kInvalidConnection