Debian Codegraph @

include/gpu/graphite/PersistentPipelineStorage.h

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 #ifndef skgpu_graphite_PersistentPipelineStorage_DEFINED
9 #define skgpu_graphite_PersistentPipelineStorage_DEFINED
10
11 #include "include/core/SkRefCnt.h"
12 #include "include/private/base/SkAPI.h"
13
14 class SkData;
15
16 namespace skgpu::graphite {
17
18 /**
19 * Abstract class which can be implemented to allow Graphite to persist Pipeline data across
20 * Context lifetimes
21 */
22 class SK_API PersistentPipelineStorage {
23 public:
24 virtual ~PersistentPipelineStorage() = default;
25
26 /**
27 * Should return the data that had been previously stored. It should return null if there
28 * is no prior data.
29 */
30 virtual sk_sp<SkData> load() = 0;
31
32 /**
33 * Should persist the provided Pipeline data.
34 */
35 virtual void store(const SkData& data) = 0;
36
37 protected:
38 PersistentPipelineStorage() = default;
39 PersistentPipelineStorage(const PersistentPipelineStorage&) = delete;
40 PersistentPipelineStorage& operator=(const PersistentPipelineStorage&) = delete;
41 };
42
43 } // namespace skgpu::graphite
44
45 #endif // skgpu_graphite_PersistentPipelineStorage_DEFINED