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

Unified Diff: net/base/completion_callback.h

Issue 9064007: base::Bind: Remove OldCompletionCallback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes. Created 8 years, 12 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/base/completion_callback.cc » ('j') | webkit/appcache/appcache_response.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/completion_callback.h
diff --git a/net/base/completion_callback.h b/net/base/completion_callback.h
index f55a8552705f52b32b1e3877b603b8194ad3a7cf..a659d0ae2c8a8d4b8ea55c43e2cc4d14d85c71e0 100644
--- a/net/base/completion_callback.h
+++ b/net/base/completion_callback.h
@@ -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__
« no previous file with comments | « no previous file | net/base/completion_callback.cc » ('j') | webkit/appcache/appcache_response.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698