Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Unified Diff: extensions/common/api/messaging/port_id.cc

Issue 2547753002: [Extensions] Extension Port Ids and Initialization 2.0 (Closed)
Patch Set: rkaplow Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/common/api/messaging/port_id.h ('k') | extensions/common/extension_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/api/messaging/port_id.cc
diff --git a/extensions/common/api/messaging/port_id.cc b/extensions/common/api/messaging/port_id.cc
new file mode 100644
index 0000000000000000000000000000000000000000..105ff9f098eca5d1555a3f3d0f631338f13b3ae1
--- /dev/null
+++ b/extensions/common/api/messaging/port_id.cc
@@ -0,0 +1,31 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "extensions/common/api/messaging/port_id.h"
+
+#include <tuple>
+
+namespace extensions {
+
+PortId::PortId() {}
+PortId::PortId(const base::UnguessableToken& context_id,
+ int port_number,
+ bool is_opener)
+ : context_id(context_id), port_number(port_number), is_opener(is_opener) {}
+PortId::~PortId() {}
+PortId::PortId(PortId&& other) = default;
+PortId::PortId(const PortId& other) = default;
+PortId& PortId::operator=(const PortId& other) = default;
+
+bool PortId::operator==(const PortId& other) const {
+ return context_id == other.context_id && port_number == other.port_number &&
+ is_opener == other.is_opener;
+}
+
+bool PortId::operator<(const PortId& other) const {
+ return std::tie(context_id, port_number, is_opener) <
+ std::tie(other.context_id, other.port_number, other.is_opener);
+}
+
+} // namespace extensions
« no previous file with comments | « extensions/common/api/messaging/port_id.h ('k') | extensions/common/extension_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698