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

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

Issue 120513005: [Android] Perform eager gesture recognition on MotionEvents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More testing Created 6 years, 10 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 (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_view_android.h" 5 #include "content/browser/renderer_host/render_widget_host_view_android.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 bool is_pinned_to_left, bool is_pinned_to_right) { 1094 bool is_pinned_to_left, bool is_pinned_to_right) {
1095 // intentionally empty, like RenderWidgetHostViewViews 1095 // intentionally empty, like RenderWidgetHostViewViews
1096 } 1096 }
1097 1097
1098 void RenderWidgetHostViewAndroid::UnhandledWheelEvent( 1098 void RenderWidgetHostViewAndroid::UnhandledWheelEvent(
1099 const blink::WebMouseWheelEvent& event) { 1099 const blink::WebMouseWheelEvent& event) {
1100 // intentionally empty, like RenderWidgetHostViewViews 1100 // intentionally empty, like RenderWidgetHostViewViews
1101 } 1101 }
1102 1102
1103 void RenderWidgetHostViewAndroid::GestureEventAck( 1103 void RenderWidgetHostViewAndroid::GestureEventAck(
1104 int gesture_event_type, 1104 const blink::WebGestureEvent& event,
1105 InputEventAckState ack_result) { 1105 InputEventAckState ack_result) {
1106 // Scroll events. 1106 if (content_view_core_)
1107 if (gesture_event_type == blink::WebInputEvent::GestureScrollBegin) { 1107 content_view_core_->OnGestureEventAck(event, ack_result);
1108 content_view_core_->OnScrollBeginEventAck();
1109 }
1110 if (gesture_event_type == blink::WebInputEvent::GestureScrollUpdate &&
1111 ack_result == INPUT_EVENT_ACK_STATE_CONSUMED) {
1112 content_view_core_->OnScrollUpdateGestureConsumed();
1113 }
1114 if (gesture_event_type == blink::WebInputEvent::GestureScrollEnd) {
1115 content_view_core_->OnScrollEndEventAck();
1116 }
1117
1118 // Fling events.
1119 if (gesture_event_type == blink::WebInputEvent::GestureFlingStart) {
1120 content_view_core_->OnFlingStartEventAck(ack_result);
1121 }
1122 } 1108 }
1123 1109
1124 InputEventAckState RenderWidgetHostViewAndroid::FilterInputEvent( 1110 InputEventAckState RenderWidgetHostViewAndroid::FilterInputEvent(
1125 const blink::WebInputEvent& input_event) { 1111 const blink::WebInputEvent& input_event) {
1112 if (content_view_core_ &&
1113 content_view_core_->FilterInputEvent(input_event))
1114 return INPUT_EVENT_ACK_STATE_CONSUMED;
1115
1126 if (!host_) 1116 if (!host_)
1127 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED; 1117 return INPUT_EVENT_ACK_STATE_NOT_CONSUMED;
1128 1118
1129 if (input_event.type == blink::WebInputEvent::GestureTapDown || 1119 if (input_event.type == blink::WebInputEvent::GestureTapDown ||
1130 input_event.type == blink::WebInputEvent::TouchStart) { 1120 input_event.type == blink::WebInputEvent::TouchStart) {
1131 GpuDataManagerImpl* gpu_data = GpuDataManagerImpl::GetInstance(); 1121 GpuDataManagerImpl* gpu_data = GpuDataManagerImpl::GetInstance();
1132 GpuProcessHostUIShim* shim = GpuProcessHostUIShim::GetOneInstance(); 1122 GpuProcessHostUIShim* shim = GpuProcessHostUIShim::GetOneInstance();
1133 if (shim && gpu_data && accelerated_surface_route_id_ && 1123 if (shim && gpu_data && accelerated_surface_route_id_ &&
1134 gpu_data->IsDriverBugWorkaroundActive(gpu::WAKE_UP_GPU_BEFORE_DRAWING)) 1124 gpu_data->IsDriverBugWorkaroundActive(gpu::WAKE_UP_GPU_BEFORE_DRAWING))
1135 shim->Send( 1125 shim->Send(
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1234 if (host_) 1224 if (host_)
1235 host_->ForwardKeyboardEvent(event); 1225 host_->ForwardKeyboardEvent(event);
1236 } 1226 }
1237 1227
1238 void RenderWidgetHostViewAndroid::SendTouchEvent( 1228 void RenderWidgetHostViewAndroid::SendTouchEvent(
1239 const blink::WebTouchEvent& event) { 1229 const blink::WebTouchEvent& event) {
1240 if (host_) 1230 if (host_)
1241 host_->ForwardTouchEventWithLatencyInfo(event, CreateLatencyInfo(event)); 1231 host_->ForwardTouchEventWithLatencyInfo(event, CreateLatencyInfo(event));
1242 } 1232 }
1243 1233
1244
1245 void RenderWidgetHostViewAndroid::SendMouseEvent( 1234 void RenderWidgetHostViewAndroid::SendMouseEvent(
1246 const blink::WebMouseEvent& event) { 1235 const blink::WebMouseEvent& event) {
1247 if (host_) 1236 if (host_)
1248 host_->ForwardMouseEvent(event); 1237 host_->ForwardMouseEvent(event);
1249 } 1238 }
1250 1239
1251 void RenderWidgetHostViewAndroid::SendMouseWheelEvent( 1240 void RenderWidgetHostViewAndroid::SendMouseWheelEvent(
1252 const blink::WebMouseWheelEvent& event) { 1241 const blink::WebMouseWheelEvent& event) {
1253 if (host_) 1242 if (host_)
1254 host_->ForwardWheelEvent(event); 1243 host_->ForwardWheelEvent(event);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1360 obj = content_view_core_->GetJavaObject(); 1349 obj = content_view_core_->GetJavaObject();
1361 GetBrowserAccessibilityManager()->ToBrowserAccessibilityManagerAndroid()-> 1350 GetBrowserAccessibilityManager()->ToBrowserAccessibilityManagerAndroid()->
1362 SetContentViewCore(obj); 1351 SetContentViewCore(obj);
1363 } 1352 }
1364 1353
1365 if (are_layers_attached_) { 1354 if (are_layers_attached_) {
1366 AttachLayers(); 1355 AttachLayers();
1367 if (content_view_core_ && !using_synchronous_compositor_) 1356 if (content_view_core_ && !using_synchronous_compositor_)
1368 content_view_core_->GetWindowAndroid()->AddObserver(this); 1357 content_view_core_->GetWindowAndroid()->AddObserver(this);
1369 } 1358 }
1370
1371 // Ensure ContentsViewCore is aware of the current touch handling state, eg.
1372 // in case we've already been running JS for the page as part of preload.
1373 if (content_view_core_ && host_)
1374 content_view_core_->HasTouchEventHandlers(host_->has_touch_handler());
1375 } 1359 }
1376 1360
1377 void RenderWidgetHostViewAndroid::RunAckCallbacks() { 1361 void RenderWidgetHostViewAndroid::RunAckCallbacks() {
1378 while (!ack_callbacks_.empty()) { 1362 while (!ack_callbacks_.empty()) {
1379 ack_callbacks_.front().Run(); 1363 ack_callbacks_.front().Run();
1380 ack_callbacks_.pop(); 1364 ack_callbacks_.pop();
1381 } 1365 }
1382 } 1366 }
1383 1367
1384 void RenderWidgetHostViewAndroid::HasTouchEventHandlers( 1368 void RenderWidgetHostViewAndroid::HasTouchEventHandlers(
1385 bool need_touch_events) { 1369 bool need_touch_events) {
1386 if (content_view_core_)
1387 content_view_core_->HasTouchEventHandlers(need_touch_events);
1388 } 1370 }
1389 1371
1390 void RenderWidgetHostViewAndroid::OnCompositingDidCommit() { 1372 void RenderWidgetHostViewAndroid::OnCompositingDidCommit() {
1391 RunAckCallbacks(); 1373 RunAckCallbacks();
1392 } 1374 }
1393 1375
1394 void RenderWidgetHostViewAndroid::OnDetachCompositor() { 1376 void RenderWidgetHostViewAndroid::OnDetachCompositor() {
1395 DCHECK(content_view_core_); 1377 DCHECK(content_view_core_);
1396 DCHECK(!using_synchronous_compositor_); 1378 DCHECK(!using_synchronous_compositor_);
1397 RunAckCallbacks(); 1379 RunAckCallbacks();
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1510 // RenderWidgetHostView, public: 1492 // RenderWidgetHostView, public:
1511 1493
1512 // static 1494 // static
1513 RenderWidgetHostView* 1495 RenderWidgetHostView*
1514 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { 1496 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) {
1515 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); 1497 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget);
1516 return new RenderWidgetHostViewAndroid(rwhi, NULL); 1498 return new RenderWidgetHostViewAndroid(rwhi, NULL);
1517 } 1499 }
1518 1500
1519 } // namespace content 1501 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698