| OLD | NEW | 
|---|
| 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 <utility> | 9 #include <utility> | 
| 10 | 10 | 
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 443       is_window_activity_started_(true), | 443       is_window_activity_started_(true), | 
| 444       content_view_core_(nullptr), | 444       content_view_core_(nullptr), | 
| 445       ime_adapter_android_(this), | 445       ime_adapter_android_(this), | 
| 446       cached_background_color_(SK_ColorWHITE), | 446       cached_background_color_(SK_ColorWHITE), | 
| 447       last_compositor_frame_sink_id_(kUndefinedCompositorFrameSinkId), | 447       last_compositor_frame_sink_id_(kUndefinedCompositorFrameSinkId), | 
| 448       gesture_provider_(ui::GetGestureProviderConfig( | 448       gesture_provider_(ui::GetGestureProviderConfig( | 
| 449                             ui::GestureProviderConfigType::CURRENT_PLATFORM), | 449                             ui::GestureProviderConfigType::CURRENT_PLATFORM), | 
| 450                         this), | 450                         this), | 
| 451       stylus_text_selector_(this), | 451       stylus_text_selector_(this), | 
| 452       using_browser_compositor_(CompositorImpl::IsInitialized()), | 452       using_browser_compositor_(CompositorImpl::IsInitialized()), | 
| 453       synchronous_compositor_client_(nullptr), |  | 
| 454       frame_evictor_(new DelegatedFrameEvictor(this)), | 453       frame_evictor_(new DelegatedFrameEvictor(this)), | 
| 455       locks_on_frame_count_(0), | 454       locks_on_frame_count_(0), | 
| 456       observing_root_window_(false), | 455       observing_root_window_(false), | 
| 457       weak_ptr_factory_(this) { | 456       weak_ptr_factory_(this) { | 
| 458   // Set the layer which will hold the content layer for this view. The content | 457   // Set the layer which will hold the content layer for this view. The content | 
| 459   // layer is managed by the DelegatedFrameHost. | 458   // layer is managed by the DelegatedFrameHost. | 
| 460   view_.SetLayer(cc::Layer::Create()); | 459   view_.SetLayer(cc::Layer::Create()); | 
| 461   if (using_browser_compositor_) { | 460   if (using_browser_compositor_) { | 
| 462     delegated_frame_host_.reset(new ui::DelegatedFrameHostAndroid( | 461     delegated_frame_host_.reset(new ui::DelegatedFrameHostAndroid( | 
| 463         &view_, cached_background_color_, | 462         &view_, cached_background_color_, | 
| (...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1199     // Unblock the compositor. | 1198     // Unblock the compositor. | 
| 1200     BrowserThread::PostTask( | 1199     BrowserThread::PostTask( | 
| 1201         BrowserThread::UI, FROM_HERE, | 1200         BrowserThread::UI, FROM_HERE, | 
| 1202         base::Bind( | 1201         base::Bind( | 
| 1203             &RenderFrameDevToolsAgentHost::SynchronousSwapCompositorFrame, | 1202             &RenderFrameDevToolsAgentHost::SynchronousSwapCompositorFrame, | 
| 1204             static_cast<RenderFrameDevToolsAgentHost*>(dtah.get()), | 1203             static_cast<RenderFrameDevToolsAgentHost*>(dtah.get()), | 
| 1205             base::Passed(&frame_metadata))); | 1204             base::Passed(&frame_metadata))); | 
| 1206   } | 1205   } | 
| 1207 } | 1206 } | 
| 1208 | 1207 | 
| 1209 void RenderWidgetHostViewAndroid::SetSynchronousCompositorClient( |  | 
| 1210       SynchronousCompositorClient* client) { |  | 
| 1211   synchronous_compositor_client_ = client; |  | 
| 1212   if (!sync_compositor_ && synchronous_compositor_client_) { |  | 
| 1213     sync_compositor_ = SynchronousCompositorHost::Create(this); |  | 
| 1214   } |  | 
| 1215 } |  | 
| 1216 |  | 
| 1217 bool RenderWidgetHostViewAndroid::SupportsAnimation() const { | 1208 bool RenderWidgetHostViewAndroid::SupportsAnimation() const { | 
| 1218   // The synchronous (WebView) compositor does not have a proper browser | 1209   // The synchronous (WebView) compositor does not have a proper browser | 
| 1219   // compositor with which to drive animations. | 1210   // compositor with which to drive animations. | 
| 1220   return using_browser_compositor_; | 1211   return using_browser_compositor_; | 
| 1221 } | 1212 } | 
| 1222 | 1213 | 
| 1223 void RenderWidgetHostViewAndroid::SetNeedsAnimate() { | 1214 void RenderWidgetHostViewAndroid::SetNeedsAnimate() { | 
| 1224   DCHECK(view_.GetWindowAndroid()); | 1215   DCHECK(view_.GetWindowAndroid()); | 
| 1225   DCHECK(using_browser_compositor_); | 1216   DCHECK(using_browser_compositor_); | 
| 1226   view_.GetWindowAndroid()->SetNeedsAnimate(); | 1217   view_.GetWindowAndroid()->SetNeedsAnimate(); | 
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1790     WasResized(); | 1781     WasResized(); | 
| 1791 | 1782 | 
| 1792   if (!selection_controller_) | 1783   if (!selection_controller_) | 
| 1793     selection_controller_ = CreateSelectionController(this, content_view_core_); | 1784     selection_controller_ = CreateSelectionController(this, content_view_core_); | 
| 1794 | 1785 | 
| 1795   if (!overscroll_controller_ && | 1786   if (!overscroll_controller_ && | 
| 1796       view_.GetWindowAndroid()->GetCompositor()) { | 1787       view_.GetWindowAndroid()->GetCompositor()) { | 
| 1797     overscroll_controller_ = CreateOverscrollController( | 1788     overscroll_controller_ = CreateOverscrollController( | 
| 1798         content_view_core_, ui::GetScaleFactorForNativeView(GetNativeView())); | 1789         content_view_core_, ui::GetScaleFactorForNativeView(GetNativeView())); | 
| 1799   } | 1790   } | 
|  | 1791 | 
|  | 1792   if (!sync_compositor_) { | 
|  | 1793     sync_compositor_ = SynchronousCompositorHost::Create( | 
|  | 1794         this, content_view_core_->GetWebContents()); | 
|  | 1795   } | 
| 1800 } | 1796 } | 
| 1801 | 1797 | 
| 1802 void RenderWidgetHostViewAndroid::RunAckCallbacks() { | 1798 void RenderWidgetHostViewAndroid::RunAckCallbacks() { | 
| 1803   while (!ack_callbacks_.empty()) { | 1799   while (!ack_callbacks_.empty()) { | 
| 1804     ack_callbacks_.front().Run(); | 1800     ack_callbacks_.front().Run(); | 
| 1805     ack_callbacks_.pop(); | 1801     ack_callbacks_.pop(); | 
| 1806   } | 1802   } | 
| 1807 } | 1803 } | 
| 1808 | 1804 | 
| 1809 void RenderWidgetHostViewAndroid::OnGestureEvent( | 1805 void RenderWidgetHostViewAndroid::OnGestureEvent( | 
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1970     case ui::MotionEvent::ACTION_UP: | 1966     case ui::MotionEvent::ACTION_UP: | 
| 1971     case ui::MotionEvent::ACTION_POINTER_UP: | 1967     case ui::MotionEvent::ACTION_POINTER_UP: | 
| 1972       UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", | 1968       UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", | 
| 1973                                   delta.InMicroseconds(), 1, 1000000, 50); | 1969                                   delta.InMicroseconds(), 1, 1000000, 50); | 
| 1974     default: | 1970     default: | 
| 1975       return; | 1971       return; | 
| 1976   } | 1972   } | 
| 1977 } | 1973 } | 
| 1978 | 1974 | 
| 1979 }  // namespace content | 1975 }  // namespace content | 
| OLD | NEW | 
|---|