OLD | NEW |
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2012 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 #ifndef LIBRARIES_NACL_IO_MOUNT_HTML5FS_H_ | 5 #ifndef LIBRARIES_NACL_IO_MOUNT_HTML5FS_H_ |
6 #define LIBRARIES_NACL_IO_MOUNT_HTML5FS_H_ | 6 #define LIBRARIES_NACL_IO_MOUNT_HTML5FS_H_ |
7 | 7 |
8 #include <pthread.h> | 8 #include <pthread.h> |
9 #include "nacl_io/mount.h" | 9 #include "nacl_io/mount.h" |
10 #include "nacl_io/pepper_interface.h" | 10 #include "nacl_io/pepper_interface.h" |
11 | 11 |
12 class MountNode; | 12 class MountNode; |
13 | 13 |
14 class MountHtml5Fs: public Mount { | 14 class MountHtml5Fs : public Mount { |
15 public: | 15 public: |
16 virtual MountNode *Open(const Path& path, int mode); | 16 virtual Error Open(const Path& path, int mode, MountNode** out_node); |
17 virtual int Unlink(const Path& path); | 17 virtual Error Unlink(const Path& path); |
18 virtual int Mkdir(const Path& path, int permissions); | 18 virtual Error Mkdir(const Path& path, int permissions); |
19 virtual int Rmdir(const Path& path); | 19 virtual Error Rmdir(const Path& path); |
20 virtual int Remove(const Path& path); | 20 virtual Error Remove(const Path& path); |
21 | 21 |
22 PP_Resource filesystem_resource() { return filesystem_resource_; } | 22 PP_Resource filesystem_resource() { return filesystem_resource_; } |
23 | 23 |
24 protected: | 24 protected: |
25 MountHtml5Fs(); | 25 MountHtml5Fs(); |
26 | 26 |
27 virtual bool Init(int dev, StringMap_t& args, PepperInterface* ppapi); | 27 virtual Error Init(int dev, StringMap_t& args, PepperInterface* ppapi); |
28 virtual void Destroy(); | 28 virtual void Destroy(); |
29 | 29 |
30 int32_t BlockUntilFilesystemOpen(); | 30 Error BlockUntilFilesystemOpen(); |
31 | 31 |
32 private: | 32 private: |
33 static void FilesystemOpenCallbackThunk(void* user_data, int32_t result); | 33 static void FilesystemOpenCallbackThunk(void* user_data, int32_t result); |
34 void FilesystemOpenCallback(int32_t result); | 34 void FilesystemOpenCallback(int32_t result); |
35 | 35 |
36 PP_Resource filesystem_resource_; | 36 PP_Resource filesystem_resource_; |
37 bool filesystem_open_has_result_; // protected by lock_. | 37 bool filesystem_open_has_result_; // protected by lock_. |
38 int32_t filesystem_open_result_; // protected by lock_. | 38 Error filesystem_open_error_; // protected by lock_. |
39 pthread_cond_t filesystem_open_cond_; | 39 pthread_cond_t filesystem_open_cond_; |
40 | 40 |
41 friend class Mount; | 41 friend class Mount; |
42 }; | 42 }; |
43 | 43 |
44 #endif // LIBRARIES_NACL_IO_MOUNT_HTML5FS_H_ | 44 #endif // LIBRARIES_NACL_IO_MOUNT_HTML5FS_H_ |
OLD | NEW |