aboutsummaryrefslogtreecommitdiff
path: root/src/frame_span.cc
blob: 8764aa179c776a44795060dce9e0a9dc25f3ddf7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "frame_span.hh"

namespace low_latency {

FrameSpan::FrameSpan(std::shared_ptr<TimestampPool::Handle> handle)
    : head_handle(std::move(handle)) {
    assert(this->head_handle); // Must not be null
}

FrameSpan::~FrameSpan() {}

void FrameSpan::update(std::shared_ptr<TimestampPool::Handle> handle) {
    this->tail_handle = std::move(handle);
}

void FrameSpan::await_completed() const {
    if (this->tail_handle) {
        this->tail_handle->await_end();
        return;
    }
    this->head_handle->await_end();
}

bool FrameSpan::has_completed() const {
    if (this->tail_handle) {
        return this->tail_handle->has_end();
    }
    return this->head_handle->has_end();
}

} // namespace low_latency