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

Unified Diff: services/ui/ws/threaded_image_cursors.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 side-by-side diff with in-line comments
Download patch
Index: services/ui/ws/threaded_image_cursors.h
diff --git a/services/ui/ws/threaded_image_cursors.h b/services/ui/ws/threaded_image_cursors.h
new file mode 100644
index 0000000000000000000000000000000000000000..f8ead1ccc9b3b81c10fc12eb68be549948427dae
--- /dev/null
+++ b/services/ui/ws/threaded_image_cursors.h
@@ -0,0 +1,48 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SERVICES_UI_WS_THREADED_IMAGE_CURSORS_H_
+#define SERVICES_UI_WS_THREADED_IMAGE_CURSORS_H_
+
+#include "base/memory/weak_ptr.h"
+#include "ui/base/cursor/image_cursors.h"
+
+namespace base {
+class SingleThreadTaskRunner;
+}
+
+namespace ui {
+class PlatformWindow;
+
+namespace ws {
+
+// Wrapper around ui::ImageCursors, capable of executing its methods
+// asynchronously via the provided thread task runner.
+class ThreadedImageCursors {
+ public:
+ ThreadedImageCursors(
sky 2017/06/20 22:33:13 explicit.
mfomitchev 2017/06/21 21:22:51 Takes two args now.
+ scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
+ ~ThreadedImageCursors();
+
+ void SetDisplay(const display::Display& display, float scale_factor);
+
+ // |platform_window| pointer is guaranteed to be alive while this object
+ // exists.
+ void SetCursor(ui::CursorType cursor_type,
+ ui::PlatformWindow* platform_window);
+
+ private:
+ void SetDisplaySync(const display::Display& display, float scale_factor);
+ void SetCursorSync(ui::CursorType cursor_type,
+ ui::PlatformWindow* platform_window);
+
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
+ ui::ImageCursors image_cursors_;
+ base::WeakPtrFactory<ThreadedImageCursors> weak_ptr_factory_;
+};
sky 2017/06/20 22:33:13 DISALLOW...
mfomitchev 2017/06/21 21:22:51 Done.
+
+} // namesapce ws
+} // namesapce ui
+
+#endif // SERVICES_UI_WS_THREADED_IMAGE_CURSORS_H_

Powered by Google App Engine
This is Rietveld 408576698