 Chromium Code Reviews
 Chromium Code Reviews Issue 23498015:
  [NaCl SDK] Support non blocking TCP/UDP  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 23498015:
  [NaCl SDK] Support non blocking TCP/UDP  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| Index: native_client_sdk/src/libraries/nacl_io/mount_stream.h | 
| diff --git a/native_client_sdk/src/libraries/nacl_io/mount_stream.h b/native_client_sdk/src/libraries/nacl_io/mount_stream.h | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..4c4d69756c7217dfbdb02aa4a64f2701a04fa2f1 | 
| --- /dev/null | 
| +++ b/native_client_sdk/src/libraries/nacl_io/mount_stream.h | 
| @@ -0,0 +1,77 @@ | 
| +// 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. | 
| + | 
| +#ifndef LIBRARIES_NACL_IO_MOUNT_STREAM_H_ | 
| +#define LIBRARIES_NACL_IO_MOUNT_STREAM_H_ | 
| + | 
| +#include "nacl_io/mount.h" | 
| + | 
| +#include "ppapi/c/pp_completion_callback.h" | 
| +#include "ppapi/c/pp_resource.h" | 
| + | 
| + | 
| +namespace nacl_io { | 
| + | 
| +// MountStreams provides a "mount point" for stream objects which do not | 
| +// provide a path, such as FDs returned by pipe, socket, and sockpair. It | 
| +// also provides a background thread for dispatching completion callbacks. | 
| + | 
| +class MountStream; | 
| +class MountStreamWork; | 
| 
binji
2013/09/15 22:18:58
not needed, you define immediately after
 
noelallen1
2013/09/17 21:21:54
Done.
 | 
| +class MountNodeStream; | 
| + | 
| +class MountStreamWork { | 
| 
binji
2013/09/15 22:18:58
This name confused me at first, because it is name
 
noelallen1
2013/09/17 21:21:54
Done.
 | 
| + public: | 
| + MountStreamWork(MountStream* mount) : mount_(mount) {} | 
| 
binji
2013/09/15 22:18:58
explicit
 
noelallen1
2013/09/17 21:21:54
Done.
 | 
| + virtual ~MountStreamWork() {} | 
| + | 
| + virtual bool Start(int32_t val) = 0; | 
| 
binji
2013/09/15 22:18:58
Document? What is return value? What is "val"?
 
noelallen1
2013/09/17 21:21:54
Done.
 | 
| + virtual void Run(int32_t val) = 0; | 
| + MountStream* mount() { return mount_; } | 
| + | 
| + private: | 
| + MountStream* mount_; | 
| +}; | 
| + | 
| + | 
| +class MountStream : public Mount { | 
| + protected: | 
| + MountStream(); | 
| + | 
| + public: | 
| + // Enqueue a work object onto this MountStream's thread | 
| + void EnqueueWork(MountStreamWork* work); | 
| + | 
| + // Returns a completion callback which will execute the StartWork member | 
| + // of a MountSocketWork object. | 
| + static PP_CompletionCallback GetStartCompletion(MountStreamWork* work); | 
| + | 
| + // Returns a completion callback which will execute the RunCallback member | 
| + // of a MountSocketWork object. | 
| + static PP_CompletionCallback GetRunCompletion(MountStreamWork* work); | 
| + | 
| + virtual Error Access(const Path& path, int a_mode); | 
| + virtual Error Open(const Path& path, | 
| + int o_flags, | 
| + ScopedMountNode* out_node); | 
| + virtual Error Unlink(const Path& path); | 
| + virtual Error Mkdir(const Path& path, int permissions); | 
| + virtual Error Rmdir(const Path& path); | 
| + virtual Error Remove(const Path& path); | 
| + | 
| + static void* StreamThreadThunk(void*); | 
| + void StreamThread(); | 
| + | 
| + private: | 
| + PP_Resource message_loop_; | 
| + pthread_cond_t message_cond_; | 
| + sdk_util::SimpleLock message_lock_; | 
| + | 
| + friend class KernelProxy; | 
| + DISALLOW_COPY_AND_ASSIGN(MountStream); | 
| +}; | 
| + | 
| +} // namespace nacl_io | 
| + | 
| +#endif // LIBRARIES_NACL_IO_MOUNT_STREAM_H_ |