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

Side by Side Diff: base/file_util_proxy.cc

Issue 11369061: Disassociate argument type from return type in PostTaskAndReplyWithResult template. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Don't rely on PTARWR allowing a null reply. Created 8 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 | « no previous file | base/task_runner_util.h » ('j') | base/task_runner_util.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/location.h" 10 #include "base/location.h"
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 Bind(&FlushPlatformFile, file), 398 Bind(&FlushPlatformFile, file),
399 Bind(&CallWithTranslatedParameter, callback)); 399 Bind(&CallWithTranslatedParameter, callback));
400 } 400 }
401 401
402 // static 402 // static
403 bool FileUtilProxy::RelayFileTask( 403 bool FileUtilProxy::RelayFileTask(
404 TaskRunner* task_runner, 404 TaskRunner* task_runner,
405 const tracked_objects::Location& from_here, 405 const tracked_objects::Location& from_here,
406 const FileTask& file_task, 406 const FileTask& file_task,
407 const StatusCallback& callback) { 407 const StatusCallback& callback) {
408 return base::PostTaskAndReplyWithResult( 408 if (callback.is_null()) {
409 task_runner, from_here, file_task, callback); 409 return task_runner->PostTask(from_here,
410 base::Bind(base::IgnoreResult(file_task)));
411 } else {
412 return base::PostTaskAndReplyWithResult(task_runner, from_here, file_task,
413 callback);
414 }
410 } 415 }
411 416
412 // static 417 // static
413 bool FileUtilProxy::RelayCreateOrOpen( 418 bool FileUtilProxy::RelayCreateOrOpen(
414 TaskRunner* task_runner, 419 TaskRunner* task_runner,
415 const CreateOrOpenTask& open_task, 420 const CreateOrOpenTask& open_task,
416 const CloseTask& close_task, 421 const CloseTask& close_task,
417 const CreateOrOpenCallback& callback) { 422 const CreateOrOpenCallback& callback) {
418 CreateOrOpenHelper* helper = new CreateOrOpenHelper( 423 CreateOrOpenHelper* helper = new CreateOrOpenHelper(
419 task_runner, close_task); 424 task_runner, close_task);
420 return task_runner->PostTaskAndReply( 425 return task_runner->PostTaskAndReply(
421 FROM_HERE, 426 FROM_HERE,
422 Bind(&CreateOrOpenHelper::RunWork, Unretained(helper), open_task), 427 Bind(&CreateOrOpenHelper::RunWork, Unretained(helper), open_task),
423 Bind(&CreateOrOpenHelper::Reply, Owned(helper), callback)); 428 Bind(&CreateOrOpenHelper::Reply, Owned(helper), callback));
424 } 429 }
425 430
426 // static 431 // static
427 bool FileUtilProxy::RelayClose( 432 bool FileUtilProxy::RelayClose(
428 TaskRunner* task_runner, 433 TaskRunner* task_runner,
429 const CloseTask& close_task, 434 const CloseTask& close_task,
430 PlatformFile file_handle, 435 PlatformFile file_handle,
431 const StatusCallback& callback) { 436 const StatusCallback& callback) {
432 return base::PostTaskAndReplyWithResult( 437 return base::PostTaskAndReplyWithResult(
433 task_runner, FROM_HERE, Bind(close_task, file_handle), callback); 438 task_runner, FROM_HERE, Bind(close_task, file_handle), callback);
434 } 439 }
435 440
436 } // namespace base 441 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/task_runner_util.h » ('j') | base/task_runner_util.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698