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

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

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