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

Side by Side Diff: content/browser/loader/global_routing_id.h

Issue 1462213002: Use std::tie() for operator< in content/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CONTENT_BROWSER_LOADER_GLOBAL_ROUTING_ID_H_ 5 #ifndef CONTENT_BROWSER_LOADER_GLOBAL_ROUTING_ID_H_
6 #define CONTENT_BROWSER_LOADER_GLOBAL_ROUTING_ID_H_ 6 #define CONTENT_BROWSER_LOADER_GLOBAL_ROUTING_ID_H_
7 7
8 #include <tuple>
9
8 namespace content { 10 namespace content {
9 11
10 // Uniquely identifies the route from which a net::URLRequest comes. 12 // Uniquely identifies the route from which a net::URLRequest comes.
11 struct GlobalRoutingID { 13 struct GlobalRoutingID {
12 GlobalRoutingID() : child_id(-1), route_id(-1) { 14 GlobalRoutingID() : child_id(-1), route_id(-1) {
13 } 15 }
14 16
15 GlobalRoutingID(int child_id, int route_id) 17 GlobalRoutingID(int child_id, int route_id)
16 : child_id(child_id), 18 : child_id(child_id),
17 route_id(route_id) { 19 route_id(route_id) {
18 } 20 }
19 21
20 // The unique ID of the child process (different from OS's PID). 22 // The unique ID of the child process (different from OS's PID).
21 int child_id; 23 int child_id;
22 24
23 // The route ID (unique for each URLRequest source). 25 // The route ID (unique for each URLRequest source).
24 int route_id; 26 int route_id;
25 27
26 bool operator<(const GlobalRoutingID& other) const { 28 bool operator<(const GlobalRoutingID& other) const {
27 if (child_id == other.child_id) 29 return std::tie(child_id, route_id) <
28 return route_id < other.route_id; 30 std::tie(other.child_id, other.route_id);
29 return child_id < other.child_id;
30 } 31 }
31 bool operator==(const GlobalRoutingID& other) const { 32 bool operator==(const GlobalRoutingID& other) const {
32 return child_id == other.child_id && 33 return child_id == other.child_id &&
33 route_id == other.route_id; 34 route_id == other.route_id;
34 } 35 }
35 bool operator!=(const GlobalRoutingID& other) const { 36 bool operator!=(const GlobalRoutingID& other) const {
36 return !(*this == other); 37 return !(*this == other);
37 } 38 }
38 }; 39 };
39 40
40 } // namespace content 41 } // namespace content
41 42
42 #endif // CONTENT_BROWSER_LOADER_GLOBAL_ROUTING_ID_H_ 43 #endif // CONTENT_BROWSER_LOADER_GLOBAL_ROUTING_ID_H_
OLDNEW
« no previous file with comments | « content/browser/host_zoom_map_impl.h ('k') | content/browser/media/webrtc_identity_store_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698