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

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

Issue 2584193002: Revert of Delay Input.dispatchKeyEvent response until after key event ack. (Closed)
Patch Set: 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);
2159 2157
2160 const bool processed = (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result); 2158 const bool processed = (INPUT_EVENT_ACK_STATE_CONSUMED == ack_result);
2161 2159
2162 // We only send unprocessed key event upwards if we are not hidden, 2160 // We only send unprocessed key event upwards if we are not hidden,
2163 // because the user has moved away from us and no longer expect any effect 2161 // because the user has moved away from us and no longer expect any effect
2164 // of this key event. 2162 // of this key event.
2165 if (delegate_ && !processed && !is_hidden() && !event.event.skip_in_browser) { 2163 if (delegate_ && !processed && !is_hidden() && !event.event.skip_in_browser) {
2166 delegate_->HandleKeyboardEvent(event.event); 2164 delegate_->HandleKeyboardEvent(event.event);
2167 2165
2168 // WARNING: This RenderWidgetHostImpl can be deallocated at this point 2166 // WARNING: This RenderWidgetHostImpl can be deallocated at this point
2169 // (i.e. in the case of Ctrl+W, where the call to 2167 // (i.e. in the case of Ctrl+W, where the call to
2170 // HandleKeyboardEvent destroys this RenderWidgetHostImpl). 2168 // HandleKeyboardEvent destroys this RenderWidgetHostImpl).
2171 } 2169 }
2172 } 2170 }
2173 2171
2174 void RenderWidgetHostImpl::OnMouseEventAck( 2172 void RenderWidgetHostImpl::OnMouseEventAck(
2175 const MouseEventWithLatencyInfo& mouse_event, 2173 const MouseEventWithLatencyInfo& mouse_event,
2176 InputEventAckState ack_result) { 2174 InputEventAckState ack_result) {
2177 latency_tracker_.OnInputEventAck(mouse_event.event, &mouse_event.latency, 2175 latency_tracker_.OnInputEventAck(mouse_event.event, &mouse_event.latency,
2178 ack_result); 2176 ack_result);
2179 for (auto& input_event_observer : input_event_observers_)
2180 input_event_observer.OnInputEventAck(mouse_event.event);
2181 } 2177 }
2182 2178
2183 void RenderWidgetHostImpl::OnWheelEventAck( 2179 void RenderWidgetHostImpl::OnWheelEventAck(
2184 const MouseWheelEventWithLatencyInfo& wheel_event, 2180 const MouseWheelEventWithLatencyInfo& wheel_event,
2185 InputEventAckState ack_result) { 2181 InputEventAckState ack_result) {
2186 latency_tracker_.OnInputEventAck(wheel_event.event, &wheel_event.latency, 2182 latency_tracker_.OnInputEventAck(wheel_event.event, &wheel_event.latency,
2187 ack_result); 2183 ack_result);
2188 for (auto& input_event_observer : input_event_observers_)
2189 input_event_observer.OnInputEventAck(wheel_event.event);
2190 2184
2191 if (!is_hidden() && view_) { 2185 if (!is_hidden() && view_) {
2192 if (ack_result != INPUT_EVENT_ACK_STATE_CONSUMED && 2186 if (ack_result != INPUT_EVENT_ACK_STATE_CONSUMED &&
2193 delegate_ && delegate_->HandleWheelEvent(wheel_event.event)) { 2187 delegate_ && delegate_->HandleWheelEvent(wheel_event.event)) {
2194 ack_result = INPUT_EVENT_ACK_STATE_CONSUMED; 2188 ack_result = INPUT_EVENT_ACK_STATE_CONSUMED;
2195 } 2189 }
2196 view_->WheelEventAck(wheel_event.event, ack_result); 2190 view_->WheelEventAck(wheel_event.event, ack_result);
2197 } 2191 }
2198 } 2192 }
2199 2193
2200 void RenderWidgetHostImpl::OnGestureEventAck( 2194 void RenderWidgetHostImpl::OnGestureEventAck(
2201 const GestureEventWithLatencyInfo& event, 2195 const GestureEventWithLatencyInfo& event,
2202 InputEventAckState ack_result) { 2196 InputEventAckState ack_result) {
2203 latency_tracker_.OnInputEventAck(event.event, &event.latency, ack_result); 2197 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);
2206 2198
2207 if (view_) 2199 if (view_)
2208 view_->GestureEventAck(event.event, ack_result); 2200 view_->GestureEventAck(event.event, ack_result);
2209 } 2201 }
2210 2202
2211 void RenderWidgetHostImpl::OnTouchEventAck( 2203 void RenderWidgetHostImpl::OnTouchEventAck(
2212 const TouchEventWithLatencyInfo& event, 2204 const TouchEventWithLatencyInfo& event,
2213 InputEventAckState ack_result) { 2205 InputEventAckState ack_result) {
2214 latency_tracker_.OnInputEventAck(event.event, &event.latency, ack_result); 2206 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);
2217 2207
2218 if (touch_emulator_ && 2208 if (touch_emulator_ &&
2219 touch_emulator_->HandleTouchEventAck(event.event, ack_result)) { 2209 touch_emulator_->HandleTouchEventAck(event.event, ack_result)) {
2220 return; 2210 return;
2221 } 2211 }
2222 2212
2223 if (view_) 2213 if (view_)
2224 view_->ProcessAckedTouchEvent(event, ack_result); 2214 view_->ProcessAckedTouchEvent(event, ack_result);
2225 } 2215 }
2226 2216
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
2516 // different from the receiver's. 2506 // different from the receiver's.
2517 file_system_file.url = 2507 file_system_file.url =
2518 GURL(storage::GetIsolatedFileSystemRootURIString( 2508 GURL(storage::GetIsolatedFileSystemRootURIString(
2519 file_system_url.origin(), filesystem_id, std::string()) 2509 file_system_url.origin(), filesystem_id, std::string())
2520 .append(register_name)); 2510 .append(register_name));
2521 file_system_file.filesystem_id = filesystem_id; 2511 file_system_file.filesystem_id = filesystem_id;
2522 } 2512 }
2523 } 2513 }
2524 2514
2525 } // namespace content 2515 } // 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