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

Side by Side Diff: chrome/browser/chromeos/drive/async_file_util.cc

Issue 19596003: Remove CloseFile from FileSystem. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/drive/dummy_file_system.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/chromeos/drive/async_file_util.h" 5 #include "chrome/browser/chromeos/drive/async_file_util.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/platform_file.h" 10 #include "base/platform_file.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 base::MessageLoopProxy::current(), 43 base::MessageLoopProxy::current(),
44 on_error_callback))); 44 on_error_callback)));
45 } 45 }
46 46
47 // Runs CreateOrOpenFile callback based on the given |error| and |file|. 47 // Runs CreateOrOpenFile callback based on the given |error| and |file|.
48 void RunCreateOrOpenFileCallback( 48 void RunCreateOrOpenFileCallback(
49 const AsyncFileUtil::FileSystemGetter& file_system_getter, 49 const AsyncFileUtil::FileSystemGetter& file_system_getter,
50 const base::FilePath& file_path, 50 const base::FilePath& file_path,
51 const AsyncFileUtil::CreateOrOpenCallback& callback, 51 const AsyncFileUtil::CreateOrOpenCallback& callback,
52 base::PlatformFileError error, 52 base::PlatformFileError error,
53 base::PlatformFile file) { 53 base::PlatformFile file,
54 const base::Closure& close_callback_on_ui_thread) {
54 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 55 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
55 56
56 // It is necessary to make a closure, which runs on file closing here. 57 // It is necessary to make a closure, which runs on file closing here.
57 // It will be provided as a FileSystem::OpenFileCallback's argument later. 58 // It will be provided as a FileSystem::OpenFileCallback's argument later.
58 // (crbug.com/259184). 59 // (crbug.com/259184).
59 callback.Run( 60 callback.Run(
60 error, base::PassPlatformFile(&file), 61 error, base::PassPlatformFile(&file),
61 base::Bind(&PostFileSystemCallback, 62 base::Bind(&google_apis::RunTaskOnThread,
62 file_system_getter, 63 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
63 base::Bind(&fileapi_internal::CloseFile, file_path), 64 close_callback_on_ui_thread));
64 base::Closure()));
65 } 65 }
66 66
67 // Runs CreateOrOpenFile when the error happens. 67 // Runs CreateOrOpenFile when the error happens.
68 void RunCreateOrOpenFileCallbackOnError( 68 void RunCreateOrOpenFileCallbackOnError(
69 const AsyncFileUtil::CreateOrOpenCallback& callback, 69 const AsyncFileUtil::CreateOrOpenCallback& callback,
70 base::PlatformFileError error) { 70 base::PlatformFileError error) {
71 // Because the |callback| takes PassPlatformFile as its argument, and 71 // Because the |callback| takes PassPlatformFile as its argument, and
72 // it is necessary to garantee the pointer passed to PassPlatformFile is 72 // it is necessary to garantee the pointer passed to PassPlatformFile is
73 // alive during the |callback| invocation, here we prepare a thin adapter 73 // alive during the |callback| invocation, here we prepare a thin adapter
74 // to have PlatformFile on stack frame. 74 // to have PlatformFile on stack frame.
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 base::Bind(&RunCreateSnapshotFileCallback, callback))), 422 base::Bind(&RunCreateSnapshotFileCallback, callback))),
423 base::Bind(callback, 423 base::Bind(callback,
424 base::PLATFORM_FILE_ERROR_FAILED, 424 base::PLATFORM_FILE_ERROR_FAILED,
425 base::PlatformFileInfo(), 425 base::PlatformFileInfo(),
426 base::FilePath(), 426 base::FilePath(),
427 scoped_refptr<webkit_blob::ShareableFileReference>())); 427 scoped_refptr<webkit_blob::ShareableFileReference>()));
428 } 428 }
429 429
430 } // namespace internal 430 } // namespace internal
431 } // namespace drive 431 } // namespace drive
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/drive/dummy_file_system.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698