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

Side by Side Diff: services/ui/ws/window_manager_state.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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "services/ui/ws/window_manager_state.h" 5 #include "services/ui/ws/window_manager_state.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 // The tree is no longer active, so no point in dispatching any further 283 // The tree is no longer active, so no point in dispatching any further
284 // events. 284 // events.
285 std::queue<std::unique_ptr<QueuedEvent>> event_queue; 285 std::queue<std::unique_ptr<QueuedEvent>> event_queue;
286 event_queue.swap(event_queue_); 286 event_queue.swap(event_queue_);
287 } 287 }
288 288
289 void WindowManagerState::ProcessEvent(const ui::Event& event, 289 void WindowManagerState::ProcessEvent(const ui::Event& event,
290 int64_t display_id) { 290 int64_t display_id) {
291 // If this is still waiting for an ack from a previously sent event, then 291 // If this is still waiting for an ack from a previously sent event, then
292 // queue up the event to be dispatched once the ack is received. 292 // queue up the event to be dispatched once the ack is received.
293 if (in_flight_event_details_) { 293 if (in_flight_event_details_ || event_dispatcher_.HittestInFlight()) {
sky 2017/05/15 21:20:23 The code you have here will only work if EventDisp
riajiang 2017/05/17 02:01:59 Actually I was looking at |in_flight_event_details
sky 2017/05/17 18:14:43 in_flight_event_details_ is only created from call
riajiang 2017/05/19 16:49:30 I ended up keeping event_dispatcher_.IsHitTestInFl
294 if (!event_queue_.empty() && !event_queue_.back()->processed_target && 294 if (!event_queue_.empty() && !event_queue_.back()->processed_target &&
295 EventsCanBeCoalesced(*event_queue_.back()->event, event)) { 295 EventsCanBeCoalesced(*event_queue_.back()->event, event)) {
296 event_queue_.back()->event = CoalesceEvents( 296 event_queue_.back()->event = CoalesceEvents(
297 std::move(event_queue_.back()->event), ui::Event::Clone(event)); 297 std::move(event_queue_.back()->event), ui::Event::Clone(event));
298 event_queue_.back()->display_id = display_id; 298 event_queue_.back()->display_id = display_id;
299 return; 299 return;
300 } 300 }
301 QueueEvent(event, nullptr, display_id); 301 QueueEvent(event, nullptr, display_id);
302 return; 302 return;
303 } 303 }
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 window->RemoveObserver(this); 712 window->RemoveObserver(this);
713 orphaned_window_manager_display_roots_.erase(iter); 713 orphaned_window_manager_display_roots_.erase(iter);
714 return; 714 return;
715 } 715 }
716 } 716 }
717 NOTREACHED(); 717 NOTREACHED();
718 } 718 }
719 719
720 } // namespace ws 720 } // namespace ws
721 } // namespace ui 721 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698