From 43fe9f5fe0dadb1aeff0eb237185e8c71e4b9251 Mon Sep 17 00:00:00 2001 From: "jhawkins@chromium.org" Date: Tue, 3 Jan 2012 18:52:10 +0000 Subject: 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 --- net/base/completion_callback.cc | 13 ---------- net/base/completion_callback.h | 57 +++-------------------------------------- 2 files changed, 3 insertions(+), 67 deletions(-) delete mode 100644 net/base/completion_callback.cc (limited to 'net/base') 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::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 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 OldCompletionCallbackImpl : - public CallbackImpl< T, void (T::*)(int), Tuple1 > { - public: - OldCompletionCallbackImpl(T* obj, void (T::* meth)(int)) - : CallbackImpl< T, void (T::*)(int), - Tuple1 >::CallbackImpl(obj, meth) { - } -}; - typedef base::CancelableCallback 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 CancelableOldCompletionCallback : - public OldCompletionCallbackImpl, - public base::RefCounted > { - public: - CancelableOldCompletionCallback(T* obj, void (T::* meth)(int)) - : OldCompletionCallbackImpl(obj, meth), is_canceled_(false) { - } - - void Cancel() { - is_canceled_ = true; - } - - virtual void RunWithParams(const Tuple1& params) { - if (is_canceled_) { - base::RefCounted >::Release(); - } else { - OldCompletionCallbackImpl::RunWithParams(params); - } - } - - private: - bool is_canceled_; -}; - } // namespace net #endif // NET_BASE_COMPLETION_CALLBACK_H__ -- cgit v1.1