Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(858)

Side by Side Diff: native_client_sdk/src/libraries/nacl_io/event_emitter_tcp.cc

Issue 23498015: [NaCl SDK] Support non blocking TCP/UDP (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 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.
4
5 #include "nacl_io/event_emitter_tcp.h"
6
7 #include <poll.h>
8 #include <stdint.h>
9 #include <stdlib.h>
10
11 #include "nacl_io/fifo_char.h"
12 #include "sdk_util/auto_lock.h"
13
14 namespace nacl_io {
15
16 EventEmitterTCP::EventEmitterTCP(size_t rsize, size_t wsize)
17 : in_fifo_(std::max<size_t>(65536, rsize)),
18 out_fifo_(std::max<size_t>(65536, wsize)) {
19 UpdateStatus_Locked();
20 }
21
22 uint32_t EventEmitterTCP::ReadIn_Locked(char* data, uint32_t len) {
23 uint32_t count = in_fifo_.Read(data, len);
24
25 UpdateStatus_Locked();
26 return count;
27 }
28
29 uint32_t EventEmitterTCP::WriteIn_Locked(const char* data, uint32_t len) {
30 uint32_t count = in_fifo_.Write(data, len);
31
32 UpdateStatus_Locked();
33 return count;
34 }
35
36 uint32_t EventEmitterTCP::ReadOut_Locked(char* data, uint32_t len) {
37 uint32_t count = out_fifo_.Read(data, len);
38
39 UpdateStatus_Locked();
40 return count;
41 }
42
43 uint32_t EventEmitterTCP::WriteOut_Locked(const char* data, uint32_t len) {
44 uint32_t count = out_fifo_.Write(data, len);
45
46 UpdateStatus_Locked();
47 return count;
48 }
49
50
51 } // namespace nacl_io
52
53
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698