Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: native_client_sdk/src/libraries/nacl_io/mount_node_html5fs.cc

Issue 18644009: [NaCl SDK] Upate atomic ops in nacl_io (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add declartions for newval and oldval Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 148
149 if (offs + size >= max) 149 if (offs + size >= max)
150 size = max - offs; 150 size = max - offs;
151 151
152 memcpy(pdir, reinterpret_cast<char*>(dirents.data()) + offs, size); 152 memcpy(pdir, reinterpret_cast<char*>(dirents.data()) + offs, size);
153 *out_bytes = size; 153 *out_bytes = size;
154 return 0; 154 return 0;
155 } 155 }
156 156
157 Error MountNodeHtml5Fs::GetStat(struct stat* stat) { 157 Error MountNodeHtml5Fs::GetStat(struct stat* stat) {
158 AutoLock lock(&lock_); 158 AUTO_LOCK(node_lock_);
159 159
160 PP_FileInfo info; 160 PP_FileInfo info;
161 int32_t result = mount_->ppapi()->GetFileRefInterface()->Query( 161 int32_t result = mount_->ppapi()->GetFileRefInterface()->Query(
162 fileref_resource_, &info, PP_BlockUntilComplete()); 162 fileref_resource_, &info, PP_BlockUntilComplete());
163 if (result != PP_OK) 163 if (result != PP_OK)
164 return PPErrorToErrno(result); 164 return PPErrorToErrno(result);
165 165
166 // Fill in known info here. 166 // Fill in known info here.
167 memcpy(stat, &stat_, sizeof(stat_)); 167 memcpy(stat, &stat_, sizeof(stat_));
168 168
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 if (result < 0) 237 if (result < 0)
238 return PPErrorToErrno(result); 238 return PPErrorToErrno(result);
239 239
240 *out_bytes = result; 240 *out_bytes = result;
241 return 0; 241 return 0;
242 } 242 }
243 243
244 Error MountNodeHtml5Fs::GetSize(size_t* out_size) { 244 Error MountNodeHtml5Fs::GetSize(size_t* out_size) {
245 *out_size = 0; 245 *out_size = 0;
246 246
247 AutoLock lock(&lock_); 247 AUTO_LOCK(node_lock_);
248 248
249 PP_FileInfo info; 249 PP_FileInfo info;
250 int32_t result = mount_->ppapi()->GetFileIoInterface() 250 int32_t result = mount_->ppapi()->GetFileIoInterface()
251 ->Query(fileio_resource_, &info, PP_BlockUntilComplete()); 251 ->Query(fileio_resource_, &info, PP_BlockUntilComplete());
252 if (result != PP_OK) 252 if (result != PP_OK)
253 return PPErrorToErrno(result); 253 return PPErrorToErrno(result);
254 254
255 *out_size = static_cast<size_t>(info.size); 255 *out_size = static_cast<size_t>(info.size);
256 return 0; 256 return 0;
257 } 257 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 mount_->ppapi()->GetFileIoInterface()->Close(fileio_resource_); 298 mount_->ppapi()->GetFileIoInterface()->Close(fileio_resource_);
299 mount_->ppapi()->ReleaseResource(fileio_resource_); 299 mount_->ppapi()->ReleaseResource(fileio_resource_);
300 } 300 }
301 301
302 mount_->ppapi()->ReleaseResource(fileref_resource_); 302 mount_->ppapi()->ReleaseResource(fileref_resource_);
303 fileio_resource_ = 0; 303 fileio_resource_ = 0;
304 fileref_resource_ = 0; 304 fileref_resource_ = 0;
305 MountNode::Destroy(); 305 MountNode::Destroy();
306 } 306 }
307 307
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698