Index: services/ui/service.h |
diff --git a/services/ui/service.h b/services/ui/service.h |
index 4d035f9c94a2d269df23c1d455a7e5f68f796044..a2e08883b53b1c9fbdfcef711c4be09cbae0e30b 100644 |
--- a/services/ui/service.h |
+++ b/services/ui/service.h |
@@ -13,6 +13,8 @@ |
#include <vector> |
#include "base/macros.h" |
+#include "base/memory/ref_counted.h" |
+#include "base/memory/weak_ptr.h" |
#include "components/discardable_memory/public/interfaces/discardable_shared_memory_manager.mojom.h" |
#include "services/service_manager/public/cpp/binder_registry.h" |
#include "services/service_manager/public/cpp/service.h" |
@@ -53,17 +55,37 @@ class Identity; |
namespace ui { |
+class ImageCursorsSet; |
class InputDeviceController; |
class PlatformEventSource; |
namespace ws { |
+class ThreadedImageCursorsFactory; |
class WindowServer; |
} |
class Service : public service_manager::Service, |
public ws::WindowServerDelegate { |
public: |
- Service(); |
+ // Contains the configuration necessary to run the UI Service inside the |
+ // Window Manager's process. |
+ struct InProcessConfig { |
+ InProcessConfig(); |
+ ~InProcessConfig(); |
+ |
+ // Can be used to load resources. |
+ scoped_refptr<base::SingleThreadTaskRunner> resource_runner = nullptr; |
+ |
+ // Can only be de-referenced on |resource_runner_|. |
+ base::WeakPtr<ImageCursorsSet> image_cursors_set_weak_ptr = nullptr; |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(InProcessConfig); |
+ }; |
+ |
+ // |config| should be null when UI Service runs in it's own separate process, |
+ // as opposed to inside the Window Manager's process. |
+ explicit Service(const InProcessConfig* config = nullptr); |
~Service() override; |
private: |
@@ -74,6 +96,8 @@ class Service : public service_manager::Service, |
using UserIdToUserState = std::map<ws::UserId, std::unique_ptr<UserState>>; |
+ bool is_in_process() const { return is_in_process_; } |
+ |
// Attempts to initialize the resource bundle. Returns true if successful, |
// otherwise false if resources cannot be loaded. |
bool InitializeResources(service_manager::Connector* connector); |
@@ -99,6 +123,7 @@ class Service : public service_manager::Service, |
bool IsTestConfig() const override; |
void OnWillCreateTreeForWindowManager( |
bool automatically_create_display_roots) override; |
+ ws::ThreadedImageCursorsFactory* GetThreadedImageCursorsFactory() override; |
void BindAccessibilityManagerRequest( |
const service_manager::BindSourceInfo& source_info, |
@@ -150,7 +175,7 @@ class Service : public service_manager::Service, |
mojom::WindowServerTestRequest request); |
std::unique_ptr<ws::WindowServer> window_server_; |
- std::unique_ptr<ui::PlatformEventSource> event_source_; |
+ std::unique_ptr<PlatformEventSource> event_source_; |
using PendingRequests = std::vector<std::unique_ptr<PendingRequest>>; |
PendingRequests pending_requests_; |
@@ -160,6 +185,13 @@ class Service : public service_manager::Service, |
// and must outlive |registry_|. |
InputDeviceServer input_device_server_; |
+ // True if the UI Service runs inside WM's process, false if it runs inside |
+ // its own process. |
+ const bool is_in_process_; |
+ |
+ std::unique_ptr<ws::ThreadedImageCursorsFactory> |
+ threaded_image_cursors_factory_; |
+ |
bool test_config_; |
#if defined(USE_OZONE) |
std::unique_ptr<gfx::ClientNativePixmapFactory> client_native_pixmap_factory_; |