| 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 | 9 |
| 10 #include "nacl_io/mount.h" | 10 #include "nacl_io/mount.h" |
| 11 #include "nacl_io/pepper_interface.h" | 11 #include "nacl_io/pepper_interface.h" |
| 12 #include "nacl_io/typed_mount_factory.h" | 12 #include "nacl_io/typed_mount_factory.h" |
| 13 #include "sdk_util/simple_lock.h" |
| 13 | 14 |
| 14 class MountNode; | 15 class MountNode; |
| 15 | 16 |
| 16 class MountHtml5Fs : public Mount { | 17 class MountHtml5Fs : public Mount { |
| 17 public: | 18 public: |
| 18 virtual Error Access(const Path& path, int a_mode); | 19 virtual Error Access(const Path& path, int a_mode); |
| 19 virtual Error Open(const Path& path, int mode, ScopedMountNode* out_node); | 20 virtual Error Open(const Path& path, int mode, ScopedMountNode* out_node); |
| 20 virtual Error Unlink(const Path& path); | 21 virtual Error Unlink(const Path& path); |
| 21 virtual Error Mkdir(const Path& path, int permissions); | 22 virtual Error Mkdir(const Path& path, int permissions); |
| 22 virtual Error Rmdir(const Path& path); | 23 virtual Error Rmdir(const Path& path); |
| 23 virtual Error Remove(const Path& path); | 24 virtual Error Remove(const Path& path); |
| 24 | 25 |
| 25 PP_Resource filesystem_resource() { return filesystem_resource_; } | 26 PP_Resource filesystem_resource() { return filesystem_resource_; } |
| 26 | 27 |
| 27 protected: | 28 protected: |
| 28 MountHtml5Fs(); | 29 MountHtml5Fs(); |
| 29 | 30 |
| 30 virtual Error Init(int dev, StringMap_t& args, PepperInterface* ppapi); | 31 virtual Error Init(int dev, StringMap_t& args, PepperInterface* ppapi); |
| 31 virtual void Destroy(); | 32 virtual void Destroy(); |
| 32 | 33 |
| 33 Error BlockUntilFilesystemOpen(); | 34 Error BlockUntilFilesystemOpen(); |
| 34 | 35 |
| 35 private: | 36 private: |
| 36 static void FilesystemOpenCallbackThunk(void* user_data, int32_t result); | 37 static void FilesystemOpenCallbackThunk(void* user_data, int32_t result); |
| 37 void FilesystemOpenCallback(int32_t result); | 38 void FilesystemOpenCallback(int32_t result); |
| 38 | 39 |
| 39 PP_Resource filesystem_resource_; | 40 PP_Resource filesystem_resource_; |
| 40 bool filesystem_open_has_result_; // protected by lock_. | 41 bool filesystem_open_has_result_; // protected by lock_. |
| 41 Error filesystem_open_error_; // protected by lock_. | 42 Error filesystem_open_error_; // protected by lock_. |
| 43 |
| 42 pthread_cond_t filesystem_open_cond_; | 44 pthread_cond_t filesystem_open_cond_; |
| 45 SimpleLock filesysem_open_lock_; |
| 43 | 46 |
| 44 friend class TypedMountFactory<MountHtml5Fs>; | 47 friend class TypedMountFactory<MountHtml5Fs>; |
| 45 }; | 48 }; |
| 46 | 49 |
| 47 #endif // LIBRARIES_NACL_IO_MOUNT_HTML5FS_H_ | 50 #endif // LIBRARIES_NACL_IO_MOUNT_HTML5FS_H_ |
| OLD | NEW |