| 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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 while (RenderWidgetHost* widget = widgets->GetNextHost()) { | 428 while (RenderWidgetHost* widget = widgets->GetNextHost()) { |
| 429 if (widget->GetView()) { | 429 if (widget->GetView()) { |
| 430 static_cast<RenderWidgetHostViewAndroid*>(widget->GetView()) | 430 static_cast<RenderWidgetHostViewAndroid*>(widget->GetView()) |
| 431 ->OnLostResources(); | 431 ->OnLostResources(); |
| 432 } | 432 } |
| 433 } | 433 } |
| 434 } | 434 } |
| 435 | 435 |
| 436 RenderWidgetHostViewAndroid::RenderWidgetHostViewAndroid( | 436 RenderWidgetHostViewAndroid::RenderWidgetHostViewAndroid( |
| 437 RenderWidgetHostImpl* widget_host, | 437 RenderWidgetHostImpl* widget_host, |
| 438 ContentViewCoreImpl* content_view_core) | 438 ContentViewCoreImpl* content_view_core, |
| 439 SynchronousCompositorClient* compositor_client) |
| 439 : host_(widget_host), | 440 : host_(widget_host), |
| 440 outstanding_vsync_requests_(0), | 441 outstanding_vsync_requests_(0), |
| 441 is_showing_(!widget_host->is_hidden()), | 442 is_showing_(!widget_host->is_hidden()), |
| 442 is_window_visible_(true), | 443 is_window_visible_(true), |
| 443 is_window_activity_started_(true), | 444 is_window_activity_started_(true), |
| 444 content_view_core_(nullptr), | 445 content_view_core_(nullptr), |
| 445 ime_adapter_android_(this), | 446 ime_adapter_android_(this), |
| 446 cached_background_color_(SK_ColorWHITE), | 447 cached_background_color_(SK_ColorWHITE), |
| 447 last_compositor_frame_sink_id_(kUndefinedCompositorFrameSinkId), | 448 last_compositor_frame_sink_id_(kUndefinedCompositorFrameSinkId), |
| 448 gesture_provider_(ui::GetGestureProviderConfig( | 449 gesture_provider_(ui::GetGestureProviderConfig( |
| 449 ui::GestureProviderConfigType::CURRENT_PLATFORM), | 450 ui::GestureProviderConfigType::CURRENT_PLATFORM), |
| 450 this), | 451 this), |
| 451 stylus_text_selector_(this), | 452 stylus_text_selector_(this), |
| 452 using_browser_compositor_(CompositorImpl::IsInitialized()), | 453 using_browser_compositor_(CompositorImpl::IsInitialized()), |
| 454 synchronous_compositor_client_(compositor_client), |
| 453 frame_evictor_(new DelegatedFrameEvictor(this)), | 455 frame_evictor_(new DelegatedFrameEvictor(this)), |
| 454 locks_on_frame_count_(0), | 456 locks_on_frame_count_(0), |
| 455 observing_root_window_(false), | 457 observing_root_window_(false), |
| 456 weak_ptr_factory_(this) { | 458 weak_ptr_factory_(this) { |
| 457 // Set the layer which will hold the content layer for this view. The content | 459 // Set the layer which will hold the content layer for this view. The content |
| 458 // layer is managed by the DelegatedFrameHost. | 460 // layer is managed by the DelegatedFrameHost. |
| 459 view_.SetLayer(cc::Layer::Create()); | 461 view_.SetLayer(cc::Layer::Create()); |
| 460 if (using_browser_compositor_) { | 462 if (using_browser_compositor_) { |
| 461 delegated_frame_host_.reset(new ui::DelegatedFrameHostAndroid( | 463 delegated_frame_host_.reset(new ui::DelegatedFrameHostAndroid( |
| 462 &view_, cached_background_color_, | 464 &view_, cached_background_color_, |
| (...skipping 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1783 if (!selection_controller_) | 1785 if (!selection_controller_) |
| 1784 selection_controller_ = CreateSelectionController(this, content_view_core_); | 1786 selection_controller_ = CreateSelectionController(this, content_view_core_); |
| 1785 | 1787 |
| 1786 if (!overscroll_controller_ && | 1788 if (!overscroll_controller_ && |
| 1787 view_.GetWindowAndroid()->GetCompositor()) { | 1789 view_.GetWindowAndroid()->GetCompositor()) { |
| 1788 overscroll_controller_ = CreateOverscrollController( | 1790 overscroll_controller_ = CreateOverscrollController( |
| 1789 content_view_core_, ui::GetScaleFactorForNativeView(GetNativeView())); | 1791 content_view_core_, ui::GetScaleFactorForNativeView(GetNativeView())); |
| 1790 } | 1792 } |
| 1791 | 1793 |
| 1792 if (!sync_compositor_) { | 1794 if (!sync_compositor_) { |
| 1793 sync_compositor_ = SynchronousCompositorHost::Create( | 1795 sync_compositor_ = SynchronousCompositorHost::Create(this); |
| 1794 this, content_view_core_->GetWebContents()); | |
| 1795 } | 1796 } |
| 1796 } | 1797 } |
| 1797 | 1798 |
| 1798 void RenderWidgetHostViewAndroid::RunAckCallbacks() { | 1799 void RenderWidgetHostViewAndroid::RunAckCallbacks() { |
| 1799 while (!ack_callbacks_.empty()) { | 1800 while (!ack_callbacks_.empty()) { |
| 1800 ack_callbacks_.front().Run(); | 1801 ack_callbacks_.front().Run(); |
| 1801 ack_callbacks_.pop(); | 1802 ack_callbacks_.pop(); |
| 1802 } | 1803 } |
| 1803 } | 1804 } |
| 1804 | 1805 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1966 case ui::MotionEvent::ACTION_UP: | 1967 case ui::MotionEvent::ACTION_UP: |
| 1967 case ui::MotionEvent::ACTION_POINTER_UP: | 1968 case ui::MotionEvent::ACTION_POINTER_UP: |
| 1968 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", | 1969 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", |
| 1969 delta.InMicroseconds(), 1, 1000000, 50); | 1970 delta.InMicroseconds(), 1, 1000000, 50); |
| 1970 default: | 1971 default: |
| 1971 return; | 1972 return; |
| 1972 } | 1973 } |
| 1973 } | 1974 } |
| 1974 | 1975 |
| 1975 } // namespace content | 1976 } // namespace content |
| OLD | NEW |