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

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 2270573002: cc: Get rid of LayerTreeHost::output_surface_lost_ state. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@renderer-caps
Patch Set: lth-outputsurface-lost: android-build-and-earlyout-sooner Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_host.cc ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 2315 matching lines...) Expand 10 before | Expand all | Expand 10 after
2326 tile_manager_.FinishTasksAndCleanUp(); 2326 tile_manager_.FinishTasksAndCleanUp();
2327 resource_pool_ = nullptr; 2327 resource_pool_ = nullptr;
2328 tile_task_manager_ = nullptr; 2328 tile_task_manager_ = nullptr;
2329 single_thread_synchronous_task_graph_runner_ = nullptr; 2329 single_thread_synchronous_task_graph_runner_ = nullptr;
2330 image_decode_controller_ = nullptr; 2330 image_decode_controller_ = nullptr;
2331 } 2331 }
2332 2332
2333 void LayerTreeHostImpl::ReleaseOutputSurface() { 2333 void LayerTreeHostImpl::ReleaseOutputSurface() {
2334 TRACE_EVENT0("cc", "LayerTreeHostImpl::ReleaseOutputSurface"); 2334 TRACE_EVENT0("cc", "LayerTreeHostImpl::ReleaseOutputSurface");
2335 2335
2336 if (!output_surface_)
2337 return;
2338
2336 // Since we will create a new resource provider, we cannot continue to use 2339 // Since we will create a new resource provider, we cannot continue to use
2337 // the old resources (i.e. render_surfaces and texture IDs). Clear them 2340 // the old resources (i.e. render_surfaces and texture IDs). Clear them
2338 // before we destroy the old resource provider. 2341 // before we destroy the old resource provider.
2339 ReleaseTreeResources(); 2342 ReleaseTreeResources();
2340 2343
2341 // Note: order is important here. 2344 // Note: order is important here.
2342 renderer_ = nullptr; 2345 renderer_ = nullptr;
2343 CleanUpTileManagerAndUIResources(); 2346 CleanUpTileManagerAndUIResources();
2344 resource_provider_ = nullptr; 2347 resource_provider_ = nullptr;
2345 2348
2346 // Detach from the old output surface and reset |output_surface_| pointer 2349 // Detach from the old output surface and reset |output_surface_| pointer
2347 // as this surface is going to be destroyed independent of if binding the 2350 // as this surface is going to be destroyed independent of if binding the
2348 // new output surface succeeds or not. 2351 // new output surface succeeds or not.
2349 if (output_surface_) { 2352 output_surface_->DetachFromClient();
2350 output_surface_->DetachFromClient(); 2353 output_surface_ = nullptr;
2351 output_surface_ = nullptr;
2352 }
2353 2354
2354 // We don't know if the next OutputSurface will support GPU rasterization. 2355 // We don't know if the next OutputSurface will support GPU rasterization.
2355 // Make sure to clear the flag so that we force a re-computation. 2356 // Make sure to clear the flag so that we force a re-computation.
2356 use_gpu_rasterization_ = false; 2357 use_gpu_rasterization_ = false;
2357 } 2358 }
2358 2359
2359 bool LayerTreeHostImpl::InitializeRenderer(OutputSurface* output_surface) { 2360 bool LayerTreeHostImpl::InitializeRenderer(OutputSurface* output_surface) {
2360 TRACE_EVENT0("cc", "LayerTreeHostImpl::InitializeRenderer"); 2361 TRACE_EVENT0("cc", "LayerTreeHostImpl::InitializeRenderer");
2361 2362
2362 ReleaseOutputSurface(); 2363 ReleaseOutputSurface();
(...skipping 1819 matching lines...) Expand 10 before | Expand all | Expand 10 after
4182 return task_runner_provider_->HasImplThread(); 4183 return task_runner_provider_->HasImplThread();
4183 } 4184 }
4184 4185
4185 bool LayerTreeHostImpl::CommitToActiveTree() const { 4186 bool LayerTreeHostImpl::CommitToActiveTree() const {
4186 // In single threaded mode we skip the pending tree and commit directly to the 4187 // In single threaded mode we skip the pending tree and commit directly to the
4187 // active tree. 4188 // active tree.
4188 return !task_runner_provider_->HasImplThread(); 4189 return !task_runner_provider_->HasImplThread();
4189 } 4190 }
4190 4191
4191 } // namespace cc 4192 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host.cc ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698