Chromium Code Reviews| Index: services/ui/service.h |
| diff --git a/services/ui/service.h b/services/ui/service.h |
| index 4d035f9c94a2d269df23c1d455a7e5f68f796044..4deb7cf2bd3957ee330422b6c21976c57d15f9a7 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,35 @@ 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(const InProcessConfig& config); |
|
sky
2017/07/13 17:14:58
Do you really need to declare this?
mfomitchev
2017/07/13 17:53:06
Nope, removed.
I had Service ctor take InProcessCo
|
| + ~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; |
| + }; |
| + |
| + // |config| should be null when UI Service runs in it's own separate process, |
|
sky
2017/07/13 17:14:58
Given many callers use null, how about making InPr
mfomitchev
2017/07/13 17:53:06
Done.
|
| + // as opposed to inside the Window Manager's process. |
| + explicit Service(InProcessConfig* config); |
|
sky
2017/07/13 17:14:58
const InProcessConfig* ?
mfomitchev
2017/07/13 17:53:06
Done.
|
| ~Service() override; |
| private: |
| @@ -74,6 +94,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 +121,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 +173,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 +183,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_; |