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

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

Issue 457913002: Android WebView: flush input events during onVSync (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: register observer only for synthetic gestures Created 6 years, 4 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 | « no previous file | 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/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 void RenderWidgetHostViewAndroid::ShowDisambiguationPopup( 804 void RenderWidgetHostViewAndroid::ShowDisambiguationPopup(
805 const gfx::Rect& target_rect, const SkBitmap& zoomed_bitmap) { 805 const gfx::Rect& target_rect, const SkBitmap& zoomed_bitmap) {
806 if (!content_view_core_) 806 if (!content_view_core_)
807 return; 807 return;
808 808
809 content_view_core_->ShowDisambiguationPopup(target_rect, zoomed_bitmap); 809 content_view_core_->ShowDisambiguationPopup(target_rect, zoomed_bitmap);
810 } 810 }
811 811
812 scoped_ptr<SyntheticGestureTarget> 812 scoped_ptr<SyntheticGestureTarget>
813 RenderWidgetHostViewAndroid::CreateSyntheticGestureTarget() { 813 RenderWidgetHostViewAndroid::CreateSyntheticGestureTarget() {
814 DCHECK(content_view_core_);
815 if (using_synchronous_compositor_) {
boliu 2014/08/19 22:54:39 && !observing_root_window_
hush (inactive) 2014/08/19 23:24:36 Done.
816 content_view_core_->GetWindowAndroid()->AddObserver(this);
817 observing_root_window_ = true;
818 }
819
814 return scoped_ptr<SyntheticGestureTarget>(new SyntheticGestureTargetAndroid( 820 return scoped_ptr<SyntheticGestureTarget>(new SyntheticGestureTargetAndroid(
815 host_, content_view_core_->CreateTouchEventSynthesizer())); 821 host_, content_view_core_->CreateTouchEventSynthesizer()));
816 } 822 }
817 823
818 void RenderWidgetHostViewAndroid::SendDelegatedFrameAck( 824 void RenderWidgetHostViewAndroid::SendDelegatedFrameAck(
819 uint32 output_surface_id) { 825 uint32 output_surface_id) {
820 DCHECK(host_); 826 DCHECK(host_);
821 cc::CompositorFrameAck ack; 827 cc::CompositorFrameAck ack;
822 if (resource_collection_.get()) 828 if (resource_collection_.get())
823 resource_collection_->TakeUnusedResourcesForChildCompositor(&ack.resources); 829 resource_collection_->TakeUnusedResourcesForChildCompositor(&ack.resources);
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
1522 base::TimeDelta vsync_period) { 1528 base::TimeDelta vsync_period) {
1523 TRACE_EVENT0("cc", "RenderWidgetHostViewAndroid::OnVSync"); 1529 TRACE_EVENT0("cc", "RenderWidgetHostViewAndroid::OnVSync");
1524 if (!host_) 1530 if (!host_)
1525 return; 1531 return;
1526 1532
1527 if (flush_input_requested_) { 1533 if (flush_input_requested_) {
1528 flush_input_requested_ = false; 1534 flush_input_requested_ = false;
1529 host_->FlushInput(); 1535 host_->FlushInput();
1530 } 1536 }
1531 1537
1538 if (using_synchronous_compositor_)
boliu 2014/08/19 22:54:39 Can we also remove this as observer if there are n
hush (inactive) 2014/08/19 23:24:36 I'm not sure you can do that... You can't know if
jdduke (slow) 2014/08/19 23:30:38 |DidFlushInput| will be called when synthetic *eve
boliu 2014/08/19 23:37:47 Never mind then. Maybe SyntheticGestureController
jdduke (slow) 2014/08/19 23:41:33 There are a couple one-off cases where we "kick st
hush (inactive) 2014/08/20 00:16:14 So there are 3 VSync Subscriber Types: input: only
jdduke (slow) 2014/08/20 00:21:33 Yup, that sounds about right. This way we can also
1539 return;
1540
1532 TRACE_EVENT0("cc", "RenderWidgetHostViewAndroid::SendBeginFrame"); 1541 TRACE_EVENT0("cc", "RenderWidgetHostViewAndroid::SendBeginFrame");
1533 base::TimeTicks display_time = frame_time + vsync_period; 1542 base::TimeTicks display_time = frame_time + vsync_period;
1534 1543
1535 // TODO(brianderson): Use adaptive draw-time estimation. 1544 // TODO(brianderson): Use adaptive draw-time estimation.
1536 base::TimeDelta estimated_browser_composite_time = 1545 base::TimeDelta estimated_browser_composite_time =
1537 base::TimeDelta::FromMicroseconds( 1546 base::TimeDelta::FromMicroseconds(
1538 (1.0f * base::Time::kMicrosecondsPerSecond) / (3.0f * 60)); 1547 (1.0f * base::Time::kMicrosecondsPerSecond) / (3.0f * 60));
1539 1548
1540 base::TimeTicks deadline = display_time - estimated_browser_composite_time; 1549 base::TimeTicks deadline = display_time - estimated_browser_composite_time;
1541 1550
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1691 results->orientationAngle = display.RotationAsDegree(); 1700 results->orientationAngle = display.RotationAsDegree();
1692 results->orientationType = 1701 results->orientationType =
1693 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); 1702 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display);
1694 gfx::DeviceDisplayInfo info; 1703 gfx::DeviceDisplayInfo info;
1695 results->depth = info.GetBitsPerPixel(); 1704 results->depth = info.GetBitsPerPixel();
1696 results->depthPerComponent = info.GetBitsPerComponent(); 1705 results->depthPerComponent = info.GetBitsPerComponent();
1697 results->isMonochrome = (results->depthPerComponent == 0); 1706 results->isMonochrome = (results->depthPerComponent == 0);
1698 } 1707 }
1699 1708
1700 } // namespace content 1709 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698