1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "nacl_io/socket/udp_event_emitter.h"
7 #include "sdk_util/auto_lock.h"
11 UdpEventEmitter::UdpEventEmitter(size_t rsize
, size_t wsize
)
12 : in_fifo_(rsize
), out_fifo_(wsize
) {
13 UpdateStatus_Locked();
16 Packet
* UdpEventEmitter::ReadRXPacket_Locked() {
17 Packet
* packet
= in_fifo_
.ReadPacket();
19 UpdateStatus_Locked();
23 void UdpEventEmitter::WriteRXPacket_Locked(Packet
* packet
) {
24 in_fifo_
.WritePacket(packet
);
26 UpdateStatus_Locked();
29 Packet
* UdpEventEmitter::ReadTXPacket_Locked() {
30 Packet
* packet
= out_fifo_
.ReadPacket();
32 UpdateStatus_Locked();
36 void UdpEventEmitter::WriteTXPacket_Locked(Packet
* packet
) {
37 out_fifo_
.WritePacket(packet
);
39 UpdateStatus_Locked();
42 } // namespace nacl_io