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

Side by Side Diff: native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs_node.cc

Issue 320983002: [NaCl SDK] nacl_io: Allows subtree of html5fs to be mounted. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "nacl_io/html5fs/html5_fs_node.h" 5 #include "nacl_io/html5fs/html5_fs_node.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <ppapi/c/pp_completion_callback.h> 9 #include <ppapi/c/pp_completion_callback.h>
10 #include <ppapi/c/pp_directory_entry.h> 10 #include <ppapi/c/pp_directory_entry.h>
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 PP_FileInfo info; 242 PP_FileInfo info;
243 int32_t result = filesystem_->ppapi()->GetFileIoInterface()->Query( 243 int32_t result = filesystem_->ppapi()->GetFileIoInterface()->Query(
244 fileio_resource_, &info, PP_BlockUntilComplete()); 244 fileio_resource_, &info, PP_BlockUntilComplete());
245 if (result != PP_OK) 245 if (result != PP_OK)
246 return PPErrorToErrno(result); 246 return PPErrorToErrno(result);
247 247
248 *out_size = info.size; 248 *out_size = info.size;
249 return 0; 249 return 0;
250 } 250 }
251 251
252 bool Html5FsNode::IsaDir() {
253 return !fileio_resource_;
254 }
255
256 bool Html5FsNode::IsaFile() {
257 return fileio_resource_;
258 }
259
260 Html5FsNode::Html5FsNode(Filesystem* filesystem, PP_Resource fileref_resource) 252 Html5FsNode::Html5FsNode(Filesystem* filesystem, PP_Resource fileref_resource)
261 : Node(filesystem), 253 : Node(filesystem),
262 fileref_resource_(fileref_resource), 254 fileref_resource_(fileref_resource),
263 fileio_resource_(0) { 255 fileio_resource_(0) {
264 } 256 }
265 257
266 Error Html5FsNode::Init(int open_flags) { 258 Error Html5FsNode::Init(int open_flags) {
267 Error error = Node::Init(open_flags); 259 Error error = Node::Init(open_flags);
268 if (error) 260 if (error)
269 return error; 261 return error;
(...skipping 28 matching lines...) Expand all
298 filesystem_->ppapi()->ReleaseResource(fileio_resource_); 290 filesystem_->ppapi()->ReleaseResource(fileio_resource_);
299 } 291 }
300 292
301 filesystem_->ppapi()->ReleaseResource(fileref_resource_); 293 filesystem_->ppapi()->ReleaseResource(fileref_resource_);
302 fileio_resource_ = 0; 294 fileio_resource_ = 0;
303 fileref_resource_ = 0; 295 fileref_resource_ = 0;
304 Node::Destroy(); 296 Node::Destroy();
305 } 297 }
306 298
307 } // namespace nacl_io 299 } // namespace nacl_io
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698