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

Unified Diff: services/ui/service.h

Issue 2916823002: Move Mus into chrome's process when running with --mus.
Patch Set: Undo Screen TLS change, don't use Screen::GetScreen() in Mus. 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 side-by-side diff with in-line comments
Download patch
Index: services/ui/service.h
diff --git a/services/ui/service.h b/services/ui/service.h
index 4d035f9c94a2d269df23c1d455a7e5f68f796044..9168aa69788acbc896deb1d2cc8bf8f83e3a2537 100644
--- a/services/ui/service.h
+++ b/services/ui/service.h
@@ -53,6 +53,7 @@ class Identity;
namespace ui {
+class ImageCursors;
class InputDeviceController;
class PlatformEventSource;
@@ -63,7 +64,15 @@ class WindowServer;
class Service : public service_manager::Service,
public ws::WindowServerDelegate {
public:
- Service();
+ // |resource_runner| is the task runner for the thread which can be used to
+ // load resources. Used when UI Service run inside a Window Manager's
+ // process (and so the resources need to be loaded on the WM's thread).
+ // When UI Service is run in a separate process, |resource_runner|
+ // should be null, and resources are loaded on the UI Service's thread.
+ // |image_cursors_weak_ptr| is also only used when the UI service runs
+ // in-process. It can only be dereferenced on |resource_runner|.
+ Service(scoped_refptr<base::SingleThreadTaskRunner> resource_runner,
sky 2017/06/27 19:58:56 optional: Create a structure named InProcessConfig
mfomitchev 2017/07/11 21:47:00 Done.
+ base::WeakPtr<ui::ImageCursors> image_cursors_weak_ptr);
~Service() override;
private:
@@ -74,6 +83,8 @@ class Service : public service_manager::Service,
using UserIdToUserState = std::map<ws::UserId, std::unique_ptr<UserState>>;
+ bool in_process() { return in_process_; }
sky 2017/06/27 19:58:56 bool in_process() const optional: prefix member an
mfomitchev 2017/07/11 21:46:59 Done.
+
// 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 +110,8 @@ class Service : public service_manager::Service,
bool IsTestConfig() const override;
void OnWillCreateTreeForWindowManager(
bool automatically_create_display_roots) override;
+ scoped_refptr<base::SingleThreadTaskRunner>& GetResourceRunner() override;
+ base::WeakPtr<ui::ImageCursors> GetImageCursorsWeakPtr() override;
void BindAccessibilityManagerRequest(
const service_manager::BindSourceInfo& source_info,
@@ -160,6 +173,22 @@ 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.
+ bool in_process_;
+
+ // Can be used to access resources. Will be null until the service is started
sky 2017/06/27 19:58:56 Please group in-process related state into a struc
mfomitchev 2017/07/11 21:47:00 Created ThreadedImageCursorsFactory(Impl). I think
+ // if the UI Service doesn't run in WM's process.
+ scoped_refptr<base::SingleThreadTaskRunner> resource_runner_;
+
+ // Used when UI Service runs in-process, and can only be de-referenced on
+ // |resource_runner_|. When UI Service doesn't run in-process, this points to
+ // |image_cursors_| (and should be de-referenced on UI Serivice's thread).
+ base::WeakPtr<ui::ImageCursors> image_cursors_weak_ptr_;
+
+ // Used when UI Service doesn't run in-process.
+ std::unique_ptr<ui::ImageCursors> image_cursors_;
+
bool test_config_;
#if defined(USE_OZONE)
std::unique_ptr<gfx::ClientNativePixmapFactory> client_native_pixmap_factory_;

Powered by Google App Engine
This is Rietveld 408576698