Coverage Report

Created: 2021-08-22 09:07

/src/skia/src/gpu/GrContextThreadSafeProxyPriv.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright 2018 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 GrContextThreadSafeProxyPriv_DEFINED
9
#define GrContextThreadSafeProxyPriv_DEFINED
10
11
#include "include/gpu/GrContextThreadSafeProxy.h"
12
#include "include/private/GrContext_Base.h"
13
14
#include "src/gpu/GrCaps.h"
15
#include "src/gpu/text/GrTextBlobCache.h"
16
17
/**
18
 * Class that adds methods to GrContextThreadSafeProxy that are only intended for use internal to
19
 * Skia. This class is purely a privileged window into GrContextThreadSafeProxy. It should never
20
 * have additional data members or virtual methods.
21
 */
22
class GrContextThreadSafeProxyPriv {
23
public:
24
    void init(sk_sp<const GrCaps>, sk_sp<GrThreadSafePipelineBuilder>) const;
25
26
0
    bool matches(GrContext_Base* candidate) const {
27
0
        return fProxy == candidate->threadSafeProxy().get();
28
0
    }
29
30
70.5k
    GrBackend backend() const { return fProxy->fBackend; }
31
68.0k
    const GrContextOptions& options() const { return fProxy->fOptions; }
32
92.7k
    uint32_t contextID() const { return fProxy->fContextID; }
33
34
1.64M
    const GrCaps* caps() const { return fProxy->fCaps.get(); }
35
1.32k
    sk_sp<const GrCaps> refCaps() const { return fProxy->fCaps; }
36
37
772
    GrTextBlobCache* getTextBlobCache() { return fProxy->fTextBlobCache.get(); }
38
0
    const GrTextBlobCache* getTextBlobCache() const { return fProxy->fTextBlobCache.get(); }
39
40
21.7k
    GrThreadSafeCache* threadSafeCache() { return fProxy->fThreadSafeCache.get(); }
41
0
    const GrThreadSafeCache* threadSafeCache() const { return fProxy->fThreadSafeCache.get(); }
42
43
0
    void abandonContext() { fProxy->abandonContext(); }
44
1.03M
    bool abandoned() const { return fProxy->abandoned(); }
45
46
    // GrContextThreadSafeProxyPriv
47
    static sk_sp<GrContextThreadSafeProxy> Make(GrBackendApi, const GrContextOptions&);
48
49
private:
50
2.94M
    explicit GrContextThreadSafeProxyPriv(GrContextThreadSafeProxy* proxy) : fProxy(proxy) {}
51
    GrContextThreadSafeProxyPriv(const GrContextThreadSafeProxy&) = delete;
52
    GrContextThreadSafeProxyPriv& operator=(const GrContextThreadSafeProxyPriv&) = delete;
53
54
    // No taking addresses of this type.
55
    const GrContextThreadSafeProxyPriv* operator&() const = delete;
56
    GrContextThreadSafeProxyPriv* operator&() = delete;
57
58
    GrContextThreadSafeProxy* fProxy;
59
60
    friend class GrContextThreadSafeProxy;  // to construct/copy this type.
61
};
62
63
2.94M
inline GrContextThreadSafeProxyPriv GrContextThreadSafeProxy::priv() {
64
2.94M
    return GrContextThreadSafeProxyPriv(this);
65
2.94M
}
66
67
0
inline const GrContextThreadSafeProxyPriv GrContextThreadSafeProxy::priv() const {  // NOLINT(readability-const-return-type)
68
0
    return GrContextThreadSafeProxyPriv(const_cast<GrContextThreadSafeProxy*>(this));
69
0
}
70
71
#endif