Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / native_client_sdk / src / libraries / nacl_io / socket / udp_event_emitter.h
blobfe79f37878490c18772b18bdd27f03b8ecc4c7e5
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 #ifndef LIBRARIES_NACL_IO_SOCKET_UDP_EVENT_EMITTER_H_
6 #define LIBRARIES_NACL_IO_SOCKET_UDP_EVENT_EMITTER_H_
8 #include "nacl_io/socket/fifo_packet.h"
9 #include "nacl_io/stream/stream_event_emitter.h"
11 #include "sdk_util/macros.h"
12 #include "sdk_util/scoped_ref.h"
14 namespace nacl_io {
16 class UdpEventEmitter;
17 typedef sdk_util::ScopedRef<UdpEventEmitter> ScopedUdpEventEmitter;
19 class UdpEventEmitter : public StreamEventEmitter {
20 public:
21 UdpEventEmitter(size_t rsize, size_t wsize);
23 // Takes or gives away ownership of the packet.
24 Packet* ReadRXPacket_Locked();
25 void WriteRXPacket_Locked(Packet* packet);
27 Packet* ReadTXPacket_Locked();
28 void WriteTXPacket_Locked(Packet* packet);
30 protected:
31 virtual FIFOPacket* in_fifo() { return &in_fifo_; }
32 virtual FIFOPacket* out_fifo() { return &out_fifo_; }
34 private:
35 FIFOPacket in_fifo_;
36 FIFOPacket out_fifo_;
37 DISALLOW_COPY_AND_ASSIGN(UdpEventEmitter);
40 } // namespace nacl_io
42 #endif // LIBRARIES_NACL_IO_SOCKET_UDP_EVENT_EMITTER_H_