Flutter Engine
flutter::ConnectionCollection Class Reference

Maintains a current integer assigned to a name (connections). More...

#include <connection_collection.h>

Public Types

typedef int64_t Connection
 

Public Member Functions

Connection AquireConnection (const std::string &name)
 
std::string CleanupConnection (Connection connection)
 

Static Public Member Functions

static bool IsValidConnection (Connection connection)
 
static Connection MakeErrorConnection (int errCode)
 

Static Public Attributes

static const Connection kInvalidConnection = 0
 

Detailed Description

Maintains a current integer assigned to a name (connections).

Definition at line 15 of file connection_collection.h.

Member Typedef Documentation

◆ Connection

Definition at line 17 of file connection_collection.h.

Member Function Documentation

◆ AquireConnection()

ConnectionCollection::Connection flutter::ConnectionCollection::AquireConnection ( const std::string &  name)

Definition at line 8 of file connection_collection.mm.

References name.

8  {
9  Connection nextConnection = ++counter_;
10  connections_[name] = nextConnection;
11  return nextConnection;
12 }
const char * name
Definition: fuchsia.cc:50

◆ CleanupConnection()

std::string flutter::ConnectionCollection::CleanupConnection ( ConnectionCollection::Connection  connection)
Returns
the name of the channel when cleanup is successful, otherwise the empty string.

Definition at line 14 of file connection_collection.mm.

14  {
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 }

◆ IsValidConnection()

bool flutter::ConnectionCollection::IsValidConnection ( ConnectionCollection::Connection  connection)
static

Definition at line 31 of file connection_collection.mm.

31  {
32  return connection > 0;
33 }

◆ MakeErrorConnection()

ConnectionCollection::Connection flutter::ConnectionCollection::MakeErrorConnection ( int  errCode)
static

Definition at line 35 of file connection_collection.mm.

Referenced by FlutterEngine::run.

35  {
36  if (errCode < 0) {
37  return -1 * errCode;
38  }
39  return errCode;
40 }

Member Data Documentation

◆ kInvalidConnection

const Connection flutter::ConnectionCollection::kInvalidConnection = 0
static

Definition at line 18 of file connection_collection.h.


The documentation for this class was generated from the following files: