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

Side by Side Diff: cc/output/context_cache_controller.cc

Issue 2879533005: Use new skia resource clearing API
Patch Set: Created 3 years, 7 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 (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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/output/context_cache_controller.h" 5 #include "cc/output/context_cache_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 152
153 // Try to acquire the context lock - if we can't acquire it then we've become 153 // Try to acquire the context lock - if we can't acquire it then we've become
154 // busy since checking |current_idle_generation_| above. In this case, just 154 // busy since checking |current_idle_generation_| above. In this case, just
155 // re-post our idle callback and return. 155 // re-post our idle callback and return.
156 if (context_lock_ && !context_lock_->Try()) { 156 if (context_lock_ && !context_lock_->Try()) {
157 base::AutoLock hold(current_idle_generation_lock_); 157 base::AutoLock hold(current_idle_generation_lock_);
158 PostIdleCallback(current_idle_generation_); 158 PostIdleCallback(current_idle_generation_);
159 return; 159 return;
160 } 160 }
161 161
162 if (gr_context_) 162 if (gr_context_) {
163 gr_context_->freeGpuResources(); 163 gr_context_->purgeResourcesNotUsedInMs(std::chrono::milliseconds(0));
164 }
164 165
165 // Toggle SetAggressivelyFreeResources to drop command buffer data. 166 // Toggle SetAggressivelyFreeResources to drop command buffer data.
166 context_support_->SetAggressivelyFreeResources(true); 167 context_support_->SetAggressivelyFreeResources(true);
167 context_support_->SetAggressivelyFreeResources(false); 168 context_support_->SetAggressivelyFreeResources(false);
168 169
169 callback_pending_ = false; 170 callback_pending_ = false;
170 171
171 if (context_lock_) 172 if (context_lock_)
172 context_lock_->Release(); 173 context_lock_->Release();
173 } 174 }
174 175
175 } // namespace cc 176 } // 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