Coverage Report

Created: 2024-05-20 07:14

/src/skia/include/private/chromium/GrPromiseImageTexture.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright 2023 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 GrPromiseImageTexture_DEFINED
9
#define GrPromiseImageTexture_DEFINED
10
11
#include "include/core/SkRefCnt.h"
12
#include "include/core/SkTypes.h"
13
#include "include/gpu/GrBackendSurface.h"
14
/**
15
 * This type is used to fulfill textures for PromiseImages. Once an instance is returned from a
16
 * PromiseImageTextureFulfillProc the GrBackendTexture it wraps must remain valid until the
17
 * corresponding PromiseImageTextureReleaseProc is called.
18
 */
19
class SK_API GrPromiseImageTexture : public SkNVRefCnt<GrPromiseImageTexture> {
20
public:
21
    GrPromiseImageTexture() = delete;
22
    GrPromiseImageTexture(const GrPromiseImageTexture&) = delete;
23
    GrPromiseImageTexture(GrPromiseImageTexture&&) = delete;
24
    ~GrPromiseImageTexture();
25
    GrPromiseImageTexture& operator=(const GrPromiseImageTexture&) = delete;
26
    GrPromiseImageTexture& operator=(GrPromiseImageTexture&&) = delete;
27
28
0
    static sk_sp<GrPromiseImageTexture> Make(const GrBackendTexture& backendTexture) {
29
0
        if (!backendTexture.isValid()) {
30
0
            return nullptr;
31
0
        }
32
0
        return sk_sp<GrPromiseImageTexture>(new GrPromiseImageTexture(backendTexture));
33
0
    }
34
35
0
    GrBackendTexture backendTexture() const { return fBackendTexture; }
36
37
private:
38
    explicit GrPromiseImageTexture(const GrBackendTexture& backendTexture);
39
40
    GrBackendTexture fBackendTexture;
41
};
42
43
#endif // GrPromiseImageTexture_DEFINED