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

Unified Diff: cc/trees/layer_tree_host.cc

Issue 738983002: Move output surface fallback from cc to embedders (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years 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: cc/trees/layer_tree_host.cc
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index c2fce2a6230b4c277c9dad1bea78c3ea613f8355..df1f77892c2ff9cd5d2b5b86fa7045b97e6b2aab 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -114,7 +114,6 @@ LayerTreeHost::LayerTreeHost(
source_frame_number_(0),
rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()),
output_surface_lost_(true),
- num_failed_recreate_attempts_(0),
settings_(settings),
debug_state_(settings.initial_debug_state),
top_controls_layout_height_(0.f),
@@ -216,40 +215,6 @@ static void LayerTreeHostOnOutputSurfaceCreatedCallback(Layer* layer) {
layer->OnOutputSurfaceCreated();
}
-void LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted(bool success) {
- DCHECK(output_surface_lost_);
- TRACE_EVENT1("cc",
- "LayerTreeHost::OnCreateAndInitializeOutputSurfaceAttempted",
- "success",
- success);
-
- if (!success) {
- // Tolerate a certain number of recreation failures to work around races
- // in the output-surface-lost machinery.
- ++num_failed_recreate_attempts_;
- if (num_failed_recreate_attempts_ >= 5)
- LOG(FATAL) << "Failed to create a fallback OutputSurface.";
- client_->DidFailToInitializeOutputSurface();
- return;
- }
-
- output_surface_lost_ = false;
-
- if (!contents_texture_manager_ && !settings_.impl_side_painting) {
- contents_texture_manager_ =
- PrioritizedResourceManager::Create(proxy_.get());
- surface_memory_placeholder_ =
- contents_texture_manager_->CreateTexture(gfx::Size(), RGBA_8888);
- }
-
- if (root_layer()) {
- LayerTreeHostCommon::CallFunctionForSubtree(
- root_layer(), base::Bind(&LayerTreeHostOnOutputSurfaceCreatedCallback));
- }
-
- client_->DidInitializeOutputSurface();
-}
-
void LayerTreeHost::DeleteContentsTexturesOnImplThread(
ResourceProvider* resource_provider) {
DCHECK(proxy_->IsImplThread());
@@ -432,11 +397,38 @@ void LayerTreeHost::CommitComplete() {
}
void LayerTreeHost::SetOutputSurface(scoped_ptr<OutputSurface> surface) {
+ TRACE_EVENT0("cc", "LayerTreeHost::SetOutputSurface");
+ DCHECK(output_surface_lost_);
+ DCHECK(surface);
+
proxy_->SetOutputSurface(surface.Pass());
}
void LayerTreeHost::RequestNewOutputSurface() {
- client_->RequestNewOutputSurface(num_failed_recreate_attempts_ >= 4);
+ client_->RequestNewOutputSurface();
+}
+
+void LayerTreeHost::DidInitializeOutputSurface() {
+ output_surface_lost_ = false;
+
+ if (!contents_texture_manager_ && !settings_.impl_side_painting) {
+ contents_texture_manager_ =
+ PrioritizedResourceManager::Create(proxy_.get());
+ surface_memory_placeholder_ =
+ contents_texture_manager_->CreateTexture(gfx::Size(), RGBA_8888);
+ }
+
+ if (root_layer()) {
+ LayerTreeHostCommon::CallFunctionForSubtree(
+ root_layer(), base::Bind(&LayerTreeHostOnOutputSurfaceCreatedCallback));
+ }
+
+ client_->DidInitializeOutputSurface();
+}
+
+void LayerTreeHost::DidFailToInitializeOutputSurface() {
+ DCHECK(output_surface_lost_);
+ client_->DidFailToInitializeOutputSurface();
}
scoped_ptr<LayerTreeHostImpl> LayerTreeHost::CreateLayerTreeHostImpl(
@@ -469,7 +461,6 @@ void LayerTreeHost::DidLoseOutputSurface() {
if (output_surface_lost_)
return;
- num_failed_recreate_attempts_ = 0;
output_surface_lost_ = true;
SetNeedsCommit();
}

Powered by Google App Engine
This is Rietveld 408576698