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

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

Issue 43193002: Aura/ÜC: Drop frames on background tabs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CONTENT_EXPORT Created 7 years, 2 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_aura.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index 7f41ab77b82cf14650f0c8acfa834b9aa64b72a0..82bbc97e7a9a2ed4dc973d58da1d6f677059bc3e 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -575,6 +575,7 @@ RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host)
cursor_visibility_state_in_renderer_(UNKNOWN),
paint_observer_(NULL),
touch_editing_client_(NULL),
+ delegated_frame_evictor_(new DelegatedFrameEvictor(this)),
weak_ptr_factory_(this) {
host_->SetView(this);
window_observer_.reset(new WindowObserver(this));
@@ -673,6 +674,7 @@ void RenderWidgetHostViewAura::WasShown() {
return;
host_->WasShown();
software_frame_manager_->SetVisibility(true);
+ delegated_frame_evictor_->SetVisible(true);
aura::Window* root = window_->GetRootWindow();
if (root) {
@@ -701,6 +703,7 @@ void RenderWidgetHostViewAura::WasHidden() {
return;
host_->WasHidden();
software_frame_manager_->SetVisibility(false);
+ delegated_frame_evictor_->SetVisible(false);
released_front_lock_ = NULL;
#if defined(OS_WIN)
@@ -1441,8 +1444,7 @@ void RenderWidgetHostViewAura::SwapDelegatedFrame(
// resources from the old one with resources from the new one which would
// have the same id. Changing the layer to showing painted content destroys
// the DelegatedRendererLayer.
- window_->layer()->SetShowPaintedContent();
- frame_provider_ = NULL;
+ EvictDelegatedFrame();
// Drop the cc::DelegatedFrameResourceCollection so that we will not return
// any resources from the old output surface with the new output surface id.
@@ -1458,8 +1460,7 @@ void RenderWidgetHostViewAura::SwapDelegatedFrame(
}
if (frame_size.IsEmpty()) {
DCHECK_EQ(0u, frame_data->resource_list.size());
- window_->layer()->SetShowPaintedContent();
- frame_provider_ = NULL;
+ EvictDelegatedFrame();
} else {
if (!resource_collection_) {
resource_collection_ = new cc::DelegatedFrameResourceCollection;
@@ -1495,6 +1496,9 @@ void RenderWidgetHostViewAura::SwapDelegatedFrame(
output_surface_id));
}
DidReceiveFrameFromRenderer();
+ if (frame_provider_.get())
+ delegated_frame_evictor_->SwappedFrame(!host_->is_hidden());
+ // Note: the frame may have been evicted immediately.
}
void RenderWidgetHostViewAura::SendDelegatedFrameAck(uint32 output_surface_id) {
@@ -1529,6 +1533,12 @@ void RenderWidgetHostViewAura::SendReturnedDelegatedResources(
ack);
}
+void RenderWidgetHostViewAura::EvictDelegatedFrame() {
+ window_->layer()->SetShowPaintedContent();
+ frame_provider_ = NULL;
+ delegated_frame_evictor_->DiscardedFrame();
+}
+
void RenderWidgetHostViewAura::SwapSoftwareFrame(
uint32 output_surface_id,
scoped_ptr<cc::SoftwareFrameData> frame_data,
@@ -1788,8 +1798,7 @@ void RenderWidgetHostViewAura::AcceleratedSurfaceRelease() {
// We need to wait for a commit to clear to guarantee that all we
// will not issue any more GL referencing the previous surface.
AddOnCommitCallbackAndDisableLocks(
- base::Bind(&RenderWidgetHostViewAura::
- SetSurfaceNotInUseByCompositor,
+ base::Bind(&RenderWidgetHostViewAura::SetSurfaceNotInUseByCompositor,
AsWeakPtr(),
current_surface_)); // Hold a ref so the texture will not
// get deleted until after commit.

Powered by Google App Engine
This is Rietveld 408576698