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

Side by Side Diff: components/filesystem/file_impl.cc

Issue 1176653002: mandoline filesystem: add a sqlite3 vfs to proxy filesystem usage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with ToT and fix the test import. Created 5 years, 6 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/filesystem/file_impl.h" 5 #include "components/filesystem/file_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 if (!new_file.IsValid()) { 253 if (!new_file.IsValid()) {
254 callback.Run(GetError(new_file)); 254 callback.Run(GetError(new_file));
255 return; 255 return;
256 } 256 }
257 257
258 if (file.is_pending()) 258 if (file.is_pending())
259 new FileImpl(file.Pass(), new_file.Pass()); 259 new FileImpl(file.Pass(), new_file.Pass());
260 callback.Run(FILE_ERROR_OK); 260 callback.Run(FILE_ERROR_OK);
261 } 261 }
262 262
263 void FileImpl::Flush(const FlushCallback& callback) {
264 if (!file_.IsValid()) {
265 callback.Run(GetError(file_));
266 return;
267 }
268
269 bool ret = file_.Flush();
270 callback.Run(ret ? FILE_ERROR_OK : FILE_ERROR_FAILED);
271 }
272
263 void FileImpl::AsHandle(const AsHandleCallback& callback) { 273 void FileImpl::AsHandle(const AsHandleCallback& callback) {
264 if (!file_.IsValid()) { 274 if (!file_.IsValid()) {
265 callback.Run(GetError(file_), ScopedHandle()); 275 callback.Run(GetError(file_), ScopedHandle());
266 return; 276 return;
267 } 277 }
268 278
269 base::File new_file = file_.Duplicate(); 279 base::File new_file = file_.Duplicate();
270 if (!new_file.IsValid()) { 280 if (!new_file.IsValid()) {
271 callback.Run(GetError(new_file), ScopedHandle()); 281 callback.Run(GetError(new_file), ScopedHandle());
272 return; 282 return;
(...skipping 19 matching lines...) Expand all
292 new_file.TakePlatformFile(), &mojo_handle); 302 new_file.TakePlatformFile(), &mojo_handle);
293 if (create_result != MOJO_RESULT_OK) { 303 if (create_result != MOJO_RESULT_OK) {
294 callback.Run(FILE_ERROR_FAILED, ScopedHandle()); 304 callback.Run(FILE_ERROR_FAILED, ScopedHandle());
295 return; 305 return;
296 } 306 }
297 307
298 callback.Run(FILE_ERROR_OK, ScopedHandle(mojo::Handle(mojo_handle)).Pass()); 308 callback.Run(FILE_ERROR_OK, ScopedHandle(mojo::Handle(mojo_handle)).Pass());
299 } 309 }
300 310
301 } // namespace filesystem 311 } // namespace filesystem
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698