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
32
33
34
35
36
37
38
39
40
41
42
43
44
media / cast / logging / simple_event_subscriber.cc [blame]
// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/cast/logging/simple_event_subscriber.h"
#include "base/check.h"
namespace media {
namespace cast {
SimpleEventSubscriber::SimpleEventSubscriber() = default;
SimpleEventSubscriber::~SimpleEventSubscriber() {
DCHECK(thread_checker_.CalledOnValidThread());
}
void SimpleEventSubscriber::OnReceiveFrameEvent(const FrameEvent& frame_event) {
DCHECK(thread_checker_.CalledOnValidThread());
frame_events_.push_back(frame_event);
}
void SimpleEventSubscriber::OnReceivePacketEvent(
const PacketEvent& packet_event) {
DCHECK(thread_checker_.CalledOnValidThread());
packet_events_.push_back(packet_event);
}
void SimpleEventSubscriber::GetFrameEventsAndReset(
std::vector<FrameEvent>* frame_events) {
DCHECK(thread_checker_.CalledOnValidThread());
frame_events->swap(frame_events_);
frame_events_.clear();
}
void SimpleEventSubscriber::GetPacketEventsAndReset(
std::vector<PacketEvent>* packet_events) {
DCHECK(thread_checker_.CalledOnValidThread());
packet_events->swap(packet_events_);
packet_events_.clear();
}
} // namespace cast
} // namespace media