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

Side by Side Diff: native_client_sdk/src/libraries/nacl_io/stream/stream_node.cc

Issue 303223007: [NaCl SDK] nacl_io: Run clang-format over nacl_io sources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "nacl_io/stream/stream_node.h" 5 #include "nacl_io/stream/stream_node.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <pthread.h> 9 #include <pthread.h>
10 #include <string.h> 10 #include <string.h>
11 11
12 #include "nacl_io/ioctl.h" 12 #include "nacl_io/ioctl.h"
13 #include "nacl_io/stream/stream_fs.h" 13 #include "nacl_io/stream/stream_fs.h"
14 #include "sdk_util/atomicops.h" 14 #include "sdk_util/atomicops.h"
15 15
16 namespace nacl_io { 16 namespace nacl_io {
17 17
18 StreamNode::StreamNode(Filesystem* fs) 18 StreamNode::StreamNode(Filesystem* fs)
19 : Node(fs), read_timeout_(-1), write_timeout_(-1), stream_state_flags_(0) {} 19 : Node(fs), read_timeout_(-1), write_timeout_(-1), stream_state_flags_(0) {
20 }
20 21
21 Error StreamNode::Init(int open_flags) { 22 Error StreamNode::Init(int open_flags) {
22 Node::Init(open_flags); 23 Node::Init(open_flags);
23 if (open_flags & O_NONBLOCK) 24 if (open_flags & O_NONBLOCK)
24 SetStreamFlags(SSF_NON_BLOCK); 25 SetStreamFlags(SSF_NON_BLOCK);
25 26
26 return 0; 27 return 0;
27 } 28 }
28 29
29 void StreamNode::SetStreamFlags(uint32_t bits) { 30 void StreamNode::SetStreamFlags(uint32_t bits) {
30 sdk_util::AtomicOrFetch(&stream_state_flags_, bits); 31 sdk_util::AtomicOrFetch(&stream_state_flags_, bits);
31 } 32 }
32 33
33 void StreamNode::ClearStreamFlags(uint32_t bits) { 34 void StreamNode::ClearStreamFlags(uint32_t bits) {
34 sdk_util::AtomicAndFetch(&stream_state_flags_, ~bits); 35 sdk_util::AtomicAndFetch(&stream_state_flags_, ~bits);
35 } 36 }
36 37
37 uint32_t StreamNode::GetStreamFlags() { return stream_state_flags_; } 38 uint32_t StreamNode::GetStreamFlags() {
39 return stream_state_flags_;
40 }
38 41
39 bool StreamNode::TestStreamFlags(uint32_t bits) { 42 bool StreamNode::TestStreamFlags(uint32_t bits) {
40 return (stream_state_flags_ & bits) == bits; 43 return (stream_state_flags_ & bits) == bits;
41 } 44 }
42 45
43 void StreamNode::QueueInput() {} 46 void StreamNode::QueueInput() {
44 void StreamNode::QueueOutput() {} 47 }
48 void StreamNode::QueueOutput() {
49 }
45 50
46 StreamFs* StreamNode::stream() { return static_cast<StreamFs*>(filesystem_); } 51 StreamFs* StreamNode::stream() {
52 return static_cast<StreamFs*>(filesystem_);
53 }
47 54
48 } // namespace nacl_io 55 } // namespace nacl_io
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698