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 | 5 |
6 #include "nacl_io/mount_node_html5fs.h" | 6 #include "nacl_io/mount_node_html5fs.h" |
7 | 7 |
8 #include <errno.h> | 8 #include <errno.h> |
9 #include <fcntl.h> | 9 #include <fcntl.h> |
10 #include <ppapi/c/pp_completion_callback.h> | 10 #include <ppapi/c/pp_completion_callback.h> |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 PP_ArrayOutput output = { &GetOutputBuffer, &output_buf }; | 107 PP_ArrayOutput output = { &GetOutputBuffer, &output_buf }; |
108 int32_t result = mount_->ppapi()->GetDirectoryReaderInterface()->ReadEntries( | 108 int32_t result = mount_->ppapi()->GetDirectoryReaderInterface()->ReadEntries( |
109 directory_reader.pp_resource(), output, | 109 directory_reader.pp_resource(), output, |
110 PP_BlockUntilComplete()); | 110 PP_BlockUntilComplete()); |
111 if (result != PP_OK) { | 111 if (result != PP_OK) { |
112 errno = PPErrorToErrno(result); | 112 errno = PPErrorToErrno(result); |
113 return -1; | 113 return -1; |
114 } | 114 } |
115 | 115 |
116 std::vector<struct dirent> dirents; | 116 std::vector<struct dirent> dirents; |
117 PP_DirectoryEntry_Dev* entries = | 117 PP_DirectoryEntry* entries = static_cast<PP_DirectoryEntry*>(output_buf.data); |
118 static_cast<PP_DirectoryEntry_Dev*>(output_buf.data); | |
119 | 118 |
120 for (int i = 0; i < output_buf.element_count; ++i) { | 119 for (int i = 0; i < output_buf.element_count; ++i) { |
121 PP_Var file_name_var = mount_->ppapi()->GetFileRefInterface()->GetName( | 120 PP_Var file_name_var = mount_->ppapi()->GetFileRefInterface()->GetName( |
122 entries[i].file_ref); | 121 entries[i].file_ref); |
123 | 122 |
124 // Release the file reference. | 123 // Release the file reference. |
125 mount_->ppapi()->ReleaseResource(entries[i].file_ref); | 124 mount_->ppapi()->ReleaseResource(entries[i].file_ref); |
126 | 125 |
127 if (file_name_var.type != PP_VARTYPE_STRING) | 126 if (file_name_var.type != PP_VARTYPE_STRING) |
128 continue; | 127 continue; |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 if (fileio_resource_) { | 268 if (fileio_resource_) { |
270 mount_->ppapi()->GetFileIoInterface()->Close(fileio_resource_); | 269 mount_->ppapi()->GetFileIoInterface()->Close(fileio_resource_); |
271 mount_->ppapi()->ReleaseResource(fileio_resource_); | 270 mount_->ppapi()->ReleaseResource(fileio_resource_); |
272 } | 271 } |
273 | 272 |
274 mount_->ppapi()->ReleaseResource(fileref_resource_); | 273 mount_->ppapi()->ReleaseResource(fileref_resource_); |
275 fileio_resource_ = 0; | 274 fileio_resource_ = 0; |
276 fileref_resource_ = 0; | 275 fileref_resource_ = 0; |
277 MountNode::Destroy(); | 276 MountNode::Destroy(); |
278 } | 277 } |
OLD | NEW |