| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 #include "SkImageRef_GlobalPool.h" | 8 #include "SkImageRef_GlobalPool.h" |
| 9 #include "SkImageRefPool.h" | 9 #include "SkImageRefPool.h" |
| 10 #include "SkThread.h" | 10 #include "SkThread.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 return true; | 57 return true; |
| 58 } | 58 } |
| 59 | 59 |
| 60 void SkImageRef_GlobalPool::onUnlockPixels() { | 60 void SkImageRef_GlobalPool::onUnlockPixels() { |
| 61 this->INHERITED::onUnlockPixels(); | 61 this->INHERITED::onUnlockPixels(); |
| 62 | 62 |
| 63 // by design, onUnlockPixels() already is inside the mutex-lock | 63 // by design, onUnlockPixels() already is inside the mutex-lock |
| 64 GetGlobalPool()->canLosePixels(this); | 64 GetGlobalPool()->canLosePixels(this); |
| 65 } | 65 } |
| 66 | 66 |
| 67 SkImageRef_GlobalPool::SkImageRef_GlobalPool(SkFlattenableReadBuffer& buffer) | 67 SkImageRef_GlobalPool::SkImageRef_GlobalPool(SkReadBuffer& buffer) |
| 68 : INHERITED(buffer, &gGlobalPoolMutex) { | 68 : INHERITED(buffer, &gGlobalPoolMutex) { |
| 69 SkASSERT(&gGlobalPoolMutex == this->mutex()); | 69 SkASSERT(&gGlobalPoolMutex == this->mutex()); |
| 70 SkAutoMutexAcquire ac(gGlobalPoolMutex); | 70 SkAutoMutexAcquire ac(gGlobalPoolMutex); |
| 71 GetGlobalPool()->addToHead(this); | 71 GetGlobalPool()->addToHead(this); |
| 72 } | 72 } |
| 73 | 73 |
| 74 /////////////////////////////////////////////////////////////////////////////// | 74 /////////////////////////////////////////////////////////////////////////////// |
| 75 // global imagerefpool wrappers | 75 // global imagerefpool wrappers |
| 76 | 76 |
| 77 size_t SkImageRef_GlobalPool::GetRAMBudget() { | 77 size_t SkImageRef_GlobalPool::GetRAMBudget() { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 91 | 91 |
| 92 void SkImageRef_GlobalPool::SetRAMUsed(size_t usage) { | 92 void SkImageRef_GlobalPool::SetRAMUsed(size_t usage) { |
| 93 SkAutoMutexAcquire ac(gGlobalPoolMutex); | 93 SkAutoMutexAcquire ac(gGlobalPoolMutex); |
| 94 GetGlobalPool()->setRAMUsed(usage); | 94 GetGlobalPool()->setRAMUsed(usage); |
| 95 } | 95 } |
| 96 | 96 |
| 97 void SkImageRef_GlobalPool::DumpPool() { | 97 void SkImageRef_GlobalPool::DumpPool() { |
| 98 SkAutoMutexAcquire ac(gGlobalPoolMutex); | 98 SkAutoMutexAcquire ac(gGlobalPoolMutex); |
| 99 GetGlobalPool()->dump(); | 99 GetGlobalPool()->dump(); |
| 100 } | 100 } |
| OLD | NEW |