| Flutter iOS Embedder |

connection_collection.mm
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 #import "flutter/shell/platform/darwin/ios/framework/Source/connection_collection.h"
6
7 namespace flutter {
8 ConnectionCollection::Connection ConnectionCollection::AquireConnection(const std::string& name) {
9 Connection nextConnection = ++counter_;
10 connections_[name] = nextConnection;
11 return nextConnection;
12 }
13
14 std::string ConnectionCollection::CleanupConnection(ConnectionCollection::Connection connection) {
15 if (connection > 0) {
16 std::string channel;
17 for (auto& keyValue : connections_) {
18 if (keyValue.second == connection) {
19 channel = keyValue.first;
20 break;
21 }
22 }
23 if (channel.length() > 0) {
24 connections_.erase(channel);
25 return channel;
26 }
27 }
28 return "";
29 }
30
31 bool ConnectionCollection::IsValidConnection(ConnectionCollection::Connection connection) {
32 return connection > 0;
33 }
34
35 ConnectionCollection::Connection ConnectionCollection::MakeErrorConnection(int errCode) {
36 if (errCode < 0) {
37 return -1 * errCode;
38 }
39 return errCode;
40 }
41
42 } // namespace flutter
flutter::ConnectionCollection::Connection
int64_t Connection
Definition: connection_collection.h:17
connection_collection.h
flutter::ConnectionCollection::CleanupConnection
std::string CleanupConnection(Connection connection)
Definition: connection_collection.mm:14
flutter::ConnectionCollection::MakeErrorConnection
static Connection MakeErrorConnection(int errCode)
Definition: connection_collection.mm:35
flutter
Definition: accessibility_bridge.h:28
flutter::ConnectionCollection::IsValidConnection
static bool IsValidConnection(Connection connection)
Definition: connection_collection.mm:31
flutter::ConnectionCollection::AquireConnection
Connection AquireConnection(const std::string &name)
Definition: connection_collection.mm:8