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