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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 899313003: cc: Split ReleaseResources into Release and Recreate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 5 years, 10 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
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_impl.cc
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index f51c61ac2fd55faa576b0ea64255d26d90705fd5..672ffe80b30be64a8033a4d6b7d24b884582ac14 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -116,7 +116,6 @@ class ViewportAnchor {
gfx::ScrollOffset viewport_in_content_coordinates_;
};
-
void DidVisibilityChange(LayerTreeHostImpl* id, bool visible) {
if (visible) {
TRACE_EVENT_ASYNC_BEGIN1("cc", "LayerTreeHostImpl::SetVisible", id,
@@ -1616,6 +1615,7 @@ void LayerTreeHostImpl::SetUseGpuRasterization(bool use_gpu) {
DestroyTileManager();
CreateAndSetTileManager();
}
+ RecreateTreeResources();
// We have released tilings for both active and pending tree.
// We would not have any content to draw until the pending tree is activated.
@@ -1934,6 +1934,14 @@ void LayerTreeHostImpl::ReleaseTreeResources() {
EvictAllUIResources();
}
+void LayerTreeHostImpl::RecreateTreeResources() {
+ active_tree_->RecreateResources();
+ if (pending_tree_)
+ pending_tree_->RecreateResources();
+ if (recycle_tree_)
+ recycle_tree_->RecreateResources();
+}
+
void LayerTreeHostImpl::CreateAndSetRenderer() {
DCHECK(!renderer_);
DCHECK(output_surface_);
@@ -2125,8 +2133,12 @@ bool LayerTreeHostImpl::InitializeRenderer(
resource_provider_ = nullptr;
output_surface_ = nullptr;
- if (!output_surface->BindToClient(this))
+ if (!output_surface->BindToClient(this)) {
+ // Avoid recreating tree resources because we might not have enough
+ // information to do this yet (eg. we don't have a TileManager at this
+ // point).
return false;
+ }
output_surface_ = output_surface.Pass();
resource_provider_ = ResourceProvider::Create(
@@ -2143,6 +2155,7 @@ bool LayerTreeHostImpl::InitializeRenderer(
if (settings_.impl_side_painting)
CreateAndSetTileManager();
+ RecreateTreeResources();
// Initialize vsync parameters to sane values.
const base::TimeDelta display_refresh_interval =
@@ -2192,6 +2205,7 @@ void LayerTreeHostImpl::DeferredInitialize() {
CreateAndSetRenderer();
EnforceZeroBudget(false);
CreateAndSetTileManager();
+ RecreateTreeResources();
client_->SetNeedsCommitOnImplThread();
}
@@ -2211,6 +2225,7 @@ void LayerTreeHostImpl::ReleaseGL() {
CreateAndSetRenderer();
EnforceZeroBudget(true);
CreateAndSetTileManager();
+ RecreateTreeResources();
client_->SetNeedsCommitOnImplThread();
}
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698