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

Side by Side Diff: native_client_sdk/src/libraries/nacl_io/mount_stream.h

Issue 23498015: [NaCl SDK] Support non blocking TCP/UDP (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added Fifo Tests 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 #ifndef LIBRARIES_NACL_IO_MOUNT_STREAM_H_
6 #define LIBRARIES_NACL_IO_MOUNT_STREAM_H_
7
8 #include "nacl_io/mount.h"
9
10 #include "ppapi/c/pp_completion_callback.h"
11 #include "ppapi/c/pp_resource.h"
12
13
14 namespace nacl_io {
15
16 // MountStreams provides a "mount point" for stream objects which do not
17 // provide a path, such as FDs returned by pipe, socket, and sockpair. It
18 // also provides a background thread for dispatching completion callbacks.
19
20 class MountStream;
21 class MountStreamWork;
binji 2013/09/15 22:18:58 not needed, you define immediately after
noelallen1 2013/09/17 21:21:54 Done.
22 class MountNodeStream;
23
24 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.
25 public:
26 MountStreamWork(MountStream* mount) : mount_(mount) {}
binji 2013/09/15 22:18:58 explicit
noelallen1 2013/09/17 21:21:54 Done.
27 virtual ~MountStreamWork() {}
28
29 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.
30 virtual void Run(int32_t val) = 0;
31 MountStream* mount() { return mount_; }
32
33 private:
34 MountStream* mount_;
35 };
36
37
38 class MountStream : public Mount {
39 protected:
40 MountStream();
41
42 public:
43 // Enqueue a work object onto this MountStream's thread
44 void EnqueueWork(MountStreamWork* work);
45
46 // Returns a completion callback which will execute the StartWork member
47 // of a MountSocketWork object.
48 static PP_CompletionCallback GetStartCompletion(MountStreamWork* work);
49
50 // Returns a completion callback which will execute the RunCallback member
51 // of a MountSocketWork object.
52 static PP_CompletionCallback GetRunCompletion(MountStreamWork* work);
53
54 virtual Error Access(const Path& path, int a_mode);
55 virtual Error Open(const Path& path,
56 int o_flags,
57 ScopedMountNode* out_node);
58 virtual Error Unlink(const Path& path);
59 virtual Error Mkdir(const Path& path, int permissions);
60 virtual Error Rmdir(const Path& path);
61 virtual Error Remove(const Path& path);
62
63 static void* StreamThreadThunk(void*);
64 void StreamThread();
65
66 private:
67 PP_Resource message_loop_;
68 pthread_cond_t message_cond_;
69 sdk_util::SimpleLock message_lock_;
70
71 friend class KernelProxy;
72 DISALLOW_COPY_AND_ASSIGN(MountStream);
73 };
74
75 } // namespace nacl_io
76
77 #endif // LIBRARIES_NACL_IO_MOUNT_STREAM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698