| OLD | NEW |
| 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 2234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2245 mutator_->SetClient(this); | 2245 mutator_->SetClient(this); |
| 2246 } | 2246 } |
| 2247 | 2247 |
| 2248 void LayerTreeHostImpl::CleanUpTileManagerAndUIResources() { | 2248 void LayerTreeHostImpl::CleanUpTileManagerAndUIResources() { |
| 2249 ClearUIResources(); | 2249 ClearUIResources(); |
| 2250 tile_manager_.FinishTasksAndCleanUp(); | 2250 tile_manager_.FinishTasksAndCleanUp(); |
| 2251 resource_pool_ = nullptr; | 2251 resource_pool_ = nullptr; |
| 2252 tile_task_manager_ = nullptr; | 2252 tile_task_manager_ = nullptr; |
| 2253 single_thread_synchronous_task_graph_runner_ = nullptr; | 2253 single_thread_synchronous_task_graph_runner_ = nullptr; |
| 2254 image_decode_controller_ = nullptr; | 2254 image_decode_controller_ = nullptr; |
| 2255 |
| 2256 // We've potentially just freed a large number of resources on our various |
| 2257 // contexts. Flushing now helps ensure these are cleaned up quickly |
| 2258 // preventing driver cache growth. See crbug.com/643251 |
| 2259 if (compositor_frame_sink_) { |
| 2260 if (auto* compositor_context = compositor_frame_sink_->context_provider()) |
| 2261 compositor_context->ContextGL()->ShallowFlushCHROMIUM(); |
| 2262 if (auto* worker_context = |
| 2263 compositor_frame_sink_->worker_context_provider()) { |
| 2264 ContextProvider::ScopedContextLock hold(worker_context); |
| 2265 worker_context->ContextGL()->ShallowFlushCHROMIUM(); |
| 2266 } |
| 2267 } |
| 2255 } | 2268 } |
| 2256 | 2269 |
| 2257 void LayerTreeHostImpl::ReleaseCompositorFrameSink() { | 2270 void LayerTreeHostImpl::ReleaseCompositorFrameSink() { |
| 2258 TRACE_EVENT0("cc", "LayerTreeHostImpl::ReleaseCompositorFrameSink"); | 2271 TRACE_EVENT0("cc", "LayerTreeHostImpl::ReleaseCompositorFrameSink"); |
| 2259 | 2272 |
| 2260 if (!compositor_frame_sink_) | 2273 if (!compositor_frame_sink_) |
| 2261 return; | 2274 return; |
| 2262 | 2275 |
| 2263 // Since we will create a new resource provider, we cannot continue to use | 2276 // Since we will create a new resource provider, we cannot continue to use |
| 2264 // the old resources (i.e. render_surfaces and texture IDs). Clear them | 2277 // the old resources (i.e. render_surfaces and texture IDs). Clear them |
| (...skipping 1919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4184 if (is_visible) { | 4197 if (is_visible) { |
| 4185 worker_context_visibility_ = | 4198 worker_context_visibility_ = |
| 4186 worker_context->CacheController()->ClientBecameVisible(); | 4199 worker_context->CacheController()->ClientBecameVisible(); |
| 4187 } else { | 4200 } else { |
| 4188 worker_context->CacheController()->ClientBecameNotVisible( | 4201 worker_context->CacheController()->ClientBecameNotVisible( |
| 4189 std::move(worker_context_visibility_)); | 4202 std::move(worker_context_visibility_)); |
| 4190 } | 4203 } |
| 4191 } | 4204 } |
| 4192 | 4205 |
| 4193 } // namespace cc | 4206 } // namespace cc |
| OLD | NEW |