1 // Copyright 2014 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.
5 #ifndef LIBRARIES_NACL_IO_JSFS_JS_FS_NODE_H_
6 #define LIBRARIES_NACL_IO_JSFS_JS_FS_NODE_H_
13 #include <ppapi/c/pp_var.h>
15 #include "nacl_io/jsfs/js_fs.h"
16 #include "nacl_io/node.h"
20 class JsFsNode
: public Node
{
22 typedef JsFs::RequestId RequestId
;
25 JsFsNode(Filesystem
* filesystem
, int32_t fd
);
26 virtual void Destroy();
29 virtual bool CanOpen(int open_flags
);
30 virtual Error
GetStat(struct stat
* stat
);
31 virtual Error
GetSize(off_t
* out_size
);
33 virtual Error
FSync();
34 virtual Error
FTruncate(off_t length
);
35 virtual Error
Read(const HandleAttr
& attr
,
39 virtual Error
Write(const HandleAttr
& attr
,
43 virtual Error
GetDents(size_t offs
,
48 int32_t fd() { return fd_
; }
51 bool SendRequestAndWait(ScopedVar
* out_response
, const char* format
, ...);
52 int ScanVar(PP_Var var
, const char* format
, ...);
54 JsFs
* filesystem() { return static_cast<JsFs
*>(filesystem_
); }
56 PepperInterface
* ppapi_
;
57 VarArrayInterface
* array_iface_
;
58 VarArrayBufferInterface
* buffer_iface_
;
59 VarInterface
* var_iface_
;
63 DISALLOW_COPY_AND_ASSIGN(JsFsNode
);
66 } // namespace nacl_io
68 #endif // LIBRARIES_NACL_IO_JSFS_JS_FS_H_