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

Side by Side Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 2581153003: Reland of Delay Input.dispatchKeyEvent response until after key event ack. (Closed)
Patch Set: rebase and resolve merge conflicts Created 4 years 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_impl.h" 5 #include "content/browser/renderer_host/render_widget_host_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <set> 9 #include <set>
10 #include <tuple> 10 #include <tuple>
(...skipping 2136 matching lines...) Expand 10 before | Expand all | Expand 10 after
2147 ui::LatencyInfo* latency) { 2147 ui::LatencyInfo* latency) {
2148 latency_tracker_.OnInputEvent(event, latency); 2148 latency_tracker_.OnInputEvent(event, latency);
2149 for (auto& observer : input_event_observers_) 2149 for (auto& observer : input_event_observers_)
2150 observer.OnInputEvent(event); 2150 observer.OnInputEvent(event);
2151 } 2151 }
2152 2152
2153 void RenderWidgetHostImpl::OnKeyboardEventAck( 2153 void RenderWidgetHostImpl::OnKeyboardEventAck(
2154 const NativeWebKeyboardEventWithLatencyInfo& event, 2154 const NativeWebKeyboardEventWithLatencyInfo& event,
2155 InputEventAckState ack_result) { 2155 InputEventAckState ack_result) {
2156 latency_tracker_.OnInputEventAck(event.event, &event.latency, ack_result); 2156 latency_tracker_.OnInputEventAck(event.event, &event.latency, ack_result);
2157 for (auto& input_event_observer : input_event_observers_)
2158 input_event_observer.OnInputEventAck(event.event);
2157 2159
2158 const bool processed = (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result); 2160 const bool processed = (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result);
2159 2161
2160 // We only send unprocessed key event upwards if we are not hidden, 2162 // We only send unprocessed key event upwards if we are not hidden,
2161 // because the user has moved away from us and no longer expect any effect 2163 // because the user has moved away from us and no longer expect any effect
2162 // of this key event. 2164 // of this key event.
2163 if (delegate_ && !processed && !is_hidden() && !event.event.skip_in_browser) { 2165 if (delegate_ && !processed && !is_hidden() && !event.event.skip_in_browser) {
2164 delegate_->HandleKeyboardEvent(event.event); 2166 delegate_->HandleKeyboardEvent(event.event);
2165 2167
2166 // WARNING: This RenderWidgetHostImpl can be deallocated at this point 2168 // WARNING: This RenderWidgetHostImpl can be deallocated at this point
2167 // (i.e. in the case of Ctrl+W, where the call to 2169 // (i.e. in the case of Ctrl+W, where the call to
2168 // HandleKeyboardEvent destroys this RenderWidgetHostImpl). 2170 // HandleKeyboardEvent destroys this RenderWidgetHostImpl).
2169 } 2171 }
2170 } 2172 }
2171 2173
2172 void RenderWidgetHostImpl::OnMouseEventAck( 2174 void RenderWidgetHostImpl::OnMouseEventAck(
2173 const MouseEventWithLatencyInfo& mouse_event, 2175 const MouseEventWithLatencyInfo& mouse_event,
2174 InputEventAckState ack_result) { 2176 InputEventAckState ack_result) {
2175 latency_tracker_.OnInputEventAck(mouse_event.event, &mouse_event.latency, 2177 latency_tracker_.OnInputEventAck(mouse_event.event, &mouse_event.latency,
2176 ack_result); 2178 ack_result);
2179 for (auto& input_event_observer : input_event_observers_)
2180 input_event_observer.OnInputEventAck(mouse_event.event);
2177 } 2181 }
2178 2182
2179 void RenderWidgetHostImpl::OnWheelEventAck( 2183 void RenderWidgetHostImpl::OnWheelEventAck(
2180 const MouseWheelEventWithLatencyInfo& wheel_event, 2184 const MouseWheelEventWithLatencyInfo& wheel_event,
2181 InputEventAckState ack_result) { 2185 InputEventAckState ack_result) {
2182 latency_tracker_.OnInputEventAck(wheel_event.event, &wheel_event.latency, 2186 latency_tracker_.OnInputEventAck(wheel_event.event, &wheel_event.latency,
2183 ack_result); 2187 ack_result);
2188 for (auto& input_event_observer : input_event_observers_)
2189 input_event_observer.OnInputEventAck(wheel_event.event);
2184 2190
2185 if (!is_hidden() && view_) { 2191 if (!is_hidden() && view_) {
2186 if (ack_result != INPUT_EVENT_ACK_STATE_CONSUMED && 2192 if (ack_result != INPUT_EVENT_ACK_STATE_CONSUMED &&
2187 delegate_ && delegate_->HandleWheelEvent(wheel_event.event)) { 2193 delegate_ && delegate_->HandleWheelEvent(wheel_event.event)) {
2188 ack_result = INPUT_EVENT_ACK_STATE_CONSUMED; 2194 ack_result = INPUT_EVENT_ACK_STATE_CONSUMED;
2189 } 2195 }
2190 view_->WheelEventAck(wheel_event.event, ack_result); 2196 view_->WheelEventAck(wheel_event.event, ack_result);
2191 } 2197 }
2192 } 2198 }
2193 2199
2194 void RenderWidgetHostImpl::OnGestureEventAck( 2200 void RenderWidgetHostImpl::OnGestureEventAck(
2195 const GestureEventWithLatencyInfo& event, 2201 const GestureEventWithLatencyInfo& event,
2196 InputEventAckState ack_result) { 2202 InputEventAckState ack_result) {
2197 latency_tracker_.OnInputEventAck(event.event, &event.latency, ack_result); 2203 latency_tracker_.OnInputEventAck(event.event, &event.latency, ack_result);
2204 for (auto& input_event_observer : input_event_observers_)
2205 input_event_observer.OnInputEventAck(event.event);
2198 2206
2199 if (view_) 2207 if (view_)
2200 view_->GestureEventAck(event.event, ack_result); 2208 view_->GestureEventAck(event.event, ack_result);
2201 } 2209 }
2202 2210
2203 void RenderWidgetHostImpl::OnTouchEventAck( 2211 void RenderWidgetHostImpl::OnTouchEventAck(
2204 const TouchEventWithLatencyInfo& event, 2212 const TouchEventWithLatencyInfo& event,
2205 InputEventAckState ack_result) { 2213 InputEventAckState ack_result) {
2206 latency_tracker_.OnInputEventAck(event.event, &event.latency, ack_result); 2214 latency_tracker_.OnInputEventAck(event.event, &event.latency, ack_result);
2215 for (auto& input_event_observer : input_event_observers_)
2216 input_event_observer.OnInputEventAck(event.event);
2207 2217
2208 if (touch_emulator_ && 2218 if (touch_emulator_ &&
2209 touch_emulator_->HandleTouchEventAck(event.event, ack_result)) { 2219 touch_emulator_->HandleTouchEventAck(event.event, ack_result)) {
2210 return; 2220 return;
2211 } 2221 }
2212 2222
2213 if (view_) 2223 if (view_)
2214 view_->ProcessAckedTouchEvent(event, ack_result); 2224 view_->ProcessAckedTouchEvent(event, ack_result);
2215 } 2225 }
2216 2226
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
2506 // different from the receiver's. 2516 // different from the receiver's.
2507 file_system_file.url = 2517 file_system_file.url =
2508 GURL(storage::GetIsolatedFileSystemRootURIString( 2518 GURL(storage::GetIsolatedFileSystemRootURIString(
2509 file_system_url.origin(), filesystem_id, std::string()) 2519 file_system_url.origin(), filesystem_id, std::string())
2510 .append(register_name)); 2520 .append(register_name));
2511 file_system_file.filesystem_id = filesystem_id; 2521 file_system_file.filesystem_id = filesystem_id;
2512 } 2522 }
2513 } 2523 }
2514 2524
2515 } // namespace content 2525 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/devtools/render_frame_devtools_agent_host.cc ('k') | content/public/browser/render_widget_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698