Chromium Code Reviews| Index: services/ui/ws/window_manager_state.cc |
| diff --git a/services/ui/ws/window_manager_state.cc b/services/ui/ws/window_manager_state.cc |
| index cbec88f4bf3d07554d355b0bf828ed0fe9aa3b49..0a759cd34e887eafd71933ee04c26d4e698f9c71 100644 |
| --- a/services/ui/ws/window_manager_state.cc |
| +++ b/services/ui/ws/window_manager_state.cc |
| @@ -215,8 +215,12 @@ void WindowManagerState::OnEventAck(mojom::WindowTree* tree, |
| tree_awaiting_input_ack_ = nullptr; |
| event_ack_timer_.Stop(); |
| - if (result == mojom::EventResult::UNHANDLED && post_target_accelerator_) { |
| - OnAccelerator(post_target_accelerator_->id(), *event_awaiting_input_ack_, |
| + base::WeakPtr<Accelerator> post_target_accelerator = post_target_accelerator_; |
| + post_target_accelerator_.reset(); |
| + |
| + if (result == mojom::EventResult::UNHANDLED && post_target_accelerator) { |
| + std::unique_ptr<ui::Event> event = std::move(event_awaiting_input_ack_); |
|
sadrul
2016/07/27 16:31:47
Should we always reset |event_awaiting_input_ack_|
sky
2016/07/27 16:34:49
Isn't that what the std::move does? Or did you mea
sadrul
2016/07/27 16:36:01
Yep. I mean, should we do that even if result != U
sky
2016/07/27 16:46:01
Ah, I got it. It doesn't matter because of Process
|
| + OnAccelerator(post_target_accelerator->id(), *event, |
| AcceleratorPhase::POST); |
| } |
| @@ -236,14 +240,14 @@ void WindowManagerState::OnAcceleratorAck(mojom::EventResult result) { |
| event_dispatch_phase_ = EventDispatchPhase::NONE; |
| if (result == mojom::EventResult::UNHANDLED) { |
| + std::unique_ptr<ui::Event> event = std::move(event_awaiting_input_ack_); |
| event_dispatcher_.ProcessEvent( |
| - *event_awaiting_input_ack_, |
| - EventDispatcher::AcceleratorMatchPhase::POST_ONLY); |
| + *event, EventDispatcher::AcceleratorMatchPhase::POST_ONLY); |
| } else { |
| // We're not going to process the event any further, notify event observers. |
| // We don't do this first to ensure we don't send an event twice to clients. |
| - window_server()->SendToEventObservers(*event_awaiting_input_ack_, user_id(), |
| - nullptr); |
| + std::unique_ptr<ui::Event> event = std::move(event_awaiting_input_ack_); |
| + window_server()->SendToEventObservers(*event, user_id(), nullptr); |
| ProcessNextEventFromQueue(); |
| } |
| } |