| 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_html5fs.h" | 6 #include "nacl_io/mount_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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 return 0; | 162 return 0; |
| 163 } | 163 } |
| 164 } | 164 } |
| 165 | 165 |
| 166 void MountHtml5Fs::Destroy() { | 166 void MountHtml5Fs::Destroy() { |
| 167 ppapi_->ReleaseResource(filesystem_resource_); | 167 ppapi_->ReleaseResource(filesystem_resource_); |
| 168 pthread_cond_destroy(&filesystem_open_cond_); | 168 pthread_cond_destroy(&filesystem_open_cond_); |
| 169 } | 169 } |
| 170 | 170 |
| 171 Error MountHtml5Fs::BlockUntilFilesystemOpen() { | 171 Error MountHtml5Fs::BlockUntilFilesystemOpen() { |
| 172 AutoLock lock(&lock_); | 172 AUTO_LOCK(filesysem_open_lock_); |
| 173 while (!filesystem_open_has_result_) { | 173 while (!filesystem_open_has_result_) { |
| 174 pthread_cond_wait(&filesystem_open_cond_, &lock_); | 174 pthread_cond_wait(&filesystem_open_cond_, filesysem_open_lock_.mutex()); |
| 175 } | 175 } |
| 176 return filesystem_open_error_; | 176 return filesystem_open_error_; |
| 177 } | 177 } |
| 178 | 178 |
| 179 // static | 179 // static |
| 180 void MountHtml5Fs::FilesystemOpenCallbackThunk(void* user_data, | 180 void MountHtml5Fs::FilesystemOpenCallbackThunk(void* user_data, |
| 181 int32_t result) { | 181 int32_t result) { |
| 182 MountHtml5Fs* self = static_cast<MountHtml5Fs*>(user_data); | 182 MountHtml5Fs* self = static_cast<MountHtml5Fs*>(user_data); |
| 183 self->FilesystemOpenCallback(result); | 183 self->FilesystemOpenCallback(result); |
| 184 } | 184 } |
| 185 | 185 |
| 186 void MountHtml5Fs::FilesystemOpenCallback(int32_t result) { | 186 void MountHtml5Fs::FilesystemOpenCallback(int32_t result) { |
| 187 AutoLock lock(&lock_); | 187 AUTO_LOCK(filesysem_open_lock_); |
| 188 filesystem_open_has_result_ = true; | 188 filesystem_open_has_result_ = true; |
| 189 filesystem_open_error_ = PPErrorToErrno(result); | 189 filesystem_open_error_ = PPErrorToErrno(result); |
| 190 pthread_cond_signal(&filesystem_open_cond_); | 190 pthread_cond_signal(&filesystem_open_cond_); |
| 191 } | 191 } |
| 192 | 192 |
| OLD | NEW |