OLD | NEW |
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> | 8 #include <tuple> |
9 | 9 |
| 10 #include "ipc/ipc_message.h" |
| 11 |
10 namespace content { | 12 namespace content { |
11 | 13 |
12 // Uniquely identifies the route from which a net::URLRequest comes. | 14 // Uniquely identifies the route from which a net::URLRequest comes. |
13 struct GlobalRoutingID { | 15 struct GlobalRoutingID { |
14 GlobalRoutingID() : child_id(-1), route_id(-1) { | 16 GlobalRoutingID() : child_id(-1), route_id(-1) { |
15 } | 17 } |
16 | 18 |
17 GlobalRoutingID(int child_id, int route_id) | 19 GlobalRoutingID(int child_id, int route_id) |
18 : child_id(child_id), | 20 : child_id(child_id), |
19 route_id(route_id) { | 21 route_id(route_id) { |
(...skipping 11 matching lines...) Expand all Loading... |
31 } | 33 } |
32 bool operator==(const GlobalRoutingID& other) const { | 34 bool operator==(const GlobalRoutingID& other) const { |
33 return child_id == other.child_id && | 35 return child_id == other.child_id && |
34 route_id == other.route_id; | 36 route_id == other.route_id; |
35 } | 37 } |
36 bool operator!=(const GlobalRoutingID& other) const { | 38 bool operator!=(const GlobalRoutingID& other) const { |
37 return !(*this == other); | 39 return !(*this == other); |
38 } | 40 } |
39 }; | 41 }; |
40 | 42 |
| 43 // Same as GlobalRoutingID except the route_id must be a RenderFrameHost routing |
| 44 // id. |
| 45 struct GlobalFrameRoutingId { |
| 46 GlobalFrameRoutingId() : child_id(0), frame_routing_id(MSG_ROUTING_NONE) {} |
| 47 |
| 48 GlobalFrameRoutingId(int child_id, int frame_routing_id) |
| 49 : child_id(child_id), frame_routing_id(frame_routing_id) {} |
| 50 |
| 51 // The unique ID of the child process (different from OS's PID). |
| 52 int child_id; |
| 53 |
| 54 // The route ID (unique for each URLRequest source). |
| 55 int frame_routing_id; |
| 56 |
| 57 bool operator<(const GlobalFrameRoutingId& other) const { |
| 58 return std::tie(child_id, frame_routing_id) < |
| 59 std::tie(other.child_id, other.frame_routing_id); |
| 60 } |
| 61 bool operator==(const GlobalFrameRoutingId& other) const { |
| 62 return child_id == other.child_id && |
| 63 frame_routing_id == other.frame_routing_id; |
| 64 } |
| 65 bool operator!=(const GlobalFrameRoutingId& other) const { |
| 66 return !(*this == other); |
| 67 } |
| 68 }; |
| 69 |
41 } // namespace content | 70 } // namespace content |
42 | 71 |
43 #endif // CONTENT_BROWSER_LOADER_GLOBAL_ROUTING_ID_H_ | 72 #endif // CONTENT_BROWSER_LOADER_GLOBAL_ROUTING_ID_H_ |
OLD | NEW |