summaryrefslogtreecommitdiffstats
path: root/base/task.h
diff options
context:
space:
mode:
authorajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-18 23:13:01 +0000
committerajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-18 23:13:01 +0000
commitc31af70db21e370eee35a677f6fcc62a2963784a (patch)
treeb3f1908471efc10ac35d61cbffa2c7d160d6247f /base/task.h
parentd55c2380d728c2cc29c1a84970bb1d6f51c397d7 (diff)
downloadchromium_src-c31af70db21e370eee35a677f6fcc62a2963784a.zip
chromium_src-c31af70db21e370eee35a677f6fcc62a2963784a.tar.gz
chromium_src-c31af70db21e370eee35a677f6fcc62a2963784a.tar.bz2
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
Diffstat (limited to 'base/task.h')
-rw-r--r--base/task.h11
1 files changed, 11 insertions, 0 deletions
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<typename T>
+void DeletePointer(T* obj) {
+ delete obj;
+}
+
+template<typename T>
+void ReleasePointer(T* obj) {
+ obj->Release();
+}
+
// RunnableMethodTraits --------------------------------------------------------
//
// This traits-class is used by RunnableMethod to manage the lifetime of the