Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/debug/activity_tracker.h" | |
| 8 #include "base/logging.h" | 9 #include "base/logging.h" |
| 9 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 10 #include "base/synchronization/lock.h" | 11 #include "base/synchronization/lock.h" |
| 11 #include "gpu/command_buffer/client/context_support.h" | 12 #include "gpu/command_buffer/client/context_support.h" |
| 12 #include "third_party/skia/include/gpu/GrContext.h" | 13 #include "third_party/skia/include/gpu/GrContext.h" |
| 13 | 14 |
| 14 namespace cc { | 15 namespace cc { |
| 15 namespace { | 16 namespace { |
| 16 static const int kIdleCleanupDelaySeconds = 1; | 17 static const int kIdleCleanupDelaySeconds = 1; |
| 17 } // namespace | 18 } // namespace |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 151 | 152 |
| 152 // 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 |
| 153 // busy since checking |current_idle_generation_| above. In this case, just | 154 // busy since checking |current_idle_generation_| above. In this case, just |
| 154 // re-post our idle callback and return. | 155 // re-post our idle callback and return. |
| 155 if (context_lock_ && !context_lock_->Try()) { | 156 if (context_lock_ && !context_lock_->Try()) { |
| 156 base::AutoLock hold(current_idle_generation_lock_); | 157 base::AutoLock hold(current_idle_generation_lock_); |
| 157 PostIdleCallback(current_idle_generation_); | 158 PostIdleCallback(current_idle_generation_); |
| 158 return; | 159 return; |
| 159 } | 160 } |
| 160 | 161 |
| 161 if (gr_context_) | 162 if (gr_context_) { |
| 163 // TODO(manzagop): remove ScopedActivity once crbug.com/703342 is fixed. | |
| 164 base::debug::ScopedActivity activity_free(0, 0, 0); | |
|
bcwhite
2017/03/21 12:34:38
There is a default ctor that is (0,0,0) if you don
manzagop (departed)
2017/03/21 14:00:23
Done. (Another option is to rely on the activity's
| |
| 162 gr_context_->freeGpuResources(); | 165 gr_context_->freeGpuResources(); |
| 166 } | |
| 163 | 167 |
| 164 // Toggle SetAggressivelyFreeResources to drop command buffer data. | 168 // Toggle SetAggressivelyFreeResources to drop command buffer data. |
| 165 context_support_->SetAggressivelyFreeResources(true); | 169 context_support_->SetAggressivelyFreeResources(true); |
| 166 context_support_->SetAggressivelyFreeResources(false); | 170 context_support_->SetAggressivelyFreeResources(false); |
| 167 | 171 |
| 168 callback_pending_ = false; | 172 callback_pending_ = false; |
| 169 | 173 |
| 170 if (context_lock_) | 174 if (context_lock_) |
| 171 context_lock_->Release(); | 175 context_lock_->Release(); |
| 172 } | 176 } |
| 173 | 177 |
| 174 } // namespace cc | 178 } // namespace cc |
| OLD | NEW |