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

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

Issue 535453002: [Android] Always request BeginFrame when touch received (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup Created 6 years, 3 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
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/android/build_info.h" 9 #include "base/android/build_info.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 return true; 677 return true;
678 678
679 if (!gesture_provider_.OnTouchEvent(event)) 679 if (!gesture_provider_.OnTouchEvent(event))
680 return false; 680 return false;
681 681
682 if (gesture_text_selector_.OnTouchEvent(event)) { 682 if (gesture_text_selector_.OnTouchEvent(event)) {
683 gesture_provider_.OnTouchEventAck(false); 683 gesture_provider_.OnTouchEventAck(false);
684 return true; 684 return true;
685 } 685 }
686 686
687 // Short-circuit touch forwarding if no touch handlers exist. 687 if (host_->ShouldForwardTouchEvent()) {
688 if (!host_->ShouldForwardTouchEvent()) { 688 blink::WebTouchEvent web_event = CreateWebTouchEventFromMotionEvent(event);
689 host_->ForwardTouchEventWithLatencyInfo(web_event,
690 CreateLatencyInfo(web_event));
691 } else {
689 const bool event_consumed = false; 692 const bool event_consumed = false;
690 gesture_provider_.OnTouchEventAck(event_consumed); 693 gesture_provider_.OnTouchEventAck(event_consumed);
691 return true;
692 } 694 }
693 695
694 SendTouchEvent(CreateWebTouchEventFromMotionEvent(event)); 696 // Send a proactive BeginFrame on the next vsync to reduce latency.
697 // This is good enough as long as the first touch event has Begin semantics
698 // and the actual scroll happens on the next vsync.
699 if (observing_root_window_)
700 RequestVSyncUpdate(BEGIN_FRAME);
701
695 return true; 702 return true;
696 } 703 }
697 704
698 bool RenderWidgetHostViewAndroid::OnTouchHandleEvent( 705 bool RenderWidgetHostViewAndroid::OnTouchHandleEvent(
699 const ui::MotionEvent& event) { 706 const ui::MotionEvent& event) {
700 return selection_controller_ && 707 return selection_controller_ &&
701 selection_controller_->WillHandleTouchEvent(event); 708 selection_controller_->WillHandleTouchEvent(event);
702 } 709 }
703 710
704 void RenderWidgetHostViewAndroid::ResetGestureDetection() { 711 void RenderWidgetHostViewAndroid::ResetGestureDetection() {
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
1501 } 1508 }
1502 1509
1503 // Methods called from the host to the render 1510 // Methods called from the host to the render
1504 1511
1505 void RenderWidgetHostViewAndroid::SendKeyEvent( 1512 void RenderWidgetHostViewAndroid::SendKeyEvent(
1506 const NativeWebKeyboardEvent& event) { 1513 const NativeWebKeyboardEvent& event) {
1507 if (host_) 1514 if (host_)
1508 host_->ForwardKeyboardEvent(event); 1515 host_->ForwardKeyboardEvent(event);
1509 } 1516 }
1510 1517
1511 void RenderWidgetHostViewAndroid::SendTouchEvent(
1512 const blink::WebTouchEvent& event) {
1513 if (host_)
1514 host_->ForwardTouchEventWithLatencyInfo(event, CreateLatencyInfo(event));
1515
1516 // Send a proactive BeginFrame on the next vsync to reduce latency.
1517 // This is good enough as long as the first touch event has Begin semantics
1518 // and the actual scroll happens on the next vsync.
1519 // TODO: Is this actually still needed?
1520 if (observing_root_window_)
1521 RequestVSyncUpdate(BEGIN_FRAME);
1522 }
1523
1524 void RenderWidgetHostViewAndroid::SendMouseEvent( 1518 void RenderWidgetHostViewAndroid::SendMouseEvent(
1525 const blink::WebMouseEvent& event) { 1519 const blink::WebMouseEvent& event) {
1526 if (host_) 1520 if (host_)
1527 host_->ForwardMouseEvent(event); 1521 host_->ForwardMouseEvent(event);
1528 } 1522 }
1529 1523
1530 void RenderWidgetHostViewAndroid::SendMouseWheelEvent( 1524 void RenderWidgetHostViewAndroid::SendMouseWheelEvent(
1531 const blink::WebMouseWheelEvent& event) { 1525 const blink::WebMouseWheelEvent& event) {
1532 if (host_) 1526 if (host_)
1533 host_->ForwardWheelEvent(event); 1527 host_->ForwardWheelEvent(event);
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
1856 results->orientationAngle = display.RotationAsDegree(); 1850 results->orientationAngle = display.RotationAsDegree();
1857 results->orientationType = 1851 results->orientationType =
1858 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); 1852 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display);
1859 gfx::DeviceDisplayInfo info; 1853 gfx::DeviceDisplayInfo info;
1860 results->depth = info.GetBitsPerPixel(); 1854 results->depth = info.GetBitsPerPixel();
1861 results->depthPerComponent = info.GetBitsPerComponent(); 1855 results->depthPerComponent = info.GetBitsPerComponent();
1862 results->isMonochrome = (results->depthPerComponent == 0); 1856 results->isMonochrome = (results->depthPerComponent == 0);
1863 } 1857 }
1864 1858
1865 } // namespace content 1859 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698