Coverage Report

Created: 2021-08-22 09:07

/src/skia/src/gpu/GrResourceProviderPriv.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 GrResourceProviderPriv_DEFINED
9
#define GrResourceProviderPriv_DEFINED
10
11
#include "src/gpu/GrResourceProvider.h"
12
13
/** Class that adds methods to GrResourceProvider that are only intended for use internal to Skia.
14
    This class is purely a privileged window into GrResourceProvider. It should never have
15
    additional data members or virtual methods. */
16
class GrResourceProviderPriv {
17
public:
18
0
    GrGpu* gpu() { return fResourceProvider->gpu(); }
19
20
private:
21
0
    explicit GrResourceProviderPriv(GrResourceProvider* provider) : fResourceProvider(provider) {}
22
    GrResourceProviderPriv(const GrResourceProviderPriv&) = delete;
23
    GrResourceProviderPriv& operator=(const GrResourceProviderPriv&) = delete;
24
25
    // No taking addresses of this type.
26
    const GrResourceProviderPriv* operator&() const;
27
    GrResourceProviderPriv* operator&();
28
29
    GrResourceProvider* fResourceProvider;
30
    friend class GrResourceProvider; // to construct/copy this type
31
};
32
33
0
inline GrResourceProviderPriv GrResourceProvider::priv() { return GrResourceProviderPriv(this); }
34
35
0
inline const GrResourceProviderPriv GrResourceProvider::priv() const {  // NOLINT(readability-const-return-type)
36
0
    return GrResourceProviderPriv(const_cast<GrResourceProvider*>(this));
37
0
}
38
39
#endif