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

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

Issue 2361853003: Flush contexts after LayerTreeHostImpl cleanup (Closed)
Patch Set: 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 | « no previous file | no next file » | 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 2266 matching lines...) Expand 10 before | Expand all | Expand 10 after
2277 mutator_->SetClient(this); 2277 mutator_->SetClient(this);
2278 } 2278 }
2279 2279
2280 void LayerTreeHostImpl::CleanUpTileManagerAndUIResources() { 2280 void LayerTreeHostImpl::CleanUpTileManagerAndUIResources() {
2281 ClearUIResources(); 2281 ClearUIResources();
2282 tile_manager_.FinishTasksAndCleanUp(); 2282 tile_manager_.FinishTasksAndCleanUp();
2283 resource_pool_ = nullptr; 2283 resource_pool_ = nullptr;
2284 tile_task_manager_ = nullptr; 2284 tile_task_manager_ = nullptr;
2285 single_thread_synchronous_task_graph_runner_ = nullptr; 2285 single_thread_synchronous_task_graph_runner_ = nullptr;
2286 image_decode_controller_ = nullptr; 2286 image_decode_controller_ = nullptr;
2287
2288 // We've potentially just freed a large number of resources on our various
2289 // contexts. Flushing now helps ensure these are cleaned up quickly
2290 // preventing driver cache growth. See crbug.com/643251
2291 if (compositor_frame_sink_) {
2292 if (auto* compositor_context = compositor_frame_sink_->context_provider())
2293 compositor_context->ContextGL()->ShallowFlushCHROMIUM();
2294 if (auto* worker_context =
2295 compositor_frame_sink_->worker_context_provider()) {
2296 ContextProvider::ScopedContextLock hold(worker_context);
2297 worker_context->ContextGL()->ShallowFlushCHROMIUM();
2298 }
2299 }
2287 } 2300 }
2288 2301
2289 void LayerTreeHostImpl::ReleaseOutputSurface() { 2302 void LayerTreeHostImpl::ReleaseOutputSurface() {
2290 TRACE_EVENT0("cc", "LayerTreeHostImpl::ReleaseOutputSurface"); 2303 TRACE_EVENT0("cc", "LayerTreeHostImpl::ReleaseOutputSurface");
2291 2304
2292 // Since we will create a new resource provider, we cannot continue to use 2305 // Since we will create a new resource provider, we cannot continue to use
2293 // the old resources (i.e. render_surfaces and texture IDs). Clear them 2306 // the old resources (i.e. render_surfaces and texture IDs). Clear them
2294 // before we destroy the old resource provider. 2307 // before we destroy the old resource provider.
2295 ReleaseTreeResources(); 2308 ReleaseTreeResources();
2296 2309
(...skipping 1899 matching lines...) Expand 10 before | Expand all | Expand 10 after
4196 if (is_visible) { 4209 if (is_visible) {
4197 worker_context_visibility_ = 4210 worker_context_visibility_ =
4198 worker_context->CacheController()->ClientBecameVisible(); 4211 worker_context->CacheController()->ClientBecameVisible();
4199 } else { 4212 } else {
4200 worker_context->CacheController()->ClientBecameNotVisible( 4213 worker_context->CacheController()->ClientBecameNotVisible(
4201 std::move(worker_context_visibility_)); 4214 std::move(worker_context_visibility_));
4202 } 4215 }
4203 } 4216 }
4204 4217
4205 } // namespace cc 4218 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698