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

Unified Diff: base/files/file_proxy.cc

Issue 238383003: Revert of Base: Make FileProxy automaticaly close the file on a worker thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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
« no previous file with comments | « base/files/file_proxy.h ('k') | base/files/file_proxy_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/files/file_proxy.cc
diff --git a/base/files/file_proxy.cc b/base/files/file_proxy.cc
index fa04d7c44e883aaebf3eef1c068839244aae3d96..b517761cf0cc4c0f7baae959e454ae5745f10a4c 100644
--- a/base/files/file_proxy.cc
+++ b/base/files/file_proxy.cc
@@ -13,38 +13,27 @@
#include "base/task_runner.h"
#include "base/task_runner_util.h"
-namespace {
-
-void FileDeleter(base::File file) {
-}
-
-} // namespace
-
namespace base {
class FileHelper {
public:
FileHelper(FileProxy* proxy, File file)
: file_(file.Pass()),
- error_(File::FILE_ERROR_FAILED),
- task_runner_(proxy->task_runner()),
- proxy_(AsWeakPtr(proxy)) {
+ proxy_(AsWeakPtr(proxy)),
+ error_(File::FILE_ERROR_FAILED) {
}
void PassFile() {
if (proxy_)
proxy_->SetFile(file_.Pass());
- else if (file_.IsValid())
- task_runner_->PostTask(FROM_HERE, Bind(&FileDeleter, Passed(&file_)));
}
protected:
File file_;
+ WeakPtr<FileProxy> proxy_;
File::Error error_;
private:
- scoped_refptr<TaskRunner> task_runner_;
- WeakPtr<FileProxy> proxy_;
DISALLOW_COPY_AND_ASSIGN(FileHelper);
};
@@ -230,12 +219,13 @@
} // namespace
+FileProxy::FileProxy() : task_runner_(NULL) {
+}
+
FileProxy::FileProxy(TaskRunner* task_runner) : task_runner_(task_runner) {
}
FileProxy::~FileProxy() {
- if (file_.IsValid())
- task_runner_->PostTask(FROM_HERE, Bind(&FileDeleter, Passed(&file_)));
}
bool FileProxy::CreateOrOpen(const FilePath& file_path,
« no previous file with comments | « base/files/file_proxy.h ('k') | base/files/file_proxy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698