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

Unified Diff: native_client_sdk/src/libraries/nacl_io/event_emitter_tty.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 side-by-side diff with in-line comments
Download patch
Index: native_client_sdk/src/libraries/nacl_io/event_emitter_tty.cc
diff --git a/native_client_sdk/src/libraries/nacl_io/event_emitter_tty.cc b/native_client_sdk/src/libraries/nacl_io/event_emitter_tty.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7df065a0af65742ecbe3355fdc5f1bee22f4c926
--- /dev/null
+++ b/native_client_sdk/src/libraries/nacl_io/event_emitter_tty.cc
@@ -0,0 +1,33 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <poll.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include "nacl_io/event_emitter_tty.h"
+
+namespace nacl_io {
+
+EventEmitterTTY::EventEmitterTTY(size_t size)
+ : fifo_(std::max<size_t>(1, size)) {
+ UpdateStatus_Locked();
+}
+
+size_t EventEmitterPipe::Read_Locked(char* data, size_t len) {
+ size_t out_len = fifo_.Read(data, len);
+
+ UpdateStatus_Locked();
+ return out_len;
+}
+
+size_t EventEmitterPipe::Write_Locked(const char* data, size_t len) {
+ size_t out_len = fifo_.Write(data, len);
+
+ UpdateStatus_Locked();
+ return out_len;
+}
+
+} // namespace nacl_io
+

Powered by Google App Engine
This is Rietveld 408576698