Chromium Code Reviews| 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 { |