1 | /* |
---|---|
2 | * Copyright 2019 Google Inc. |
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 GrImageContext_DEFINED |
9 | #define GrImageContext_DEFINED |
10 | |
11 | #include "include/private/GrContext_Base.h" |
12 | #include "include/private/GrSingleOwner.h" |
13 | |
14 | class GrImageContextPriv; |
15 | class GrProxyProvider; |
16 | |
17 | class GrImageContext : public GrContext_Base { |
18 | public: |
19 | ~GrImageContext() override; |
20 | |
21 | // Provides access to functions that aren't part of the public API. |
22 | GrImageContextPriv priv(); |
23 | const GrImageContextPriv priv() const; // NOLINT(readability-const-return-type) |
24 | |
25 | protected: |
26 | friend class GrImageContextPriv; // for hidden functions |
27 | |
28 | GrImageContext(sk_sp<GrContextThreadSafeProxy>); |
29 | |
30 | SK_API virtual void abandonContext(); |
31 | SK_API virtual bool abandoned(); |
32 | |
33 | GrProxyProvider* proxyProvider() { return fProxyProvider.get(); } |
34 | const GrProxyProvider* proxyProvider() const { return fProxyProvider.get(); } |
35 | |
36 | /** This is only useful for debug purposes */ |
37 | GrSingleOwner* singleOwner() const { return &fSingleOwner; } |
38 | |
39 | GrImageContext* asImageContext() override { return this; } |
40 | |
41 | private: |
42 | std::unique_ptr<GrProxyProvider> fProxyProvider; |
43 | |
44 | // In debug builds we guard against improper thread handling |
45 | // This guard is passed to the GrDrawingManager and, from there to all the |
46 | // GrRenderTargetContexts. It is also passed to the GrResourceProvider and SkGpuDevice. |
47 | mutable GrSingleOwner fSingleOwner; |
48 | |
49 | typedef GrContext_Base INHERITED; |
50 | }; |
51 | |
52 | #endif |
53 |