Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 PP_BlockUntilComplete()); | 222 PP_BlockUntilComplete()); |
| 223 if (result < 0) | 223 if (result < 0) |
| 224 return PPErrorToErrno(result); | 224 return PPErrorToErrno(result); |
| 225 | 225 |
| 226 *out_bytes = result; | 226 *out_bytes = result; |
| 227 return 0; | 227 return 0; |
| 228 } | 228 } |
| 229 | 229 |
| 230 int Html5FsNode::GetType() { return fileio_resource_ ? S_IFREG : S_IFDIR; } | 230 int Html5FsNode::GetType() { return fileio_resource_ ? S_IFREG : S_IFDIR; } |
| 231 | 231 |
| 232 Error Html5FsNode::GetSize(size_t* out_size) { | 232 Error Html5FsNode::GetSize(off_t* out_size) { |
| 233 *out_size = 0; | 233 *out_size = 0; |
| 234 | 234 |
| 235 if (IsaDir()) | 235 if (IsaDir()) |
| 236 return 0; | 236 return 0; |
| 237 | 237 |
| 238 AUTO_LOCK(node_lock_); | 238 AUTO_LOCK(node_lock_); |
| 239 | 239 |
| 240 PP_FileInfo info; | 240 PP_FileInfo info; |
| 241 int32_t result = filesystem_->ppapi()->GetFileIoInterface()->Query( | 241 int32_t result = filesystem_->ppapi()->GetFileIoInterface()->Query( |
| 242 fileio_resource_, &info, PP_BlockUntilComplete()); | 242 fileio_resource_, &info, PP_BlockUntilComplete()); |
| 243 if (result != PP_OK) | 243 if (result != PP_OK) |
| 244 return PPErrorToErrno(result); | 244 return PPErrorToErrno(result); |
| 245 | 245 |
| 246 *out_size = static_cast<size_t>(info.size); | 246 *out_size = static_cast<off_t>(info.size); |
|
Sam Clegg
2014/05/02 17:36:06
Is this cast still needed?
Matthew Turk
2014/05/02 18:47:43
Done.
| |
| 247 return 0; | 247 return 0; |
| 248 } | 248 } |
| 249 | 249 |
| 250 bool Html5FsNode::IsaDir() { return !fileio_resource_; } | 250 bool Html5FsNode::IsaDir() { return !fileio_resource_; } |
| 251 | 251 |
| 252 bool Html5FsNode::IsaFile() { return fileio_resource_; } | 252 bool Html5FsNode::IsaFile() { return fileio_resource_; } |
| 253 | 253 |
| 254 Html5FsNode::Html5FsNode(Filesystem* filesystem, PP_Resource fileref_resource) | 254 Html5FsNode::Html5FsNode(Filesystem* filesystem, PP_Resource fileref_resource) |
| 255 : Node(filesystem), | 255 : Node(filesystem), |
| 256 fileref_resource_(fileref_resource), | 256 fileref_resource_(fileref_resource), |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 291 filesystem_->ppapi()->ReleaseResource(fileio_resource_); | 291 filesystem_->ppapi()->ReleaseResource(fileio_resource_); |
| 292 } | 292 } |
| 293 | 293 |
| 294 filesystem_->ppapi()->ReleaseResource(fileref_resource_); | 294 filesystem_->ppapi()->ReleaseResource(fileref_resource_); |
| 295 fileio_resource_ = 0; | 295 fileio_resource_ = 0; |
| 296 fileref_resource_ = 0; | 296 fileref_resource_ = 0; |
| 297 Node::Destroy(); | 297 Node::Destroy(); |
| 298 } | 298 } |
| 299 | 299 |
| 300 } // namespace nacl_io | 300 } // namespace nacl_io |
| OLD | NEW |