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

Unified Diff: services/ui/ws/platform_display_default.cc

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/platform_display_default.cc
diff --git a/services/ui/ws/platform_display_default.cc b/services/ui/ws/platform_display_default.cc
index a807396a839e082de9169b3a8338b2315db00625..ab347757de989fd5e6f4219da325a646a3c4ce3f 100644
--- a/services/ui/ws/platform_display_default.cc
+++ b/services/ui/ws/platform_display_default.cc
@@ -11,6 +11,7 @@
#include "services/ui/display/screen_manager.h"
#include "services/ui/public/interfaces/cursor/cursor_struct_traits.h"
#include "services/ui/ws/server_window.h"
+#include "services/ui/ws/threaded_image_cursors.h"
#include "ui/base/cursor/image_cursors.h"
#include "ui/display/display.h"
#include "ui/events/event.h"
@@ -35,7 +36,7 @@ namespace ws {
PlatformDisplayDefault::PlatformDisplayDefault(
ServerWindow* root_window,
const display::ViewportMetrics& metrics,
- std::unique_ptr<ImageCursors> image_cursors)
+ std::unique_ptr<ThreadedImageCursors> image_cursors)
: root_window_(root_window),
image_cursors_(std::move(image_cursors)),
metrics_(metrics),
@@ -46,9 +47,11 @@ PlatformDisplayDefault::~PlatformDisplayDefault() {
delegate_ = nullptr;
frame_generator_.reset();
+ image_cursors_.reset();
// Destroy the PlatformWindow early on as it may call us back during
// destruction and we want to be in a known state. But destroy the surface
- // first because it can still be using the platform window.
+ // and ImageCursorsAsync first because they can still be using the platform
+ // window.
platform_window_.reset();
}
@@ -104,12 +107,13 @@ void PlatformDisplayDefault::SetCursor(const ui::CursorData& cursor_data) {
if (!image_cursors_)
return;
- ui::Cursor native_cursor(cursor_data.cursor_type());
+ ui::CursorType cursor_type = cursor_data.cursor_type();
#if defined(USE_OZONE)
- if (cursor_data.cursor_type() != ui::CursorType::kCustom) {
- image_cursors_->SetPlatformCursor(&native_cursor);
+ if (cursor_type != ui::CursorType::kCustom) {
+ image_cursors_->SetCursor(cursor_type, platform_window_.get());
} else {
+ ui::Cursor native_cursor(cursor_type);
// In Ozone builds, we have an interface available which turns bitmap data
// into platform cursors.
ui::CursorFactoryOzone* cursor_factory =
@@ -118,6 +122,7 @@ void PlatformDisplayDefault::SetCursor(const ui::CursorData& cursor_data) {
cursor_data.cursor_frames(), cursor_data.hotspot_in_pixels(),
cursor_data.frame_delay().InMilliseconds(),
cursor_data.scale_factor()));
+ platform_window_->SetCursor(native_cursor.platform());
}
#else
// Outside of ozone builds, there isn't a single interface for creating
@@ -129,14 +134,12 @@ void PlatformDisplayDefault::SetCursor(const ui::CursorData& cursor_data) {
// cursor management on its own mus windows so we can remove Webcursor from
// //content/ and do this in way that's safe cross-platform, instead of as an
// ozone-specific hack.
- if (cursor_data.cursor_type() == ui::CursorType::kCustom) {
+ if (cursor_type == ui::CursorType::kCustom) {
NOTIMPLEMENTED() << "No custom cursor support on non-ozone yet.";
- native_cursor = ui::Cursor(ui::CursorType::kPointer);
+ cursor_type = ui::CursorType::kPointer;
}
- image_cursors_->SetPlatformCursor(&native_cursor);
+ image_cursors_->SetCursor(cursor_type, platform_window_.get());
#endif
-
- platform_window_->SetCursor(native_cursor.platform());
}
void PlatformDisplayDefault::MoveCursorTo(

Powered by Google App Engine
This is Rietveld 408576698