From c31af70db21e370eee35a677f6fcc62a2963784a Mon Sep 17 00:00:00 2001 From: "ajwong@chromium.org" Date: Thu, 18 Aug 2011 23:13:01 +0000 Subject: Implementation of PostTaskAndReply() in MessageLoopProxy and BrowserThread. This ensures that the request/reply closures are always deleted on the origin thread, or leaked if the task cannot be completed (due to message loop shutdown). BUG=86301 TEST=new unittests Review URL: http://codereview.chromium.org/7210053 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97387 0039d316-1c4b-4281-b951-d872f2087c98 --- base/task.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'base/task.h') diff --git a/base/task.h b/base/task.h index 460c8c2..b95d748 100644 --- a/base/task.h +++ b/base/task.h @@ -217,6 +217,17 @@ class ReleaseTask : public CancelableTask { const T* obj_; }; +// Equivalents for use by base::Bind(). +template +void DeletePointer(T* obj) { + delete obj; +} + +template +void ReleasePointer(T* obj) { + obj->Release(); +} + // RunnableMethodTraits -------------------------------------------------------- // // This traits-class is used by RunnableMethod to manage the lifetime of the -- cgit v1.1