Coverage Report

Created: 2024-09-14 07:19

/src/skia/src/gpu/ganesh/GrImageContextPriv.h
Line
Count
Source (jump to first uncovered line)
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 GrImageContextPriv_DEFINED
9
#define GrImageContextPriv_DEFINED
10
11
#include "include/private/gpu/ganesh/GrImageContext.h"
12
13
#include "include/gpu/ganesh/GrContextThreadSafeProxy.h"
14
#include "src/gpu/ganesh/GrBaseContextPriv.h"
15
16
/** Class that exposes methods on GrImageContext that are only intended for use internal to Skia.
17
    This class is purely a privileged window into GrImageContext. It should never have
18
    additional data members or virtual methods. */
19
class GrImageContextPriv : public GrBaseContextPriv {
20
public:
21
836k
    GrImageContext* context() { return static_cast<GrImageContext*>(fContext); }
22
0
    const GrImageContext* context() const { return static_cast<const GrImageContext*>(fContext); }
23
24
836k
    bool abandoned() { return this->context()->abandoned(); }
25
26
0
    static sk_sp<GrImageContext> MakeForPromiseImage(sk_sp<GrContextThreadSafeProxy> tsp) {
27
0
        return GrImageContext::MakeForPromiseImage(std::move(tsp));
28
0
    }
29
30
    /** This is only useful for debug purposes */
31
    SkDEBUGCODE(skgpu::SingleOwner* singleOwner() const { return this->context()->singleOwner(); } )
32
33
protected:
34
11.4M
    explicit GrImageContextPriv(GrImageContext* iContext) : GrBaseContextPriv(iContext) {}
35
36
private:
37
    GrImageContextPriv(const GrImageContextPriv&) = delete;
38
    GrImageContextPriv& operator=(const GrImageContextPriv&) = delete;
39
40
    // No taking addresses of this type.
41
    const GrImageContextPriv* operator&() const;
42
    GrImageContextPriv* operator&();
43
44
    friend class GrImageContext; // to construct/copy this type.
45
46
    using INHERITED = GrBaseContextPriv;
47
};
48
49
1.69M
inline GrImageContextPriv GrImageContext::priv() { return GrImageContextPriv(this); }
50
51
0
inline const GrImageContextPriv GrImageContext::priv () const {  // NOLINT(readability-const-return-type)
52
0
    return GrImageContextPriv(const_cast<GrImageContext*>(this));
53
0
}
54
55
#endif