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

Side by Side Diff: services/ui/service.h

Issue 2916823002: Move Mus into chrome's process when running with --mus.
Patch Set: Addressing most feedback, making this work on device. Created 3 years, 6 months 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_SERVICE_H_ 5 #ifndef SERVICES_UI_SERVICE_H_
6 #define SERVICES_UI_SERVICE_H_ 6 #define SERVICES_UI_SERVICE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 class InputDeviceController; 56 class InputDeviceController;
57 class PlatformEventSource; 57 class PlatformEventSource;
58 58
59 namespace ws { 59 namespace ws {
60 class WindowServer; 60 class WindowServer;
61 } 61 }
62 62
63 class Service : public service_manager::Service, 63 class Service : public service_manager::Service,
64 public ws::WindowServerDelegate { 64 public ws::WindowServerDelegate {
65 public: 65 public:
66 Service(); 66 // |resource_runner| is the task runner for the thread which can be used to
67 // load resources. Used when UI Service is run inside a Window Manager's
68 // process. When UI Service is run in a separate process, resource_runner
69 // should be null, and resources are loaded on the UI Service's thread.
70 Service(scoped_refptr<base::SingleThreadTaskRunner> resource_runner);
sky 2017/06/19 21:25:47 Rather than having mus deal with the different emb
Elliot Glaysher 2017/06/19 21:46:43 This sounds significantly better than having a wra
mfomitchev 2017/06/19 21:50:19 I considered this, but it would mean pre-loading a
sky 2017/06/20 16:07:09 I don't have a good feel for how many cursors and
mfomitchev 2017/06/20 17:00:42 Ok. I think we have just two cursor sets right now
67 ~Service() override; 71 ~Service() override;
68 72
69 private: 73 private:
70 // Holds InterfaceRequests received before the first WindowTreeHost Display 74 // Holds InterfaceRequests received before the first WindowTreeHost Display
71 // has been established. 75 // has been established.
72 struct PendingRequest; 76 struct PendingRequest;
73 struct UserState; 77 struct UserState;
74 78
75 using UserIdToUserState = std::map<ws::UserId, std::unique_ptr<UserState>>; 79 using UserIdToUserState = std::map<ws::UserId, std::unique_ptr<UserState>>;
76 80
81 bool in_process() { return resource_runner_ != nullptr; }
82
77 // Attempts to initialize the resource bundle. Returns true if successful, 83 // Attempts to initialize the resource bundle. Returns true if successful,
78 // otherwise false if resources cannot be loaded. 84 // otherwise false if resources cannot be loaded.
79 bool InitializeResources(service_manager::Connector* connector); 85 bool InitializeResources(service_manager::Connector* connector);
80 86
81 // Returns the user specific state for the user id of |remote_identity|. 87 // Returns the user specific state for the user id of |remote_identity|.
82 // Service owns the return value. 88 // Service owns the return value.
83 // TODO(sky): if we allow removal of user ids then we need to close anything 89 // TODO(sky): if we allow removal of user ids then we need to close anything
84 // associated with the user (all incoming pipes...) on removal. 90 // associated with the user (all incoming pipes...) on removal.
85 UserState* GetUserState(const service_manager::Identity& remote_identity); 91 UserState* GetUserState(const service_manager::Identity& remote_identity);
86 92
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 std::unique_ptr<ui::PlatformEventSource> event_source_; 159 std::unique_ptr<ui::PlatformEventSource> event_source_;
154 using PendingRequests = std::vector<std::unique_ptr<PendingRequest>>; 160 using PendingRequests = std::vector<std::unique_ptr<PendingRequest>>;
155 PendingRequests pending_requests_; 161 PendingRequests pending_requests_;
156 162
157 UserIdToUserState user_id_to_user_state_; 163 UserIdToUserState user_id_to_user_state_;
158 164
159 // Provides input-device information via Mojo IPC. Registers Mojo interfaces 165 // Provides input-device information via Mojo IPC. Registers Mojo interfaces
160 // and must outlive |registry_|. 166 // and must outlive |registry_|.
161 InputDeviceServer input_device_server_; 167 InputDeviceServer input_device_server_;
162 168
169 scoped_refptr<base::SingleThreadTaskRunner> resource_runner_;
163 bool test_config_; 170 bool test_config_;
164 #if defined(USE_OZONE) 171 #if defined(USE_OZONE)
165 std::unique_ptr<gfx::ClientNativePixmapFactory> client_native_pixmap_factory_; 172 std::unique_ptr<gfx::ClientNativePixmapFactory> client_native_pixmap_factory_;
166 #if defined(OS_CHROMEOS) 173 #if defined(OS_CHROMEOS)
167 std::unique_ptr<InputDeviceController> input_device_controller_; 174 std::unique_ptr<InputDeviceController> input_device_controller_;
168 #endif 175 #endif
169 #endif 176 #endif
170 177
171 // Manages display hardware and handles display management. May register Mojo 178 // Manages display hardware and handles display management. May register Mojo
172 // interfaces and must outlive |registry_|. 179 // interfaces and must outlive |registry_|.
173 std::unique_ptr<display::ScreenManager> screen_manager_; 180 std::unique_ptr<display::ScreenManager> screen_manager_;
174 181
175 IMERegistrarImpl ime_registrar_; 182 IMERegistrarImpl ime_registrar_;
176 IMEServerImpl ime_server_; 183 IMEServerImpl ime_server_;
177 184
178 std::unique_ptr<discardable_memory::DiscardableSharedMemoryManager> 185 std::unique_ptr<discardable_memory::DiscardableSharedMemoryManager>
179 discardable_shared_memory_manager_; 186 discardable_shared_memory_manager_;
180 187
181 service_manager::BinderRegistry registry_; 188 service_manager::BinderRegistry registry_;
182 189
183 // Set to true in StartDisplayInit(). 190 // Set to true in StartDisplayInit().
184 bool is_gpu_ready_ = false; 191 bool is_gpu_ready_ = false;
185 192
186 DISALLOW_COPY_AND_ASSIGN(Service); 193 DISALLOW_COPY_AND_ASSIGN(Service);
187 }; 194 };
188 195
189 } // namespace ui 196 } // namespace ui
190 197
191 #endif // SERVICES_UI_SERVICE_H_ 198 #endif // SERVICES_UI_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698