Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 SERVICES_UI_WS_IDS_H_ | 5 #ifndef SERVICES_UI_WS_IDS_H_ |
| 6 #define SERVICES_UI_WS_IDS_H_ | 6 #define SERVICES_UI_WS_IDS_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 46 return other.client_id == client_id && other.window_id == window_id; | 46 return other.client_id == client_id && other.window_id == window_id; |
| 47 } | 47 } |
| 48 | 48 |
| 49 bool operator!=(const WindowId& other) const { return !(*this == other); } | 49 bool operator!=(const WindowId& other) const { return !(*this == other); } |
| 50 | 50 |
| 51 bool operator<(const WindowId& other) const { | 51 bool operator<(const WindowId& other) const { |
| 52 return std::tie(client_id, window_id) < | 52 return std::tie(client_id, window_id) < |
| 53 std::tie(other.client_id, other.window_id); | 53 std::tie(other.client_id, other.window_id); |
| 54 } | 54 } |
| 55 | 55 |
| 56 operator uint32_t() const { | |
|
sky
2016/10/04 17:50:53
Actually, one comment. Style guide says no to impl
Fady Samuel
2016/10/04 19:31:57
Using WindowIdToTransportId instead.
| |
| 57 return (client_id << 16) | window_id; | |
| 58 } | |
| 59 | |
| 56 std::string ToString() const { | 60 std::string ToString() const { |
| 57 return base::StringPrintf("%u:%u", client_id, window_id); | 61 return base::StringPrintf("%u:%u", client_id, window_id); |
| 58 } | 62 } |
| 59 | 63 |
| 60 ClientSpecificId client_id; | 64 ClientSpecificId client_id; |
| 61 ClientSpecificId window_id; | 65 ClientSpecificId window_id; |
| 62 }; | 66 }; |
| 63 | 67 |
| 64 // Used for ids assigned by the client. | 68 // Used for ids assigned by the client. |
| 65 struct ClientWindowId { | 69 struct ClientWindowId { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 template <> | 114 template <> |
| 111 struct hash<ui::ws::WindowId> { | 115 struct hash<ui::ws::WindowId> { |
| 112 size_t operator()(const ui::ws::WindowId& id) const { | 116 size_t operator()(const ui::ws::WindowId& id) const { |
| 113 return hash<ui::Id>()(WindowIdToTransportId(id)); | 117 return hash<ui::Id>()(WindowIdToTransportId(id)); |
| 114 } | 118 } |
| 115 }; | 119 }; |
| 116 | 120 |
| 117 } // namespace BASE_HASH_NAMESPACE | 121 } // namespace BASE_HASH_NAMESPACE |
| 118 | 122 |
| 119 #endif // SERVICES_UI_WS_IDS_H_ | 123 #endif // SERVICES_UI_WS_IDS_H_ |
| OLD | NEW |