Debian Codegraph @

src/core/SkSynchronizedResourceCache.cpp

raw
1 /*
2 * Copyright 2025 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "src/core/SkSynchronizedResourceCache.h"
9
10 SkSynchronizedResourceCache::SkSynchronizedResourceCache(DiscardableFactory fact)
11 : SkResourceCache(fact) {}
12
13 SkSynchronizedResourceCache::SkSynchronizedResourceCache(size_t byteLimit)
14 : SkResourceCache(byteLimit) {}
15
16 SkSynchronizedResourceCache::~SkSynchronizedResourceCache() = default;
17
18 size_t SkSynchronizedResourceCache::getTotalBytesUsed() const {
19 SkAutoMutexExclusive am(fMutex);
20 return SkResourceCache::getTotalBytesUsed();
21 }
22
23 size_t SkSynchronizedResourceCache::getTotalByteLimit() const {
24 SkAutoMutexExclusive am(fMutex);
25 return SkResourceCache::getTotalByteLimit();
26 }
27
28 size_t SkSynchronizedResourceCache::setTotalByteLimit(size_t newLimit) {
29 SkAutoMutexExclusive am(fMutex);
30 return SkResourceCache::setTotalByteLimit(newLimit);
31 }
32
33 SkResourceCache::DiscardableFactory SkSynchronizedResourceCache::discardableFactory() const {
34 SkAutoMutexExclusive am(fMutex);
35 return SkResourceCache::discardableFactory();
36 }
37
38 SkCachedData* SkSynchronizedResourceCache::newCachedData(size_t bytes) {
39 SkAutoMutexExclusive am(fMutex);
40 return SkResourceCache::newCachedData(bytes);
41 }
42
43 void SkSynchronizedResourceCache::dump() const {
44 SkAutoMutexExclusive am(fMutex);
45 SkResourceCache::dump();
46 }
47
48 size_t SkSynchronizedResourceCache::setSingleAllocationByteLimit(size_t size) {
49 SkAutoMutexExclusive am(fMutex);
50 return SkResourceCache::setSingleAllocationByteLimit(size);
51 }
52
53 size_t SkSynchronizedResourceCache::getSingleAllocationByteLimit() const {
54 SkAutoMutexExclusive am(fMutex);
55 return SkResourceCache::getSingleAllocationByteLimit();
56 }
57
58 size_t SkSynchronizedResourceCache::getEffectiveSingleAllocationByteLimit() const {
59 SkAutoMutexExclusive am(fMutex);
60 return SkResourceCache::getEffectiveSingleAllocationByteLimit();
61 }
62
63 void SkSynchronizedResourceCache::purgeAll() {
64 SkAutoMutexExclusive am(fMutex);
65 return SkResourceCache::purgeAll();
66 }
67
68 bool SkSynchronizedResourceCache::find(const Key& key, FindVisitor visitor, void* context) {
69 SkAutoMutexExclusive am(fMutex);
70 return SkResourceCache::find(key, visitor, context);
71 }
72
73 void SkSynchronizedResourceCache::add(Rec* rec, void* payload) {
74 SkAutoMutexExclusive am(fMutex);
75 SkResourceCache::add(rec, payload);
76 }
77
78 void SkSynchronizedResourceCache::visitAll(Visitor visitor, void* context) {
79 SkAutoMutexExclusive am(fMutex);
80 SkResourceCache::visitAll(visitor, context);
81 }