This source file includes following definitions.
- OnReceiveFrameEvent
- OnReceivePacketEvent
- OnReceiveGenericEvent
- GetFrameEventsAndReset
- GetPacketEventsAndReset
- GetGenericEventsAndReset
#include "media/cast/logging/simple_event_subscriber.h"
#include <vector>
#include "base/logging.h"
namespace media {
namespace cast {
SimpleEventSubscriber::SimpleEventSubscriber() {}
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::OnReceiveGenericEvent(
const GenericEvent& generic_event) {
DCHECK(thread_checker_.CalledOnValidThread());
generic_events_.push_back(generic_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();
}
void SimpleEventSubscriber::GetGenericEventsAndReset(
std::vector<GenericEvent>* generic_events) {
DCHECK(thread_checker_.CalledOnValidThread());
generic_events->swap(generic_events_);
generic_events_.clear();
}
}
}