| 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_mounts/mount_html5fs.h" | 6 #include "nacl_mounts/mount_html5fs.h" |
| 7 | 7 |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <ppapi/c/pp_completion_callback.h> | 9 #include <ppapi/c/pp_completion_callback.h> |
| 10 #include <ppapi/c/pp_errors.h> | 10 #include <ppapi/c/pp_errors.h> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 MountNode *MountHtml5Fs::Open(const Path& path, int mode) { | 27 MountNode *MountHtml5Fs::Open(const Path& path, int mode) { |
| 28 if (!IsFilesystemOpen()) | 28 if (!IsFilesystemOpen()) |
| 29 return NULL; | 29 return NULL; |
| 30 | 30 |
| 31 PP_Resource fileref = ppapi()->GetFileRefInterface()->Create( | 31 PP_Resource fileref = ppapi()->GetFileRefInterface()->Create( |
| 32 filesystem_resource_, path.Join().c_str()); | 32 filesystem_resource_, path.Join().c_str()); |
| 33 if (!fileref) | 33 if (!fileref) |
| 34 return NULL; | 34 return NULL; |
| 35 | 35 |
| 36 // TODO(binji): Are these needed? | 36 MountNodeHtml5Fs* node = new MountNodeHtml5Fs(this, fileref); |
| 37 const int ino = 0; | 37 if (!node->Init(mode)) { |
| 38 const int USR_ID = 1; | |
| 39 const int GRP_ID = 2; | |
| 40 MountNodeHtml5Fs* node = new MountNodeHtml5Fs(this, ino, dev_, fileref); | |
| 41 if (!node->Init(mode, USR_ID, GRP_ID)) { | |
| 42 node->Release(); | 38 node->Release(); |
| 43 return NULL; | 39 return NULL; |
| 44 } | 40 } |
| 45 | 41 |
| 46 return node; | 42 return node; |
| 47 } | 43 } |
| 48 | 44 |
| 49 int MountHtml5Fs::Unlink(const Path& path) { | 45 int MountHtml5Fs::Unlink(const Path& path) { |
| 50 return Remove(path); | 46 return Remove(path); |
| 51 } | 47 } |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 void MountHtml5Fs::FilesystemOpenCallbackThunk(void* user_data, | 157 void MountHtml5Fs::FilesystemOpenCallbackThunk(void* user_data, |
| 162 int32_t result) { | 158 int32_t result) { |
| 163 MountHtml5Fs* self = static_cast<MountHtml5Fs*>(user_data); | 159 MountHtml5Fs* self = static_cast<MountHtml5Fs*>(user_data); |
| 164 self->FilesystemOpenCallback(result); | 160 self->FilesystemOpenCallback(result); |
| 165 } | 161 } |
| 166 | 162 |
| 167 void MountHtml5Fs::FilesystemOpenCallback(int32_t result) { | 163 void MountHtml5Fs::FilesystemOpenCallback(int32_t result) { |
| 168 AutoLock lock(&lock_); | 164 AutoLock lock(&lock_); |
| 169 filesystem_open_ = result == PP_OK; | 165 filesystem_open_ = result == PP_OK; |
| 170 } | 166 } |
| OLD | NEW |