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