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

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

Issue 2884463002: Make event-targeting asynchronous in window server. (Closed)
Patch Set: WeakPtrFactory; const &; etc Created 3 years, 7 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
« services/ui/ws/window_manager_state.cc ('K') | « services/ui/ws/window_server.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/ws/window_server.cc
diff --git a/services/ui/ws/window_server.cc b/services/ui/ws/window_server.cc
index 50ed7c452b2d7d8b592622873dc165421f9fb8c8..5bc9cd0cf08ae183b19f97f0c0c045bffb156733 100644
--- a/services/ui/ws/window_server.cc
+++ b/services/ui/ws/window_server.cc
@@ -69,7 +69,8 @@ WindowServer::WindowServer(WindowServerDelegate* delegate)
next_wm_change_id_(0),
gpu_host_(new GpuHost(this)),
window_manager_window_tree_factory_set_(this, &user_id_tracker_),
- frame_sink_manager_client_binding_(this) {
+ frame_sink_manager_client_binding_(this),
+ weak_ptr_factory_(this) {
user_id_tracker_.AddObserver(this);
OnUserIdAdded(user_id_tracker_.active_id());
gpu_host_->CreateFrameSinkManager(
@@ -598,9 +599,9 @@ void WindowServer::UpdateNativeCursorFromMouseLocation(ServerWindow* window) {
if (display_root) {
EventDispatcher* event_dispatcher =
display_root->window_manager_state()->event_dispatcher();
- event_dispatcher->UpdateCursorProviderByLastKnownLocation();
- display_root->display()->UpdateNativeCursor(
- event_dispatcher->GetCurrentMouseCursor());
+ event_dispatcher->UpdateCursorProviderByLastKnownLocation(
+ base::Bind(&WindowServer::OnCursorUpdated,
+ weak_ptr_factory_.GetWeakPtr(), display_root));
sky 2017/05/15 21:20:23 In this code you shouldn't need a weakptrfactory a
riajiang 2017/05/17 02:01:59 Ah I see. And deleted this since not passing a cal
}
}
@@ -615,9 +616,16 @@ void WindowServer::UpdateNativeCursorIfOver(ServerWindow* window) {
if (window != event_dispatcher->GetWindowForMouseCursor())
return;
- event_dispatcher->UpdateNonClientAreaForCurrentWindow();
+ event_dispatcher->UpdateNonClientAreaForCurrentWindow(
+ base::Bind(&WindowServer::OnCursorUpdated, weak_ptr_factory_.GetWeakPtr(),
+ display_root));
+}
+
+void WindowServer::OnCursorUpdated(WindowManagerDisplayRoot* display_root) {
sky 2017/05/15 21:20:24 Style guide says position of declaration and defin
display_root->display()->UpdateNativeCursor(
- event_dispatcher->GetCurrentMouseCursor());
+ display_root->window_manager_state()
+ ->event_dispatcher()
+ ->GetCurrentMouseCursor());
}
bool WindowServer::IsUserInHighContrastMode(const UserId& user) const {
« services/ui/ws/window_manager_state.cc ('K') | « services/ui/ws/window_server.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698