| 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.h" | 5 #include "nacl_io/html5fs/html5_fs.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 return PPErrorToErrno(result); | 140 return PPErrorToErrno(result); |
| 141 | 141 |
| 142 return 0; | 142 return 0; |
| 143 } | 143 } |
| 144 | 144 |
| 145 Error Html5Fs::Rename(const Path& path, const Path& newpath) { | 145 Error Html5Fs::Rename(const Path& path, const Path& newpath) { |
| 146 Error error = BlockUntilFilesystemOpen(); | 146 Error error = BlockUntilFilesystemOpen(); |
| 147 if (error) | 147 if (error) |
| 148 return error; | 148 return error; |
| 149 | 149 |
| 150 const char* oldpath_full = GetFullPath(path).Join().c_str(); | 150 std::string oldpath_full = GetFullPath(path).Join(); |
| 151 ScopedResource fileref_resource( | 151 ScopedResource fileref_resource( |
| 152 ppapi(), file_ref_iface_->Create(filesystem_resource_, oldpath_full)); | 152 ppapi(), |
| 153 file_ref_iface_->Create(filesystem_resource_, oldpath_full.c_str())); |
| 153 if (!fileref_resource.pp_resource()) | 154 if (!fileref_resource.pp_resource()) |
| 154 return ENOENT; | 155 return ENOENT; |
| 155 | 156 |
| 156 const char* newpath_full = GetFullPath(newpath).Join().c_str(); | 157 std::string newpath_full = GetFullPath(newpath).Join(); |
| 157 ScopedResource new_fileref_resource( | 158 ScopedResource new_fileref_resource( |
| 158 ppapi(), file_ref_iface_->Create(filesystem_resource_, newpath_full)); | 159 ppapi(), |
| 160 file_ref_iface_->Create(filesystem_resource_, newpath_full.c_str())); |
| 159 if (!new_fileref_resource.pp_resource()) | 161 if (!new_fileref_resource.pp_resource()) |
| 160 return ENOENT; | 162 return ENOENT; |
| 161 | 163 |
| 162 int32_t result = file_ref_iface_->Rename(fileref_resource.pp_resource(), | 164 int32_t result = file_ref_iface_->Rename(fileref_resource.pp_resource(), |
| 163 new_fileref_resource.pp_resource(), | 165 new_fileref_resource.pp_resource(), |
| 164 PP_BlockUntilComplete()); | 166 PP_BlockUntilComplete()); |
| 165 if (result != PP_OK) | 167 if (result != PP_OK) |
| 166 return PPErrorToErrno(result); | 168 return PPErrorToErrno(result); |
| 167 | 169 |
| 168 return 0; | 170 return 0; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 } | 296 } |
| 295 | 297 |
| 296 void Html5Fs::FilesystemOpenCallback(int32_t result) { | 298 void Html5Fs::FilesystemOpenCallback(int32_t result) { |
| 297 AUTO_LOCK(filesysem_open_lock_); | 299 AUTO_LOCK(filesysem_open_lock_); |
| 298 filesystem_open_has_result_ = true; | 300 filesystem_open_has_result_ = true; |
| 299 filesystem_open_error_ = PPErrorToErrno(result); | 301 filesystem_open_error_ = PPErrorToErrno(result); |
| 300 pthread_cond_signal(&filesystem_open_cond_); | 302 pthread_cond_signal(&filesystem_open_cond_); |
| 301 } | 303 } |
| 302 | 304 |
| 303 } // namespace nacl_io | 305 } // namespace nacl_io |
| OLD | NEW |