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

Unified Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 2810813004: Hide fullscreen rotation jank (Closed)
Patch Set: Re-add feature flag Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
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 77970a3248eaf2d7971404ca46eaa89d33315b06..7880afe1b4fe5254f03243a0ead129c7cc4ee755 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.cc
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -72,6 +72,7 @@
#include "content/public/browser/devtools_agent_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host_iterator.h"
+#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "gpu/command_buffer/client/gles2_implementation.h"
#include "gpu/command_buffer/client/gles2_interface.h"
@@ -469,6 +470,7 @@ RenderWidgetHostViewAndroid::RenderWidgetHostViewAndroid(
observing_root_window_(false),
prev_top_shown_pix_(0.f),
prev_bottom_shown_pix_(0.f),
+ fullscreen_jank_detector_(new FullscreenJankDetector()),
mouse_wheel_phase_handler_(widget_host, this),
weak_ptr_factory_(this) {
// Set the layer which will hold the content layer for this view. The content
@@ -569,6 +571,12 @@ void RenderWidgetHostViewAndroid::WasResized() {
host_->WasResized();
}
+void RenderWidgetHostViewAndroid::OnFullscreenStateChanged() {
+ fullscreen_jank_detector_->OnFullscreenStateChanged(
+ host_->delegate()->IsFullscreenForCurrentTab());
+ EvictFrameIfNecessary();
+}
+
void RenderWidgetHostViewAndroid::SetSize(const gfx::Size& size) {
// Ignore the given size as only the Java code has the power to
// resize the view on Android.
@@ -1195,6 +1203,19 @@ void RenderWidgetHostViewAndroid::DidCreateNewRendererCompositorFrameSink(
surface_returned_resources_.clear();
}
+void RenderWidgetHostViewAndroid::EvictFrameIfNecessary() {
+ // TODO(steimel): Remove this feature flag once we're confident that the
+ // fullscreen transition hiding is working correctly.
mlamouri (slow - plz ping) 2017/07/05 13:55:31 I would rephrase the TODO to say that we should re
+ if (base::FeatureList::IsEnabled(features::kHideFullscreenTransitionJank) &&
+ fullscreen_jank_detector_->IsInFullscreenTransition()) {
+ // When we're in a fullscreen transition, we don't want to show a frame
+ // since it will look janky, so instead we show black.
+ EvictDelegatedFrame();
+ UpdateBackgroundColor(SK_ColorBLACK);
+ ClearThumbnailPlaceholder();
+ }
+}
+
void RenderWidgetHostViewAndroid::SubmitCompositorFrame(
const cc::LocalSurfaceId& local_surface_id,
cc::CompositorFrame frame) {
@@ -1254,6 +1275,7 @@ void RenderWidgetHostViewAndroid::DestroyDelegatedContent() {
frame_evictor_->DiscardedFrame();
delegated_frame_host_->DestroyDelegatedContent();
+ current_surface_size_.SetSize(0, 0);
}
void RenderWidgetHostViewAndroid::OnDidNotProduceFrame(
@@ -1497,6 +1519,10 @@ void RenderWidgetHostViewAndroid::OnFrameMetadataUpdated(
frame_metadata.max_page_scale_factor),
frame_metadata.root_layer_size, frame_metadata.scrollable_viewport_size,
top_content_offset, top_shown_pix, top_changed, is_mobile_optimized);
+
+ fullscreen_jank_detector_->OnFrameMetadataUpdated(
+ frame_metadata.is_fullscreen, current_surface_size_);
+ EvictFrameIfNecessary();
}
void RenderWidgetHostViewAndroid::ShowInternal() {
@@ -1979,6 +2005,10 @@ SkColor RenderWidgetHostViewAndroid::GetCachedBackgroundColor() const {
return cached_background_color_;
}
+void RenderWidgetHostViewAndroid::ClearThumbnailPlaceholder() {
+ view_.ClearThumbnailPlaceholder();
+}
+
void RenderWidgetHostViewAndroid::SetIsInVR(bool is_in_vr) {
is_in_vr_ = is_in_vr;
}
@@ -2108,6 +2138,9 @@ void RenderWidgetHostViewAndroid::OnGestureEvent(
}
void RenderWidgetHostViewAndroid::OnPhysicalBackingSizeChanged() {
+ fullscreen_jank_detector_->OnPhysicalBackingSizeChanged(
+ view_.GetPhysicalBackingSize());
+ EvictFrameIfNecessary();
WasResized();
}

Powered by Google App Engine
This is Rietveld 408576698