| Index: content/browser/renderer_host/render_widget_host_view_android.cc
|
| diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc
|
| index b62b26904148892ce9f34baf84c4b8ef848b1b4a..41416bea1e8b63c40e88b5b15edfe1fe07983288 100644
|
| --- a/content/browser/renderer_host/render_widget_host_view_android.cc
|
| +++ b/content/browser/renderer_host/render_widget_host_view_android.cc
|
| @@ -596,7 +596,23 @@
|
| return;
|
|
|
| is_showing_ = true;
|
| - ShowInternal();
|
| + if (layer_.get())
|
| + layer_->SetHideLayerAndSubtree(false);
|
| +
|
| + if (overscroll_controller_)
|
| + overscroll_controller_->Enable();
|
| +
|
| + frame_evictor_->SetVisible(true);
|
| +
|
| + if (!host_ || !host_->is_hidden())
|
| + return;
|
| +
|
| + host_->WasShown(ui::LatencyInfo());
|
| +
|
| + if (content_view_core_) {
|
| + StartObservingRootWindow();
|
| + RequestVSyncUpdate(BEGIN_FRAME);
|
| + }
|
| }
|
|
|
| void RenderWidgetHostViewAndroid::Hide() {
|
| @@ -604,10 +620,27 @@
|
| return;
|
|
|
| is_showing_ = false;
|
| -
|
| - bool hide_frontbuffer = true;
|
| - bool stop_observing_root_window = true;
|
| - HideInternal(hide_frontbuffer, stop_observing_root_window);
|
| + if (layer_.get() && locks_on_frame_count_ == 0)
|
| + layer_->SetHideLayerAndSubtree(true);
|
| +
|
| + if (overscroll_controller_)
|
| + overscroll_controller_->Disable();
|
| +
|
| + frame_evictor_->SetVisible(false);
|
| + // We don't know if we will ever get a frame if we are hiding the renderer, so
|
| + // we need to cancel all requests
|
| + AbortPendingReadbackRequests();
|
| +
|
| + RunAckCallbacks(cc::SurfaceDrawStatus::DRAW_SKIPPED);
|
| +
|
| + if (!host_ || host_->is_hidden())
|
| + return;
|
| +
|
| + // Inform the renderer that we are being hidden so it can reduce its resource
|
| + // utilization.
|
| + host_->WasHidden();
|
| +
|
| + StopObservingRootWindow();
|
| }
|
|
|
| bool RenderWidgetHostViewAndroid::IsShowing() {
|
| @@ -1454,57 +1487,6 @@
|
| accelerated_surface_route_id_ = route_id;
|
| }
|
|
|
| -void RenderWidgetHostViewAndroid::ShowInternal() {
|
| - DCHECK(is_showing_);
|
| - if (!host_ || !host_->is_hidden())
|
| - return;
|
| -
|
| - if (layer_.get())
|
| - layer_->SetHideLayerAndSubtree(false);
|
| -
|
| - frame_evictor_->SetVisible(true);
|
| -
|
| - if (overscroll_controller_)
|
| - overscroll_controller_->Enable();
|
| -
|
| - host_->WasShown(ui::LatencyInfo());
|
| -
|
| - if (content_view_core_) {
|
| - StartObservingRootWindow();
|
| - RequestVSyncUpdate(BEGIN_FRAME);
|
| - }
|
| -}
|
| -
|
| -void RenderWidgetHostViewAndroid::HideInternal(
|
| - bool hide_frontbuffer,
|
| - bool stop_observing_root_window) {
|
| - if (hide_frontbuffer) {
|
| - if (layer_.get() && locks_on_frame_count_ == 0)
|
| - layer_->SetHideLayerAndSubtree(true);
|
| -
|
| - frame_evictor_->SetVisible(false);
|
| - }
|
| -
|
| - if (stop_observing_root_window)
|
| - StopObservingRootWindow();
|
| -
|
| - if (!host_ || host_->is_hidden())
|
| - return;
|
| -
|
| - if (overscroll_controller_)
|
| - overscroll_controller_->Disable();
|
| -
|
| - // We don't know if we will ever get a frame if we are hiding the renderer, so
|
| - // we need to cancel all requests
|
| - AbortPendingReadbackRequests();
|
| -
|
| - RunAckCallbacks(cc::SurfaceDrawStatus::DRAW_SKIPPED);
|
| -
|
| - // Inform the renderer that we are being hidden so it can reduce its resource
|
| - // utilization.
|
| - host_->WasHidden();
|
| -}
|
| -
|
| void RenderWidgetHostViewAndroid::AttachLayers() {
|
| if (!content_view_core_)
|
| return;
|
| @@ -1536,12 +1518,6 @@
|
|
|
| bool should_request_vsync = !outstanding_vsync_requests_ && requests;
|
| outstanding_vsync_requests_ |= requests;
|
| -
|
| - // If the host has been hidden, defer vsync requests until it is shown
|
| - // again via |Show()|.
|
| - if (!host_ || host_->is_hidden())
|
| - return;
|
| -
|
| // Note that if we're not currently observing the root window, outstanding
|
| // vsync requests will be pushed if/when we resume observing in
|
| // |StartObservingRootWindow()|.
|
| @@ -1551,7 +1527,6 @@
|
|
|
| void RenderWidgetHostViewAndroid::StartObservingRootWindow() {
|
| DCHECK(content_view_core_);
|
| - DCHECK(is_showing_);
|
| if (observing_root_window_)
|
| return;
|
|
|
| @@ -1852,8 +1827,7 @@
|
| if (!content_view_core_)
|
| return;
|
|
|
| - if (is_showing_)
|
| - StartObservingRootWindow();
|
| + StartObservingRootWindow();
|
|
|
| if (resize)
|
| WasResized();
|
| @@ -1894,17 +1868,6 @@
|
| RunAckCallbacks(cc::SurfaceDrawStatus::DRAWN);
|
| }
|
|
|
| -void RenderWidgetHostViewAndroid::OnRootWindowVisibilityChanged(bool visible) {
|
| - DCHECK(is_showing_);
|
| - if (visible) {
|
| - ShowInternal();
|
| - } else {
|
| - bool hide_frontbuffer = true;
|
| - bool stop_observing_root_window = false;
|
| - HideInternal(hide_frontbuffer, stop_observing_root_window);
|
| - }
|
| -}
|
| -
|
| void RenderWidgetHostViewAndroid::OnAttachCompositor() {
|
| DCHECK(content_view_core_);
|
| if (!overscroll_controller_)
|
| @@ -1921,7 +1884,7 @@
|
| void RenderWidgetHostViewAndroid::OnVSync(base::TimeTicks frame_time,
|
| base::TimeDelta vsync_period) {
|
| TRACE_EVENT0("cc,benchmark", "RenderWidgetHostViewAndroid::OnVSync");
|
| - if (!host_ || host_->is_hidden())
|
| + if (!host_)
|
| return;
|
|
|
| const uint32 current_vsync_requests = outstanding_vsync_requests_;
|
| @@ -1942,20 +1905,6 @@
|
| void RenderWidgetHostViewAndroid::OnAnimate(base::TimeTicks begin_frame_time) {
|
| if (Animate(begin_frame_time))
|
| SetNeedsAnimate();
|
| -}
|
| -
|
| -void RenderWidgetHostViewAndroid::OnActivityPaused() {
|
| - TRACE_EVENT0("browser", "RenderWidgetHostViewAndroid::OnActivityPaused");
|
| - DCHECK(is_showing_);
|
| - bool hide_frontbuffer = false;
|
| - bool stop_observing_root_window = false;
|
| - HideInternal(hide_frontbuffer, stop_observing_root_window);
|
| -}
|
| -
|
| -void RenderWidgetHostViewAndroid::OnActivityResumed() {
|
| - TRACE_EVENT0("browser", "RenderWidgetHostViewAndroid::OnActivityResumed");
|
| - DCHECK(is_showing_);
|
| - ShowInternal();
|
| }
|
|
|
| void RenderWidgetHostViewAndroid::OnLostResources() {
|
|
|