OLD | NEW |
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 UI_OZONE_PLATFORM_WAYLAND_FAKE_SERVER_H_ | 5 #ifndef UI_OZONE_PLATFORM_WAYLAND_FAKE_SERVER_H_ |
6 #define UI_OZONE_PLATFORM_WAYLAND_FAKE_SERVER_H_ | 6 #define UI_OZONE_PLATFORM_WAYLAND_FAKE_SERVER_H_ |
7 | 7 |
8 #include <wayland-server-core.h> | 8 #include <wayland-server-core.h> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 FakeServer(); | 139 FakeServer(); |
140 ~FakeServer() override; | 140 ~FakeServer() override; |
141 | 141 |
142 // Start the fake Wayland server. If this succeeds, the WAYLAND_SOCKET | 142 // Start the fake Wayland server. If this succeeds, the WAYLAND_SOCKET |
143 // environment variable will be set to the string representation of a file | 143 // environment variable will be set to the string representation of a file |
144 // descriptor that a client can connect to. The caller is responsible for | 144 // descriptor that a client can connect to. The caller is responsible for |
145 // ensuring that this file descriptor gets closed (for example, by calling | 145 // ensuring that this file descriptor gets closed (for example, by calling |
146 // wl_display_connect). | 146 // wl_display_connect). |
147 bool Start(); | 147 bool Start(); |
148 | 148 |
149 void Flush(); | 149 // Pause the server when it becomes idle. |
| 150 void Pause(); |
150 | 151 |
151 void Pause(); | 152 // Resume the server after flushing client connections. |
152 void Resume(); | 153 void Resume(); |
153 | 154 |
154 template <typename T> | 155 template <typename T> |
155 T* GetObject(uint32_t id) { | 156 T* GetObject(uint32_t id) { |
156 wl_resource* resource = wl_client_get_object(client_, id); | 157 wl_resource* resource = wl_client_get_object(client_, id); |
157 return resource ? T::FromResource(resource) : nullptr; | 158 return resource ? T::FromResource(resource) : nullptr; |
158 } | 159 } |
159 | 160 |
160 MockXdgShell* xdg_shell() { return &xdg_shell_; } | 161 MockXdgShell* xdg_shell() { return &xdg_shell_; } |
161 | 162 |
(...skipping 18 matching lines...) Expand all Loading... |
180 MockXdgShell xdg_shell_; | 181 MockXdgShell xdg_shell_; |
181 | 182 |
182 base::MessagePumpLibevent::FileDescriptorWatcher controller_; | 183 base::MessagePumpLibevent::FileDescriptorWatcher controller_; |
183 | 184 |
184 DISALLOW_COPY_AND_ASSIGN(FakeServer); | 185 DISALLOW_COPY_AND_ASSIGN(FakeServer); |
185 }; | 186 }; |
186 | 187 |
187 } // namespace wl | 188 } // namespace wl |
188 | 189 |
189 #endif // UI_OZONE_PLATFORM_WAYLAND_FAKE_SERVER_H_ | 190 #endif // UI_OZONE_PLATFORM_WAYLAND_FAKE_SERVER_H_ |
OLD | NEW |