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

Side by Side Diff: base/file_util_proxy.cc

Issue 8483003: Callback API Change: Reimplement Bind(); support IgnoreResult, full currying, and use less types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 9 years, 1 month 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 | « base/callback_unittest.cc ('k') | base/task_unittest.cc » ('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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/file_util_proxy.h" 5 #include "base/file_util_proxy.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/message_loop_proxy.h" 10 #include "base/message_loop_proxy.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 const FileUtilProxy::CloseTask& close_task) 105 const FileUtilProxy::CloseTask& close_task)
106 : message_loop_proxy_(message_loop_proxy), 106 : message_loop_proxy_(message_loop_proxy),
107 close_task_(close_task), 107 close_task_(close_task),
108 file_handle_(kInvalidPlatformFileValue), 108 file_handle_(kInvalidPlatformFileValue),
109 created_(false), 109 created_(false),
110 error_(PLATFORM_FILE_OK) {} 110 error_(PLATFORM_FILE_OK) {}
111 111
112 ~CreateOrOpenHelper() { 112 ~CreateOrOpenHelper() {
113 if (file_handle_ != kInvalidPlatformFileValue) { 113 if (file_handle_ != kInvalidPlatformFileValue) {
114 message_loop_proxy_->PostTask( 114 message_loop_proxy_->PostTask(
115 FROM_HERE, base::Bind(close_task_, file_handle_)); 115 FROM_HERE,
116 base::Bind(base::IgnoreResult(close_task_), file_handle_));
116 } 117 }
117 } 118 }
118 119
119 void RunWork(const FileUtilProxy::CreateOrOpenTask& task) { 120 void RunWork(const FileUtilProxy::CreateOrOpenTask& task) {
120 error_ = task.Run(&file_handle_, &created_); 121 error_ = task.Run(&file_handle_, &created_);
121 } 122 }
122 123
123 void Reply(const FileUtilProxy::CreateOrOpenCallback& callback) { 124 void Reply(const FileUtilProxy::CreateOrOpenCallback& callback) {
124 DCHECK(!callback.is_null()); 125 DCHECK(!callback.is_null());
125 callback.Run(error_, PassPlatformFile(&file_handle_), created_); 126 callback.Run(error_, PassPlatformFile(&file_handle_), created_);
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 PlatformFile file_handle, 506 PlatformFile file_handle,
506 const StatusCallback& callback) { 507 const StatusCallback& callback) {
507 PlatformFileError* result = new PlatformFileError; 508 PlatformFileError* result = new PlatformFileError;
508 return message_loop_proxy->PostTaskAndReply( 509 return message_loop_proxy->PostTaskAndReply(
509 FROM_HERE, 510 FROM_HERE,
510 ReturnAsParam(close_task, file_handle, result), 511 ReturnAsParam(close_task, file_handle, result),
511 ReplyHelper(callback, Owned(result))); 512 ReplyHelper(callback, Owned(result)));
512 } 513 }
513 514
514 } // namespace base 515 } // namespace base
OLDNEW
« no previous file with comments | « base/callback_unittest.cc ('k') | base/task_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698