Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
src
gpu
graphite
ProxyCache.h
Go to the documentation of this file.
1
/*
2
* Copyright 2023 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
#ifndef skgpu_graphite_ProxyCache_DEFINED
9
#define skgpu_graphite_ProxyCache_DEFINED
10
11
#include "
include/core/SkRefCnt.h
"
12
#include "
src/core/SkMessageBus.h
"
13
#include "
src/core/SkTHash.h
"
14
#include "
src/gpu/GpuTypesPriv.h
"
15
#include "
src/gpu/ResourceKey.h
"
16
17
class
SkBitmap
;
18
19
namespace
skgpu
{
20
enum class
Mipmapped
: bool;
21
class
UniqueKey;
22
}
23
24
namespace
skgpu::graphite
{
25
26
class
Recorder
;
27
class
TextureProxy;
28
29
// This class encapsulates the _internal_ Recorder-local caching of utility proxies.
30
// TODO:
31
// Add purgeProxiesNotUsedSince method
32
// Link into Context purging system
33
// Add unit tests
34
class
ProxyCache
{
35
public
:
36
ProxyCache
(uint32_t recorderID);
37
~ProxyCache
();
38
39
sk_sp<TextureProxy>
findOrCreateCachedProxy
(
Recorder
*,
const
SkBitmap
&,
Mipmapped
);
40
41
void
purgeAll
();
42
43
#if defined(GRAPHITE_TEST_UTILS)
44
int
numCached()
const
;
45
sk_sp<TextureProxy>
find
(
const
SkBitmap
&,
Mipmapped
);
46
void
forceProcessInvalidKeyMsgs();
47
void
forceFreeUniquelyHeld();
48
void
forcePurgeProxiesNotUsedSince(skgpu::StdSteadyClock::time_point purgeTime);
49
#endif
50
51
private
:
52
friend
class
ResourceCache
;
// for freeUniquelyHeld
53
54
void
processInvalidKeyMsgs();
55
void
freeUniquelyHeld();
56
void
purgeProxiesNotUsedSince(
const
skgpu::StdSteadyClock::time_point* purgeTime);
57
58
typedef
SkMessageBus<skgpu::UniqueKeyInvalidatedMsg_Graphite, uint32_t>::Inbox
InvalidKeyInbox;
59
60
InvalidKeyInbox fInvalidUniqueKeyInbox;
61
62
struct
UniqueKeyHash {
63
uint32_t operator()(
const
skgpu::UniqueKey
&
key
)
const
;
64
};
65
typedef
skia_private::THashMap<skgpu::UniqueKey, sk_sp<TextureProxy>
, UniqueKeyHash>
66
UniqueKeyProxyHash;
67
68
UniqueKeyProxyHash fCache;
69
};
70
71
}
// namespace skgpu::graphite
72
73
#endif
// skgpu_graphite_ProxyCache_DEFINED
GpuTypesPriv.h
ResourceKey.h
SkMessageBus.h
SkRefCnt.h
SkTHash.h
find
int find(T *array, int N, T item)
Definition
all_bitmap_configs.cpp:110
SkBitmap
Definition
SkBitmap.h:59
SkMessageBus::Inbox
Definition
SkMessageBus.h:45
sk_sp
Definition
SkRefCnt.h:220
skgpu::UniqueKey
Definition
ResourceKey.h:241
skgpu::graphite::ProxyCache
Definition
ProxyCache.h:34
skgpu::graphite::ProxyCache::purgeAll
void purgeAll()
Definition
ProxyCache.cpp:117
skgpu::graphite::ProxyCache::findOrCreateCachedProxy
sk_sp< TextureProxy > findOrCreateCachedProxy(Recorder *, const SkBitmap &, Mipmapped)
Definition
ProxyCache.cpp:75
skgpu::graphite::ProxyCache::~ProxyCache
~ProxyCache()
Definition
ProxyCache.cpp:69
skgpu::graphite::Recorder
Definition
Recorder.h:74
skgpu::graphite::ResourceCache
Definition
ResourceCache.h:41
skia_private::THashMap
Definition
SkTHash.h:431
key
int key
Definition
keyboard_key_handler_unittests.cc:114
skgpu::graphite
Definition
BoundsManagerBench.cpp:27
skgpu
Definition
GpuTools.h:21
skgpu::Mipmapped
Mipmapped
Definition
GpuTypes.h:53
Generated on Fri Apr 26 2024 06:17:19 for Flutter Engine by
1.9.8