xref: /aosp_15_r20/external/skia/include/gpu/graphite/PrecompileContext.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1 /*
2  * Copyright 2024 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_PrecompileContext_DEFINED
9 #define skgpu_graphite_PrecompileContext_DEFINED
10 
11 #include "include/core/SkRefCnt.h"
12 #include "include/private/base/SingleOwner.h"
13 
14 #include <memory>
15 
16 namespace skgpu::graphite {
17 
18 class SharedContext;
19 class PrecompileContextPriv;
20 class ResourceProvider;
21 
22 class SK_API PrecompileContext {
23 public:
24     ~PrecompileContext();
25 
26     // Provides access to functions that aren't part of the public API.
27     PrecompileContextPriv priv();
28     const PrecompileContextPriv priv() const;  // NOLINT(readability-const-return-type)
29 
30 private:
31     friend class PrecompileContextPriv;
32     friend class Context; // for ctor
33 
34     PrecompileContext(sk_sp<SharedContext>);
35 
36     mutable SingleOwner fSingleOwner;
37     sk_sp<SharedContext> fSharedContext;
38     std::unique_ptr<ResourceProvider> fResourceProvider;
39 };
40 
41 }  // namespace skgpu::graphite
42 
43 #endif // skgpu_graphite_PrecompileContext_DEFINED
44