summaryrefslogtreecommitdiffstats
path: root/net/base
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-03 18:52:10 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-03 18:52:10 +0000
commit43fe9f5fe0dadb1aeff0eb237185e8c71e4b9251 (patch)
treec7e93eb6fc796647a37f7494db1af13191571f5c /net/base
parente03bbb880a0da6faf4e92d05cf2b8a6f37d33026 (diff)
downloadchromium_src-43fe9f5fe0dadb1aeff0eb237185e8c71e4b9251.zip
chromium_src-43fe9f5fe0dadb1aeff0eb237185e8c71e4b9251.tar.gz
chromium_src-43fe9f5fe0dadb1aeff0eb237185e8c71e4b9251.tar.bz2
base::Bind: Remove OldCompletionCallback.
BUG=none TEST=none R=groby,awong,csilv Review URL: http://codereview.chromium.org/9064007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116158 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base')
-rw-r--r--net/base/completion_callback.cc13
-rw-r--r--net/base/completion_callback.h57
2 files changed, 3 insertions, 67 deletions
diff --git a/net/base/completion_callback.cc b/net/base/completion_callback.cc
deleted file mode 100644
index f697de1..0000000
--- a/net/base/completion_callback.cc
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "net/base/completion_callback.h"
-
-namespace net {
-
-void OldCompletionCallbackAdapter(OldCompletionCallback* callback, int result) {
- callback->Run(result);
-}
-
-} // namespace net
diff --git a/net/base/completion_callback.h b/net/base/completion_callback.h
index f55a855..1d75bce 100644
--- a/net/base/completion_callback.h
+++ b/net/base/completion_callback.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,68 +6,17 @@
#define NET_BASE_COMPLETION_CALLBACK_H__
#pragma once
-#include "base/callback_old.h"
#include "base/callback.h"
#include "base/cancelable_callback.h"
-#include "net/base/net_export.h"
namespace net {
-// A callback specialization that takes a single int parameter. Usually this
-// is used to report a byte count or network error code.
-typedef Callback1<int>::Type OldCompletionCallback;
+// A callback specialization that takes a single int parameter. Usually this is
+// used to report a byte count or network error code.
typedef base::Callback<void(int)> CompletionCallback;
-// Temporary (in the code) adapter of OldCompletionCallback for use at call
-// sites that expect a CompletionCallback.
-//
-// TODO(jhawkins): Remove once OldCompletionCallback is removed.
-void NET_EXPORT OldCompletionCallbackAdapter(OldCompletionCallback* callback,
- int result);
-
-// Used to implement a OldCompletionCallback.
-template <class T>
-class OldCompletionCallbackImpl :
- public CallbackImpl< T, void (T::*)(int), Tuple1<int> > {
- public:
- OldCompletionCallbackImpl(T* obj, void (T::* meth)(int))
- : CallbackImpl< T, void (T::*)(int),
- Tuple1<int> >::CallbackImpl(obj, meth) {
- }
-};
-
typedef base::CancelableCallback<void(int)> CancelableCompletionCallback;
-// CancelableOldCompletionCallback is used for completion callbacks
-// which may outlive the target for the method dispatch. In such a case, the
-// provider of the callback calls Cancel() to mark the callback as
-// "canceled". When the canceled callback is eventually run it does nothing
-// other than to decrement the refcount to 0 and free the memory.
-template <class T>
-class CancelableOldCompletionCallback :
- public OldCompletionCallbackImpl<T>,
- public base::RefCounted<CancelableOldCompletionCallback<T> > {
- public:
- CancelableOldCompletionCallback(T* obj, void (T::* meth)(int))
- : OldCompletionCallbackImpl<T>(obj, meth), is_canceled_(false) {
- }
-
- void Cancel() {
- is_canceled_ = true;
- }
-
- virtual void RunWithParams(const Tuple1<int>& params) {
- if (is_canceled_) {
- base::RefCounted<CancelableOldCompletionCallback<T> >::Release();
- } else {
- OldCompletionCallbackImpl<T>::RunWithParams(params);
- }
- }
-
- private:
- bool is_canceled_;
-};
-
} // namespace net
#endif // NET_BASE_COMPLETION_CALLBACK_H__