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

Unified Diff: chrome/browser/chromeos/drive/file_write_helper.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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/drive/file_write_helper.cc
diff --git a/chrome/browser/chromeos/drive/file_write_helper.cc b/chrome/browser/chromeos/drive/file_write_helper.cc
index c48262cd51abdb23171eb0cdc52e30f146cc13ab..b5623edb896502ad314343467945ac244c3e1187 100644
--- a/chrome/browser/chromeos/drive/file_write_helper.cc
+++ b/chrome/browser/chromeos/drive/file_write_helper.cc
@@ -4,26 +4,16 @@
#include "chrome/browser/chromeos/drive/file_write_helper.h"
+#include "base/bind.h"
+#include "base/callback.h"
#include "base/threading/sequenced_worker_pool.h"
+#include "chrome/browser/chromeos/drive/file_system_interface.h"
#include "content/public/browser/browser_thread.h"
using content::BrowserThread;
namespace drive {
-namespace {
-
-// Emits debug log when FileSystem::CloseFile() is complete.
-void EmitDebugLogForCloseFile(const base::FilePath& file_path,
- FileError file_error) {
- if (file_error != FILE_ERROR_OK) {
- LOG(WARNING) << "CloseFile failed: " << file_path.AsUTF8Unsafe() << ": "
- << file_error;
- }
-}
-
-} // namespace
-
FileWriteHelper::FileWriteHelper(FileSystemInterface* file_system)
: file_system_(file_system),
weak_ptr_factory_(this) {
@@ -52,7 +42,8 @@ void FileWriteHelper::PrepareWritableFileAndRunAfterOpenFile(
const base::FilePath& file_path,
const OpenFileCallback& callback,
FileError error,
- const base::FilePath& local_cache_path) {
+ const base::FilePath& local_cache_path,
+ const base::Closure& close_callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!callback.is_null());
@@ -66,16 +57,7 @@ void FileWriteHelper::PrepareWritableFileAndRunAfterOpenFile(
content::BrowserThread::GetBlockingPool()->PostTaskAndReply(
FROM_HERE,
base::Bind(callback, FILE_ERROR_OK, local_cache_path),
- base::Bind(&FileWriteHelper::PrepareWritableFileAndRunAfterCallback,
- weak_ptr_factory_.GetWeakPtr(),
- file_path));
-}
-
-void FileWriteHelper::PrepareWritableFileAndRunAfterCallback(
- const base::FilePath& file_path) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- file_system_->CloseFile(file_path,
- base::Bind(&EmitDebugLogForCloseFile, file_path));
+ close_callback);
}
} // namespace drive
« no previous file with comments | « chrome/browser/chromeos/drive/file_write_helper.h ('k') | chrome/browser/chromeos/drive/file_write_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698