diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-03 19:36:57 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-03 19:36:57 +0000 |
commit | 4c03b2e97c1880278c0679680f6eeb6d0154cd53 (patch) | |
tree | f843c17952e8f668c2590738fd1ee46d25efea58 | |
parent | 3d27b13ffd8bbdc963b93b71d7ec41cf8729599f (diff) | |
download | chromium_src-4c03b2e97c1880278c0679680f6eeb6d0154cd53.zip chromium_src-4c03b2e97c1880278c0679680f6eeb6d0154cd53.tar.gz chromium_src-4c03b2e97c1880278c0679680f6eeb6d0154cd53.tar.bz2 |
base::Bind: Remove callback_old.h.
BUG=none
TEST=none
R=groby,awong,csilv
Review URL: http://codereview.chromium.org/9028009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116169 0039d316-1c4b-4281-b951-d872f2087c98
26 files changed, 52 insertions, 330 deletions
diff --git a/base/base.gypi b/base/base.gypi index a96f38f..8ffde65 100644 --- a/base/base.gypi +++ b/base/base.gypi @@ -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. @@ -60,7 +60,6 @@ 'callback.h', 'callback_internal.cc', 'callback_internal.h', - 'callback_old.h', 'cancelable_callback.h', 'command_line.cc', 'command_line.h', diff --git a/base/callback_old.h b/base/callback_old.h deleted file mode 100644 index 7719e66..0000000 --- a/base/callback_old.h +++ /dev/null @@ -1,254 +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. - -#ifndef BASE_CALLBACK_OLD_H_ -#define BASE_CALLBACK_OLD_H_ -#pragma once - -#include "base/memory/raw_scoped_refptr_mismatch_checker.h" -#include "base/tuple.h" - -// Callback -------------------------------------------------------------------- -// -// A Callback is like a Task but with unbound parameters. It is basically an -// object-oriented function pointer. -// -// Callbacks are designed to work with Tuples. A set of helper functions and -// classes is provided to hide the Tuple details from the consumer. Client -// code will generally work with the CallbackRunner base class, which merely -// provides a Run method and is returned by the New* functions. This allows -// users to not care which type of class implements the callback, only that it -// has a certain number and type of arguments. -// -// The implementation of this is done by CallbackImpl, which inherits -// CallbackStorage to store the data. This allows the storage of the data -// (requiring the class type T) to be hidden from users, who will want to call -// this regardless of the implementor's type T. -// -// Note that callbacks currently have no facility for cancelling or abandoning -// them. We currently handle this at a higher level for cases where this is -// necessary. The pointer in a callback must remain valid until the callback -// is made. -// -// Like Task, the callback executor is responsible for deleting the callback -// pointer once the callback has executed. -// -// Example client usage: -// void Object::DoStuff(int, string); -// Callback2<int, string>::Type* callback = -// NewCallback(obj, &Object::DoStuff); -// callback->Run(5, string("hello")); -// delete callback; -// or, equivalently, using tuples directly: -// CallbackRunner<Tuple2<int, string> >* callback = -// NewCallback(obj, &Object::DoStuff); -// callback->RunWithParams(MakeTuple(5, string("hello"))); -// -// There is also a 0-args version that returns a value. Example: -// int Object::GetNextInt(); -// CallbackWithReturnValue<int>::Type* callback = -// NewCallbackWithReturnValue(obj, &Object::GetNextInt); -// int next_int = callback->Run(); -// delete callback; - -// Base for all Callbacks that handles storage of the pointers. -template <class T, typename Method> -class CallbackStorage { - public: - CallbackStorage(T* obj, Method meth) : obj_(obj), meth_(meth) { - } - - protected: - T* obj_; - Method meth_; -}; - -// Interface that is exposed to the consumer, that does the actual calling -// of the method. -template <typename Params> -class CallbackRunner { - public: - typedef Params TupleType; - - virtual ~CallbackRunner() {} - virtual void RunWithParams(const Params& params) = 0; - - // Convenience functions so callers don't have to deal with Tuples. - inline void Run() { - RunWithParams(Tuple0()); - } - - template <typename Arg1> - inline void Run(const Arg1& a) { - RunWithParams(Params(a)); - } - - template <typename Arg1, typename Arg2> - inline void Run(const Arg1& a, const Arg2& b) { - RunWithParams(Params(a, b)); - } - - template <typename Arg1, typename Arg2, typename Arg3> - inline void Run(const Arg1& a, const Arg2& b, const Arg3& c) { - RunWithParams(Params(a, b, c)); - } - - template <typename Arg1, typename Arg2, typename Arg3, typename Arg4> - inline void Run(const Arg1& a, const Arg2& b, const Arg3& c, const Arg4& d) { - RunWithParams(Params(a, b, c, d)); - } - - template <typename Arg1, typename Arg2, typename Arg3, - typename Arg4, typename Arg5> - inline void Run(const Arg1& a, const Arg2& b, const Arg3& c, - const Arg4& d, const Arg5& e) { - RunWithParams(Params(a, b, c, d, e)); - } -}; - -template <class T, typename Method, typename Params> -class CallbackImpl : public CallbackStorage<T, Method>, - public CallbackRunner<Params> { - public: - CallbackImpl(T* obj, Method meth) : CallbackStorage<T, Method>(obj, meth) { - } - virtual void RunWithParams(const Params& params) { - // use "this->" to force C++ to look inside our templatized base class; see - // Effective C++, 3rd Ed, item 43, p210 for details. - DispatchToMethod(this->obj_, this->meth_, params); - } -}; - -// 0-arg implementation -struct Callback0 { - typedef CallbackRunner<Tuple0> Type; -}; - -template <class T> -typename Callback0::Type* NewCallback(T* object, void (T::*method)()) { - return new CallbackImpl<T, void (T::*)(), Tuple0 >(object, method); -} - -// 1-arg implementation -template <typename Arg1> -struct Callback1 { - typedef CallbackRunner<Tuple1<Arg1> > Type; -}; - -template <class T, typename Arg1> -typename Callback1<Arg1>::Type* NewCallback(T* object, - void (T::*method)(Arg1)) { - return new CallbackImpl<T, void (T::*)(Arg1), Tuple1<Arg1> >(object, method); -} - -// 2-arg implementation -template <typename Arg1, typename Arg2> -struct Callback2 { - typedef CallbackRunner<Tuple2<Arg1, Arg2> > Type; -}; - -template <class T, typename Arg1, typename Arg2> -typename Callback2<Arg1, Arg2>::Type* NewCallback( - T* object, - void (T::*method)(Arg1, Arg2)) { - return new CallbackImpl<T, void (T::*)(Arg1, Arg2), - Tuple2<Arg1, Arg2> >(object, method); -} - -// 3-arg implementation -template <typename Arg1, typename Arg2, typename Arg3> -struct Callback3 { - typedef CallbackRunner<Tuple3<Arg1, Arg2, Arg3> > Type; -}; - -template <class T, typename Arg1, typename Arg2, typename Arg3> -typename Callback3<Arg1, Arg2, Arg3>::Type* NewCallback( - T* object, - void (T::*method)(Arg1, Arg2, Arg3)) { - return new CallbackImpl<T, void (T::*)(Arg1, Arg2, Arg3), - Tuple3<Arg1, Arg2, Arg3> >(object, method); -} - -// 4-arg implementation -template <typename Arg1, typename Arg2, typename Arg3, typename Arg4> -struct Callback4 { - typedef CallbackRunner<Tuple4<Arg1, Arg2, Arg3, Arg4> > Type; -}; - -template <class T, typename Arg1, typename Arg2, typename Arg3, typename Arg4> -typename Callback4<Arg1, Arg2, Arg3, Arg4>::Type* NewCallback( - T* object, - void (T::*method)(Arg1, Arg2, Arg3, Arg4)) { - return new CallbackImpl<T, void (T::*)(Arg1, Arg2, Arg3, Arg4), - Tuple4<Arg1, Arg2, Arg3, Arg4> >(object, method); -} - -// 5-arg implementation -template <typename Arg1, typename Arg2, typename Arg3, - typename Arg4, typename Arg5> -struct Callback5 { - typedef CallbackRunner<Tuple5<Arg1, Arg2, Arg3, Arg4, Arg5> > Type; -}; - -template <class T, typename Arg1, typename Arg2, - typename Arg3, typename Arg4, typename Arg5> -typename Callback5<Arg1, Arg2, Arg3, Arg4, Arg5>::Type* NewCallback( - T* object, - void (T::*method)(Arg1, Arg2, Arg3, Arg4, Arg5)) { - return new CallbackImpl<T, void (T::*)(Arg1, Arg2, Arg3, Arg4, Arg5), - Tuple5<Arg1, Arg2, Arg3, Arg4, Arg5> >(object, method); -} - -// An UnboundMethod is a wrapper for a method where the actual object is -// provided at Run dispatch time. -template <class T, class Method, class Params> -class UnboundMethod { - public: - UnboundMethod(Method m, const Params& p) : m_(m), p_(p) { - COMPILE_ASSERT( - (base::internal::ParamsUseScopedRefptrCorrectly<Params>::value), - badunboundmethodparams); - } - void Run(T* obj) const { - DispatchToMethod(obj, m_, p_); - } - private: - Method m_; - Params p_; -}; - -// Return value implementation with no args. -template <typename ReturnValue> -struct CallbackWithReturnValue { - class Type { - public: - virtual ~Type() {} - virtual ReturnValue Run() = 0; - }; -}; - -template <class T, typename Method, typename ReturnValue> -class CallbackWithReturnValueImpl - : public CallbackStorage<T, Method>, - public CallbackWithReturnValue<ReturnValue>::Type { - public: - CallbackWithReturnValueImpl(T* obj, Method meth) - : CallbackStorage<T, Method>(obj, meth) {} - - virtual ReturnValue Run() { - return (this->obj_->*(this->meth_))(); - } - - protected: - virtual ~CallbackWithReturnValueImpl() {} -}; - -template <class T, typename ReturnValue> -typename CallbackWithReturnValue<ReturnValue>::Type* -NewCallbackWithReturnValue(T* object, ReturnValue (T::*method)()) { - return new CallbackWithReturnValueImpl<T, ReturnValue (T::*)(), ReturnValue>( - object, method); -} - -#endif // BASE_CALLBACK_OLD_H_ diff --git a/base/callback_unittest.cc b/base/callback_unittest.cc index e42b933..1c3db04 100644 --- a/base/callback_unittest.cc +++ b/base/callback_unittest.cc @@ -1,10 +1,9 @@ -// 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. #include "base/callback.h" #include "base/callback_internal.h" -#include "base/callback_old.h" #include "base/memory/scoped_ptr.h" #include "testing/gtest/include/gtest/gtest.h" @@ -62,24 +61,6 @@ typedef internal::BindState<void(void), void(void), void(FakeInvoker, FakeInvoker)> FakeBindState2; -TEST(CallbackOld, OneArg) { - HelperObject obj; - scoped_ptr<Callback1<int*>::Type> callback( - NewCallback(&obj, &HelperObject::GetNextNumberArg)); - - int number = 0; - callback->Run(&number); - EXPECT_EQ(number, 1); -} - -TEST(CallbackOld, ReturnValue) { - HelperObject obj; - scoped_ptr<CallbackWithReturnValue<int>::Type> callback( - NewCallbackWithReturnValue(&obj, &HelperObject::GetNextNumber)); - - EXPECT_EQ(callback->Run(), 1); -} - class CallbackTest : public ::testing::Test { public: CallbackTest() diff --git a/base/observer_list_threadsafe.h b/base/observer_list_threadsafe.h index 7a1d81b..9acb82a 100644 --- a/base/observer_list_threadsafe.h +++ b/base/observer_list_threadsafe.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. @@ -11,7 +11,6 @@ #include "base/basictypes.h" #include "base/bind.h" -#include "base/callback_old.h" #include "base/location.h" #include "base/logging.h" #include "base/memory/ref_counted.h" @@ -58,6 +57,24 @@ template <class ObserverType> class ObserverListThreadSafe; +// An UnboundMethod is a wrapper for a method where the actual object is +// provided at Run dispatch time. +template <class T, class Method, class Params> +class UnboundMethod { + public: + UnboundMethod(Method m, const Params& p) : m_(m), p_(p) { + COMPILE_ASSERT( + (base::internal::ParamsUseScopedRefptrCorrectly<Params>::value), + badunboundmethodparams); + } + void Run(T* obj) const { + DispatchToMethod(obj, m_, p_); + } + private: + Method m_; + Params p_; +}; + // This class is used to work around VS2005 not accepting: // // friend class diff --git a/chrome/browser/browsing_data_quota_helper_impl.h b/chrome/browser/browsing_data_quota_helper_impl.h index 2928ab2..d436449 100644 --- a/chrome/browser/browsing_data_quota_helper_impl.h +++ b/chrome/browser/browsing_data_quota_helper_impl.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. @@ -11,7 +11,6 @@ #include <string> #include <utility> -#include "base/callback_old.h" #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" diff --git a/chrome/browser/chromeos/audio_mixer.h b/chrome/browser/chromeos/audio_mixer.h index 3187ed5..ba88736 100644 --- a/chrome/browser/chromeos/audio_mixer.h +++ b/chrome/browser/chromeos/audio_mixer.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. @@ -7,7 +7,6 @@ #pragma once #include "base/basictypes.h" -#include "base/callback_old.h" namespace chromeos { diff --git a/chrome/browser/chromeos/system/timezone_settings.h b/chrome/browser/chromeos/system/timezone_settings.h index 9fe853b..d1f77eb 100644 --- a/chrome/browser/chromeos/system/timezone_settings.h +++ b/chrome/browser/chromeos/system/timezone_settings.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. @@ -8,7 +8,6 @@ #include <string> -#include "base/callback_old.h" #include "chrome/browser/cancelable_request.h" #include "unicode/timezone.h" diff --git a/chrome/browser/icon_manager.h b/chrome/browser/icon_manager.h index 404450c..5c52484 100644 --- a/chrome/browser/icon_manager.h +++ b/chrome/browser/icon_manager.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. // @@ -48,7 +48,6 @@ #include <map> -#include "base/callback_old.h" #include "base/hash_tables.h" #include "chrome/browser/cancelable_request.h" #include "chrome/browser/icon_loader.h" diff --git a/chrome/browser/net/network_stats.cc b/chrome/browser/net/network_stats.cc index 35ee619..075d272 100644 --- a/chrome/browser/net/network_stats.cc +++ b/chrome/browser/net/network_stats.cc @@ -1,11 +1,10 @@ -// 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. #include "chrome/browser/net/network_stats.h" #include "base/bind.h" -#include "base/callback_old.h" #include "base/logging.h" #include "base/message_loop.h" #include "base/metrics/field_trial.h" diff --git a/chrome/browser/safe_browsing/client_side_detection_service.h b/chrome/browser/safe_browsing/client_side_detection_service.h index e04456d..03a3b05 100644 --- a/chrome/browser/safe_browsing/client_side_detection_service.h +++ b/chrome/browser/safe_browsing/client_side_detection_service.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. // @@ -22,7 +22,6 @@ #include <vector> #include "base/basictypes.h" -#include "base/callback_old.h" #include "base/gtest_prod_util.h" #include "base/memory/linked_ptr.h" #include "base/memory/ref_counted.h" diff --git a/chrome/browser/tab_contents/thumbnail_generator.h b/chrome/browser/tab_contents/thumbnail_generator.h index c805a9b..7440b29 100644 --- a/chrome/browser/tab_contents/thumbnail_generator.h +++ b/chrome/browser/tab_contents/thumbnail_generator.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. @@ -11,7 +11,6 @@ #include <vector> #include "base/basictypes.h" -#include "base/callback_old.h" #include "base/memory/linked_ptr.h" #include "base/timer.h" #include "content/browser/renderer_host/backing_store.h" diff --git a/chrome/browser/ui/gtk/tabs/dragged_view_gtk.h b/chrome/browser/ui/gtk/tabs/dragged_view_gtk.h index 8a881e0..7e8c195 100644 --- a/chrome/browser/ui/gtk/tabs/dragged_view_gtk.h +++ b/chrome/browser/ui/gtk/tabs/dragged_view_gtk.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. @@ -9,7 +9,6 @@ #include <gtk/gtk.h> #include <vector> -#include "base/callback_old.h" #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" #include "base/task.h" diff --git a/chrome/browser/ui/webui/history_ui.cc b/chrome/browser/ui/webui/history_ui.cc index 2147e61..0a87f46 100644 --- a/chrome/browser/ui/webui/history_ui.cc +++ b/chrome/browser/ui/webui/history_ui.cc @@ -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. @@ -8,7 +8,6 @@ #include "base/bind.h" #include "base/bind_helpers.h" -#include "base/callback_old.h" #include "base/i18n/time_formatting.h" #include "base/memory/singleton.h" #include "base/message_loop.h" diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc index 21c0d22..d1d58ca 100644 --- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc +++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc @@ -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. @@ -10,7 +10,6 @@ #include "base/auto_reset.h" #include "base/bind.h" #include "base/bind_helpers.h" -#include "base/callback_old.h" #include "base/i18n/rtl.h" #include "base/metrics/histogram.h" #include "base/string_number_conversions.h" diff --git a/chrome/browser/ui/webui/ntp/most_visited_handler.cc b/chrome/browser/ui/webui/ntp/most_visited_handler.cc index 568edb8..0bf7cd8 100644 --- a/chrome/browser/ui/webui/ntp/most_visited_handler.cc +++ b/chrome/browser/ui/webui/ntp/most_visited_handler.cc @@ -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. @@ -8,7 +8,6 @@ #include "base/bind.h" #include "base/bind_helpers.h" -#include "base/callback_old.h" #include "base/command_line.h" #include "base/md5.h" #include "base/memory/scoped_vector.h" diff --git a/chrome/renderer/autofill/form_autofill_util.cc b/chrome/renderer/autofill/form_autofill_util.cc index d34dbf6..95684fd 100644 --- a/chrome/renderer/autofill/form_autofill_util.cc +++ b/chrome/renderer/autofill/form_autofill_util.cc @@ -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,7 +6,6 @@ #include <map> -#include "base/callback_old.h" #include "base/logging.h" #include "base/memory/scoped_vector.h" #include "base/string_util.h" diff --git a/chrome/renderer/safe_browsing/phishing_classifier.h b/chrome/renderer/safe_browsing/phishing_classifier.h index 559dfbf..557bf29 100644 --- a/chrome/renderer/safe_browsing/phishing_classifier.h +++ b/chrome/renderer/safe_browsing/phishing_classifier.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. // @@ -19,7 +19,6 @@ #define CHROME_RENDERER_SAFE_BROWSING_PHISHING_CLASSIFIER_H_ #include "base/basictypes.h" -#include "base/callback_old.h" #include "base/memory/scoped_ptr.h" #include "base/string16.h" #include "base/task.h" diff --git a/chrome_frame/urlmon_url_request_private.h b/chrome_frame/urlmon_url_request_private.h index e9103ab..469963f 100644 --- a/chrome_frame/urlmon_url_request_private.h +++ b/chrome_frame/urlmon_url_request_private.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. @@ -10,7 +10,6 @@ #include <string> -#include "base/callback_old.h" #include "base/gtest_prod_util.h" #include "base/threading/platform_thread.h" #include "net/base/net_errors.h" diff --git a/content/browser/webui/web_ui.h b/content/browser/webui/web_ui.h index c600f5ca..462c2cf 100644 --- a/content/browser/webui/web_ui.h +++ b/content/browser/webui/web_ui.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. @@ -11,7 +11,6 @@ #include <vector> #include "base/callback.h" -#include "base/callback_old.h" #include "base/compiler_specific.h" #include "base/string16.h" #include "content/common/content_export.h" diff --git a/content/renderer/gpu/transport_texture_host.cc b/content/renderer/gpu/transport_texture_host.cc index 11fe9f7..87ed4b1 100644 --- a/content/renderer/gpu/transport_texture_host.cc +++ b/content/renderer/gpu/transport_texture_host.cc @@ -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. @@ -65,11 +65,11 @@ void TransportTextureHost::Destroy() { service_->RemoveRoute(host_id_); } -void TransportTextureHost::GetTextures(TextureUpdateCallback* callback, - std::vector<int>* textures) { +void TransportTextureHost::GetTextures( + const TextureUpdateCallback& callback, std::vector<int>* textures) { textures->resize(textures_.size()); std::copy(textures_.begin(), textures_.end(), textures->begin()); - update_callback_.reset(callback); + update_callback_ = callback; } int TransportTextureHost::GetPeerId() { @@ -187,8 +187,8 @@ void TransportTextureHost::OnReleaseTextures() { } void TransportTextureHost::OnTextureUpdated(int texture_id) { - if (update_callback_.get()) - update_callback_->Run(texture_id); + if (!update_callback_.is_null()) + update_callback_.Run(texture_id); } #endif diff --git a/content/renderer/gpu/transport_texture_host.h b/content/renderer/gpu/transport_texture_host.h index 333a716..5c6b7b6 100644 --- a/content/renderer/gpu/transport_texture_host.h +++ b/content/renderer/gpu/transport_texture_host.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. @@ -92,7 +92,6 @@ #include <vector> #include "base/basictypes.h" -#include "base/callback_old.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/task.h" @@ -106,10 +105,10 @@ class TransportTextureHost : public base::RefCountedThreadSafe<TransportTextureHost>, public IPC::Channel::Listener { public: - typedef Callback1<int>::Type TextureUpdateCallback; + typedef base::Callback<void(int)> TextureUpdateCallback; // |io_message_loop| is where the IPC communication should happen. - // |render_message_loop| is where the GLES2 commands should be exeucted. + // |render_message_loop| is where the GLES2 commands should be executed. // |service| contains the route to this object. // |sender| is used to send IPC messages to GPU process. // |context| is the RendererGLContextt for generating textures. @@ -143,7 +142,7 @@ class TransportTextureHost // // Note that this method doesn't generate any textures, it simply return // the list of textures generated. - void GetTextures(TextureUpdateCallback* callback, + void GetTextures(const TextureUpdateCallback& callback, std::vector<int>* textures); // Return the peer ID of TransportTexture in the GPU process. @@ -188,7 +187,7 @@ class TransportTextureHost std::vector<int> textures_; // Callback when a texture is updated. - scoped_ptr<TextureUpdateCallback> update_callback_; + TextureUpdateCallback update_callback_; DISALLOW_COPY_AND_ASSIGN(TransportTextureHost); }; diff --git a/media/base/pipeline_status.h b/media/base/pipeline_status.h index 508d2d6..e8648c3 100644 --- a/media/base/pipeline_status.h +++ b/media/base/pipeline_status.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,7 +6,6 @@ #define MEDIA_BASE_PIPELINE_STATUS_H_ #include "base/callback.h" -#include "base/callback_old.h" namespace media { diff --git a/media/video/video_decode_accelerator.h b/media/video/video_decode_accelerator.h index ab5d1fb..3118a84 100644 --- a/media/video/video_decode_accelerator.h +++ b/media/video/video_decode_accelerator.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. @@ -8,7 +8,6 @@ #include <vector> #include "base/basictypes.h" -#include "base/callback_old.h" #include "media/base/bitstream_buffer.h" #include "media/base/video_decoder_config.h" #include "media/video/picture.h" diff --git a/net/base/test_completion_callback.h b/net/base/test_completion_callback.h index ac3463f..1519e10 100644 --- a/net/base/test_completion_callback.h +++ b/net/base/test_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,7 +6,6 @@ #define NET_BASE_TEST_COMPLETION_CALLBACK_H_ #pragma once -#include "base/callback_old.h" #include "base/compiler_specific.h" #include "base/tuple.h" #include "net/base/completion_callback.h" diff --git a/net/disk_cache/disk_cache_test_util.h b/net/disk_cache/disk_cache_test_util.h index 348a67a..a3c5508 100644 --- a/net/disk_cache/disk_cache_test_util.h +++ b/net/disk_cache/disk_cache_test_util.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. @@ -8,7 +8,6 @@ #include <string> -#include "base/callback_old.h" #include "base/file_path.h" #include "base/message_loop.h" #include "base/timer.h" diff --git a/webkit/fileapi/file_system_file_util_proxy.h b/webkit/fileapi/file_system_file_util_proxy.h index 16eee74..e1e2448 100644 --- a/webkit/fileapi/file_system_file_util_proxy.h +++ b/webkit/fileapi/file_system_file_util_proxy.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. @@ -8,7 +8,6 @@ #include <vector> #include "base/callback.h" -#include "base/callback_old.h" #include "base/file_path.h" #include "base/file_util_proxy.h" #include "base/memory/ref_counted.h" |