Coverage Report

Created: 2021-08-22 09:07

/src/skia/src/core/SkArenaAllocList.h
Line
Count
Source
1
/*
2
 * Copyright 2017 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 SkArenaAllocList_DEFINED
9
#define SkArenaAllocList_DEFINED
10
11
#include "include/core/SkTypes.h"
12
#include "src/core/SkArenaAlloc.h"
13
14
/**
15
 * A singly linked list of Ts stored in a SkArenaAlloc. The arena rather than the list owns
16
 * the elements. This supports forward iteration and range based for loops.
17
 */
18
template <typename T>
19
class SkArenaAllocList {
20
private:
21
    struct Node;
22
23
public:
24
61.8k
    SkArenaAllocList() = default;
SkArenaAllocList<std::__1::function<void (std::__1::function<bool (GrTextureProxy*, SkIRect, GrColorType, void const*, unsigned long)>&)> >::SkArenaAllocList()
Line
Count
Source
24
20.6k
    SkArenaAllocList() = default;
SkArenaAllocList<GrOpFlushState::InlineUpload>::SkArenaAllocList()
Line
Count
Source
24
20.6k
    SkArenaAllocList() = default;
SkArenaAllocList<GrOpFlushState::Draw>::SkArenaAllocList()
Line
Count
Source
24
20.6k
    SkArenaAllocList() = default;
25
26
123k
    void reset() { fHead = fTail = nullptr; }
SkArenaAllocList<std::__1::function<void (std::__1::function<bool (GrTextureProxy*, SkIRect, GrColorType, void const*, unsigned long)>&)> >::reset()
Line
Count
Source
26
41.2k
    void reset() { fHead = fTail = nullptr; }
SkArenaAllocList<GrOpFlushState::InlineUpload>::reset()
Line
Count
Source
26
41.2k
    void reset() { fHead = fTail = nullptr; }
SkArenaAllocList<GrOpFlushState::Draw>::reset()
Line
Count
Source
26
41.2k
    void reset() { fHead = fTail = nullptr; }
27
28
    template <typename... Args>
29
    inline T& append(SkArenaAlloc* arena, Args... args);
30
31
    class Iter {
32
    public:
33
69.3k
        Iter() = default;
SkArenaAllocList<GrOpFlushState::Draw>::Iter::Iter()
Line
Count
Source
33
26.2k
        Iter() = default;
SkArenaAllocList<GrOpFlushState::InlineUpload>::Iter::Iter()
Line
Count
Source
33
22.5k
        Iter() = default;
SkArenaAllocList<std::__1::function<void (std::__1::function<bool (GrTextureProxy*, SkIRect, GrColorType, void const*, unsigned long)>&)> >::Iter::Iter()
Line
Count
Source
33
20.6k
        Iter() = default;
34
        inline Iter& operator++();
35
207
        T& operator*() const { return fCurr->fT; }
36
14.7k
        T* operator->() const { return &fCurr->fT; }
SkArenaAllocList<GrOpFlushState::Draw>::Iter::operator->() const
Line
Count
Source
36
14.7k
        T* operator->() const { return &fCurr->fT; }
Unexecuted instantiation: SkArenaAllocList<GrOpFlushState::InlineUpload>::Iter::operator->() const
37
28.3k
        bool operator==(const Iter& that) const { return fCurr == that.fCurr; }
SkArenaAllocList<GrOpFlushState::InlineUpload>::Iter::operator==(SkArenaAllocList<GrOpFlushState::InlineUpload>::Iter const&) const
Line
Count
Source
37
1.87k
        bool operator==(const Iter& that) const { return fCurr == that.fCurr; }
SkArenaAllocList<std::__1::function<void (std::__1::function<bool (GrTextureProxy*, SkIRect, GrColorType, void const*, unsigned long)>&)> >::Iter::operator==(SkArenaAllocList<std::__1::function<void (std::__1::function<bool (GrTextureProxy*, SkIRect, GrColorType, void const*, unsigned long)>&)> >::Iter const&) const
Line
Count
Source
37
20.8k
        bool operator==(const Iter& that) const { return fCurr == that.fCurr; }
SkArenaAllocList<GrOpFlushState::Draw>::Iter::operator==(SkArenaAllocList<GrOpFlushState::Draw>::Iter const&) const
Line
Count
Source
37
5.62k
        bool operator==(const Iter& that) const { return fCurr == that.fCurr; }
38
26.4k
        bool operator!=(const Iter& that) const { return !(*this == that); }
SkArenaAllocList<GrOpFlushState::Draw>::Iter::operator!=(SkArenaAllocList<GrOpFlushState::Draw>::Iter const&) const
Line
Count
Source
38
3.75k
        bool operator!=(const Iter& that) const { return !(*this == that); }
SkArenaAllocList<GrOpFlushState::InlineUpload>::Iter::operator!=(SkArenaAllocList<GrOpFlushState::InlineUpload>::Iter const&) const
Line
Count
Source
38
1.87k
        bool operator!=(const Iter& that) const { return !(*this == that); }
SkArenaAllocList<std::__1::function<void (std::__1::function<bool (GrTextureProxy*, SkIRect, GrColorType, void const*, unsigned long)>&)> >::Iter::operator!=(SkArenaAllocList<std::__1::function<void (std::__1::function<bool (GrTextureProxy*, SkIRect, GrColorType, void const*, unsigned long)>&)> >::Iter const&) const
Line
Count
Source
38
20.8k
        bool operator!=(const Iter& that) const { return !(*this == that); }
39
40
    private:
41
        friend class SkArenaAllocList;
42
63.7k
        explicit Iter(Node* node) : fCurr(node) {}
SkArenaAllocList<std::__1::function<void (std::__1::function<bool (GrTextureProxy*, SkIRect, GrColorType, void const*, unsigned long)>&)> >::Iter::Iter(SkArenaAllocList<std::__1::function<void (std::__1::function<bool (GrTextureProxy*, SkIRect, GrColorType, void const*, unsigned long)>&)> >::Node*)
Line
Count
Source
42
20.6k
        explicit Iter(Node* node) : fCurr(node) {}
SkArenaAllocList<GrOpFlushState::Draw>::Iter::Iter(SkArenaAllocList<GrOpFlushState::Draw>::Node*)
Line
Count
Source
42
22.5k
        explicit Iter(Node* node) : fCurr(node) {}
SkArenaAllocList<GrOpFlushState::InlineUpload>::Iter::Iter(SkArenaAllocList<GrOpFlushState::InlineUpload>::Node*)
Line
Count
Source
42
20.6k
        explicit Iter(Node* node) : fCurr(node) {}
43
        Node* fCurr = nullptr;
44
    };
45
46
63.7k
    Iter begin() { return Iter(fHead); }
SkArenaAllocList<std::__1::function<void (std::__1::function<bool (GrTextureProxy*, SkIRect, GrColorType, void const*, unsigned long)>&)> >::begin()
Line
Count
Source
46
20.6k
    Iter begin() { return Iter(fHead); }
SkArenaAllocList<GrOpFlushState::Draw>::begin()
Line
Count
Source
46
22.5k
    Iter begin() { return Iter(fHead); }
SkArenaAllocList<GrOpFlushState::InlineUpload>::begin()
Line
Count
Source
46
20.6k
    Iter begin() { return Iter(fHead); }
47
28.1k
    Iter end() { return Iter(); }
SkArenaAllocList<GrOpFlushState::Draw>::end()
Line
Count
Source
47
5.62k
    Iter end() { return Iter(); }
SkArenaAllocList<GrOpFlushState::InlineUpload>::end()
Line
Count
Source
47
1.87k
    Iter end() { return Iter(); }
SkArenaAllocList<std::__1::function<void (std::__1::function<bool (GrTextureProxy*, SkIRect, GrColorType, void const*, unsigned long)>&)> >::end()
Line
Count
Source
47
20.6k
    Iter end() { return Iter(); }
48
    Iter tail() { return Iter(fTail); }
49
50
private:
51
    struct Node {
52
        template <typename... Args>
53
2.08k
        Node(Args... args) : fT(std::forward<Args>(args)...) {}
Unexecuted instantiation: SkArenaAllocList<GrOpFlushState::InlineUpload>::Node::Node<std::__1::function<void (std::__1::function<bool (GrTextureProxy*, SkIRect, GrColorType, void const*, unsigned long)>&)>, GrDeferredUploadToken>(std::__1::function<void (std::__1::function<bool (GrTextureProxy*, SkIRect, GrColorType, void const*, unsigned long)>&)>, GrDeferredUploadToken)
SkArenaAllocList<std::__1::function<void (std::__1::function<bool (GrTextureProxy*, SkIRect, GrColorType, void const*, unsigned long)>&)> >::Node::Node<std::__1::function<void (std::__1::function<bool (GrTextureProxy*, SkIRect, GrColorType, void const*, unsigned long)>&)> >(std::__1::function<void (std::__1::function<bool (GrTextureProxy*, SkIRect, GrColorType, void const*, unsigned long)>&)>)
Line
Count
Source
53
207
        Node(Args... args) : fT(std::forward<Args>(args)...) {}
SkArenaAllocList<GrOpFlushState::Draw>::Node::Node<>()
Line
Count
Source
53
1.87k
        Node(Args... args) : fT(std::forward<Args>(args)...) {}
54
        T fT;
55
        Node* fNext = nullptr;
56
    };
57
    Node* fHead = nullptr;
58
    Node* fTail = nullptr;
59
};
60
61
template <typename T>
62
template <typename... Args>
63
2.08k
T& SkArenaAllocList<T>::append(SkArenaAlloc* arena, Args... args) {
64
2.08k
    SkASSERT(!fHead == !fTail);
65
2.08k
    auto* n = arena->make<Node>(std::forward<Args>(args)...);
66
2.08k
    if (!fTail) {
67
405
        fHead = fTail = n;
68
1.67k
    } else {
69
1.67k
        fTail = fTail->fNext = n;
70
1.67k
    }
71
2.08k
    return fTail->fT;
72
2.08k
}
Unexecuted instantiation: GrOpFlushState::InlineUpload& SkArenaAllocList<GrOpFlushState::InlineUpload>::append<std::__1::function<void (std::__1::function<bool (GrTextureProxy*, SkIRect, GrColorType, void const*, unsigned long)>&)>, GrDeferredUploadToken>(SkArenaAlloc*, std::__1::function<void (std::__1::function<bool (GrTextureProxy*, SkIRect, GrColorType, void const*, unsigned long)>&)>, GrDeferredUploadToken)
std::__1::function<void (std::__1::function<bool (GrTextureProxy*, SkIRect, GrColorType, void const*, unsigned long)>&)>& SkArenaAllocList<std::__1::function<void (std::__1::function<bool (GrTextureProxy*, SkIRect, GrColorType, void const*, unsigned long)>&)> >::append<std::__1::function<void (std::__1::function<bool (GrTextureProxy*, SkIRect, GrColorType, void const*, unsigned long)>&)> >(SkArenaAlloc*, std::__1::function<void (std::__1::function<bool (GrTextureProxy*, SkIRect, GrColorType, void const*, unsigned long)>&)>)
Line
Count
Source
63
207
T& SkArenaAllocList<T>::append(SkArenaAlloc* arena, Args... args) {
64
207
    SkASSERT(!fHead == !fTail);
65
207
    auto* n = arena->make<Node>(std::forward<Args>(args)...);
66
207
    if (!fTail) {
67
196
        fHead = fTail = n;
68
11
    } else {
69
11
        fTail = fTail->fNext = n;
70
11
    }
71
207
    return fTail->fT;
72
207
}
GrOpFlushState::Draw& SkArenaAllocList<GrOpFlushState::Draw>::append<>(SkArenaAlloc*)
Line
Count
Source
63
1.87k
T& SkArenaAllocList<T>::append(SkArenaAlloc* arena, Args... args) {
64
1.87k
    SkASSERT(!fHead == !fTail);
65
1.87k
    auto* n = arena->make<Node>(std::forward<Args>(args)...);
66
1.87k
    if (!fTail) {
67
209
        fHead = fTail = n;
68
1.66k
    } else {
69
1.66k
        fTail = fTail->fNext = n;
70
1.66k
    }
71
1.87k
    return fTail->fT;
72
1.87k
}
Unexecuted instantiation: GrOpFlushState::InlineUpload& SkArenaAllocList<GrOpFlushState::InlineUpload>::append<std::__1::function<void (std::__1::function<bool (GrTextureProxy*, SkIRect, GrColorType, void const*, unsigned long)>&)>, GrDeferredUploadToken>(SkArenaAlloc*, std::__1::function<void (std::__1::function<bool (GrTextureProxy*, SkIRect, GrColorType, void const*, unsigned long)>&)>, GrDeferredUploadToken)
73
74
template <typename T>
75
2.08k
typename SkArenaAllocList<T>::Iter& SkArenaAllocList<T>::Iter::operator++() {
76
2.08k
    fCurr = fCurr->fNext;
77
2.08k
    return *this;
78
2.08k
}
Unexecuted instantiation: SkArenaAllocList<GrOpFlushState::InlineUpload>::Iter::operator++()
SkArenaAllocList<GrOpFlushState::Draw>::Iter::operator++()
Line
Count
Source
75
1.87k
typename SkArenaAllocList<T>::Iter& SkArenaAllocList<T>::Iter::operator++() {
76
1.87k
    fCurr = fCurr->fNext;
77
1.87k
    return *this;
78
1.87k
}
SkArenaAllocList<std::__1::function<void (std::__1::function<bool (GrTextureProxy*, SkIRect, GrColorType, void const*, unsigned long)>&)> >::Iter::operator++()
Line
Count
Source
75
207
typename SkArenaAllocList<T>::Iter& SkArenaAllocList<T>::Iter::operator++() {
76
207
    fCurr = fCurr->fNext;
77
207
    return *this;
78
207
}
79
80
#endif