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

Side by Side Diff: services/ui/ws/ids.h

Issue 2445873003: Pass root ServerWindow id to FrameGenerator. (Closed)
Patch Set: Created 4 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 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 20 matching lines...) Expand all
31 // 31 //
32 // This model works when the client initiates creation of windows, which is 32 // This model works when the client initiates creation of windows, which is
33 // the typical use case. Embed roots and the WindowManager are special, they 33 // the typical use case. Embed roots and the WindowManager are special, they
34 // get access to windows created by other clients. These clients see the 34 // get access to windows created by other clients. These clients see the
35 // id assigned on the server. Such clients have to take care that they only 35 // id assigned on the server. Such clients have to take care that they only
36 // create windows using their client id. To do otherwise could result in 36 // create windows using their client id. To do otherwise could result in
37 // multiple windows having the same ClientWindowId. WindowTree enforces 37 // multiple windows having the same ClientWindowId. WindowTree enforces
38 // that embed roots use the client id in creating the window id to avoid 38 // that embed roots use the client id in creating the window id to avoid
39 // possible conflicts. 39 // possible conflicts.
40 struct WindowId { 40 struct WindowId {
41 WindowId(ClientSpecificId client_id, ClientSpecificId window_id) 41 constexpr WindowId(ClientSpecificId client_id, ClientSpecificId window_id)
42 : client_id(client_id), window_id(window_id) {} 42 : client_id(client_id), window_id(window_id) {}
43 WindowId() : client_id(0), window_id(0) {} 43 constexpr WindowId() : client_id(0), window_id(0) {}
44 44
45 bool operator==(const WindowId& other) const { 45 bool operator==(const WindowId& other) const {
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);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 } 91 }
92 92
93 // Returns a root window id with a given index offset. 93 // Returns a root window id with a given index offset.
94 inline WindowId RootWindowId(uint16_t index) { 94 inline WindowId RootWindowId(uint16_t index) {
95 return WindowId(kInvalidClientId, 2 + index); 95 return WindowId(kInvalidClientId, 2 + index);
96 } 96 }
97 97
98 } // namespace ws 98 } // namespace ws
99 } // namespace ui 99 } // namespace ui
100 100
101 namespace BASE_HASH_NAMESPACE { 101 namespace std {
102 102
103 template <> 103 template <>
104 struct hash<ui::ws::ClientWindowId> { 104 struct hash<ui::ws::ClientWindowId> {
105 size_t operator()(const ui::ws::ClientWindowId& id) const { 105 size_t operator()(const ui::ws::ClientWindowId& id) const {
106 return hash<ui::Id>()(id.id); 106 return hash<ui::Id>()(id.id);
107 } 107 }
108 }; 108 };
109 109
110 template <> 110 template <>
111 struct hash<ui::ws::WindowId> { 111 struct hash<ui::ws::WindowId> {
112 size_t operator()(const ui::ws::WindowId& id) const { 112 size_t operator()(const ui::ws::WindowId& id) const {
113 return hash<ui::Id>()(WindowIdToTransportId(id)); 113 return hash<ui::Id>()(WindowIdToTransportId(id));
114 } 114 }
115 }; 115 };
116 116
117 } // namespace BASE_HASH_NAMESPACE 117 } // namespace std
118 118
119 #endif // SERVICES_UI_WS_IDS_H_ 119 #endif // SERVICES_UI_WS_IDS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698