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

Side by Side Diff: mojo/edk/system/ports/name.h

Issue 1678333003: Revert of [mojo-edk] Simplify multiprocess pipe bootstrap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months 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 unified diff | Download patch
« no previous file with comments | « mojo/edk/system/ports/message.cc ('k') | mojo/edk/system/ports/node.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MOJO_EDK_SYSTEM_PORTS_NAME_H_ 5 #ifndef MOJO_EDK_SYSTEM_PORTS_NAME_H_
6 #define MOJO_EDK_SYSTEM_PORTS_NAME_H_ 6 #define MOJO_EDK_SYSTEM_PORTS_NAME_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <ostream> 10 #include <ostream>
11 #include <tuple>
12 11
13 namespace mojo { 12 namespace mojo {
14 namespace edk { 13 namespace edk {
15 namespace ports { 14 namespace ports {
16 15
17 struct Name { 16 struct Name {
18 Name(uint64_t v1, uint64_t v2) : v1(v1), v2(v2) {} 17 Name(uint64_t v1, uint64_t v2) : v1(v1), v2(v2) {}
19 uint64_t v1, v2; 18 uint64_t v1, v2;
20 }; 19 };
21 20
22 inline bool operator==(const Name& a, const Name& b) { 21 inline bool operator==(const Name& a, const Name& b) {
23 return a.v1 == b.v1 && a.v2 == b.v2; 22 return a.v1 == b.v1 && a.v2 == b.v2;
24 } 23 }
25
26 inline bool operator!=(const Name& a, const Name& b) { 24 inline bool operator!=(const Name& a, const Name& b) {
27 return !(a == b); 25 return !(a == b);
28 } 26 }
29
30 inline bool operator<(const Name& a, const Name& b) {
31 return std::tie(a.v1, a.v2) < std::tie(b.v1, b.v2);
32 }
33
34 std::ostream& operator<<(std::ostream& stream, const Name& name); 27 std::ostream& operator<<(std::ostream& stream, const Name& name);
35 28
36 struct PortName : Name { 29 struct PortName : Name {
37 PortName() : Name(0, 0) {} 30 PortName() : Name(0, 0) {}
38 PortName(uint64_t v1, uint64_t v2) : Name(v1, v2) {} 31 PortName(uint64_t v1, uint64_t v2) : Name(v1, v2) {}
39 }; 32 };
40 33
41 const PortName kInvalidPortName = {0, 0}; 34 const PortName kInvalidPortName = {0, 0};
42 35
43 struct NodeName : Name { 36 struct NodeName : Name {
44 NodeName() : Name(0, 0) {} 37 NodeName() : Name(0, 0) {}
45 NodeName(uint64_t v1, uint64_t v2) : Name(v1, v2) {} 38 NodeName(uint64_t v1, uint64_t v2) : Name(v1, v2) {}
46 }; 39 };
47 40
48 const NodeName kInvalidNodeName = {0, 0}; 41 const NodeName kInvalidNodeName = {0, 0};
49 42
50 } // namespace ports 43 } // namespace ports
51 } // namespace edk 44 } // namespace edk
52 } // namespace mojo 45 } // namespace mojo
53 46
54 #endif // MOJO_EDK_SYSTEM_PORTS_NAME_H_ 47 #endif // MOJO_EDK_SYSTEM_PORTS_NAME_H_
OLDNEW
« no previous file with comments | « mojo/edk/system/ports/message.cc ('k') | mojo/edk/system/ports/node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698