diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-03 18:23:04 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-03 18:23:04 +0000 |
commit | 820de97b4820ef0da82d9ee74f3009dc88d3c93e (patch) | |
tree | 0da49acabf8120cff772f76ad9027050de6f5539 | |
parent | 8f98e19808d84fbbe5168f029ea56e81b0c53d54 (diff) | |
download | chromium_src-820de97b4820ef0da82d9ee74f3009dc88d3c93e.zip chromium_src-820de97b4820ef0da82d9ee74f3009dc88d3c93e.tar.gz chromium_src-820de97b4820ef0da82d9ee74f3009dc88d3c93e.tar.bz2 |
base::Bind: Remove scoped_callback_factory.h.
BUG=none
TEST=none
R=groby
Review URL: http://codereview.chromium.org/9032010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116148 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/base.gypi | 1 | ||||
-rw-r--r-- | base/memory/scoped_callback_factory.h | 133 | ||||
-rw-r--r-- | chrome/browser/browsing_data_quota_helper_impl.h | 1 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/client_side_detection_host.h | 1 | ||||
-rw-r--r-- | chrome/renderer/safe_browsing/phishing_classifier_delegate.cc | 1 | ||||
-rw-r--r-- | content/browser/browser_main_loop.cc | 1 | ||||
-rw-r--r-- | content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc | 1 | ||||
-rw-r--r-- | webkit/appcache/appcache_quota_client_unittest.cc | 1 | ||||
-rw-r--r-- | webkit/chromeos/fileapi/cros_mount_point_provider.cc | 1 | ||||
-rw-r--r-- | webkit/fileapi/file_system_operation.h | 1 | ||||
-rw-r--r-- | webkit/fileapi/file_system_path_manager.cc | 1 | ||||
-rw-r--r-- | webkit/fileapi/file_system_quota_unittest.cc | 1 | ||||
-rw-r--r-- | webkit/fileapi/sandbox_mount_point_provider.cc | 1 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_video_capture_impl.h | 1 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_video_decoder_impl.h | 1 | ||||
-rw-r--r-- | webkit/plugins/ppapi/quota_file_io.cc | 1 | ||||
-rw-r--r-- | webkit/tools/test_shell/simple_file_system.cc | 1 |
17 files changed, 1 insertions, 148 deletions
diff --git a/base/base.gypi b/base/base.gypi index 8812934..a96f38f 100644 --- a/base/base.gypi +++ b/base/base.gypi @@ -171,7 +171,6 @@ 'memory/ref_counted.h', 'memory/ref_counted_memory.cc', 'memory/ref_counted_memory.h', - 'memory/scoped_callback_factory.h', 'memory/scoped_handle.h', 'memory/scoped_nsobject.h', 'memory/scoped_open_process.h', diff --git a/base/memory/scoped_callback_factory.h b/base/memory/scoped_callback_factory.h deleted file mode 100644 index 2c2b0eb..0000000 --- a/base/memory/scoped_callback_factory.h +++ /dev/null @@ -1,133 +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. - -// ScopedCallbackFactory helps in cases where you wish to allocate a Callback -// (see base/callback.h), but need to prevent any pending callbacks from -// executing when your object gets destroyed. -// -// EXAMPLE: -// -// void GatherDataAsynchronously(Callback1<Data>::Type* callback); -// -// class MyClass { -// public: -// MyClass() : factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { -// } -// -// void Process() { -// GatherDataAsynchronously(factory_.NewCallback(&MyClass::GotData)); -// } -// -// private: -// void GotData(const Data& data) { -// ... -// } -// -// base::ScopedCallbackFactory<MyClass> factory_; -// }; -// -// In the above example, the Process function calls GatherDataAsynchronously to -// kick off some asynchronous processing that upon completion will notify a -// callback. If in the meantime, the MyClass instance is destroyed, when the -// callback runs, it will notice that the MyClass instance is dead, and it will -// avoid calling the GotData method. - -#ifndef BASE_MEMORY_SCOPED_CALLBACK_FACTORY_H_ -#define BASE_MEMORY_SCOPED_CALLBACK_FACTORY_H_ - -#include "base/callback_old.h" -#include "base/memory/weak_ptr.h" - -namespace base { - -template <class T> -class ScopedCallbackFactory { - public: - explicit ScopedCallbackFactory(T* obj) : weak_factory_(obj) { - } - - typename Callback0::Type* NewCallback( - void (T::*method)()) { - return new CallbackImpl<void (T::*)(), Tuple0 >( - weak_factory_.GetWeakPtr(), method); - } - - template <typename Arg1> - typename Callback1<Arg1>::Type* NewCallback( - void (T::*method)(Arg1)) { - return new CallbackImpl<void (T::*)(Arg1), Tuple1<Arg1> >( - weak_factory_.GetWeakPtr(), method); - } - - template <typename Arg1, typename Arg2> - typename Callback2<Arg1, Arg2>::Type* NewCallback( - void (T::*method)(Arg1, Arg2)) { - return new CallbackImpl<void (T::*)(Arg1, Arg2), Tuple2<Arg1, Arg2> >( - weak_factory_.GetWeakPtr(), method); - } - - template <typename Arg1, typename Arg2, typename Arg3> - typename Callback3<Arg1, Arg2, Arg3>::Type* NewCallback( - void (T::*method)(Arg1, Arg2, Arg3)) { - return new CallbackImpl<void (T::*)(Arg1, Arg2, Arg3), - Tuple3<Arg1, Arg2, Arg3> >( - weak_factory_.GetWeakPtr(), method); - } - - template <typename Arg1, typename Arg2, typename Arg3, typename Arg4> - typename Callback4<Arg1, Arg2, Arg3, Arg4>::Type* NewCallback( - void (T::*method)(Arg1, Arg2, Arg3, Arg4)) { - return new CallbackImpl<void (T::*)(Arg1, Arg2, Arg3, Arg4), - Tuple4<Arg1, Arg2, Arg3, Arg4> >( - weak_factory_.GetWeakPtr(), method); - } - - template <typename Arg1, typename Arg2, typename Arg3, typename Arg4, - typename Arg5> - typename Callback5<Arg1, Arg2, Arg3, Arg4, Arg5>::Type* NewCallback( - void (T::*method)(Arg1, Arg2, Arg3, Arg4, Arg5)) { - return new CallbackImpl<void (T::*)(Arg1, Arg2, Arg3, Arg4, Arg5), - Tuple5<Arg1, Arg2, Arg3, Arg4, Arg5> >( - weak_factory_.GetWeakPtr(), method); - } - - void RevokeAll() { weak_factory_.InvalidateWeakPtrs(); } - bool HasPendingCallbacks() const { return weak_factory_.HasWeakPtrs(); } - - private: - template <typename Method> - class CallbackStorage { - public: - CallbackStorage(const WeakPtr<T>& obj, Method meth) - : obj_(obj), - meth_(meth) { - } - - protected: - WeakPtr<T> obj_; - Method meth_; - }; - - template <typename Method, typename Params> - class CallbackImpl : public CallbackStorage<Method>, - public CallbackRunner<Params> { - public: - CallbackImpl(const WeakPtr<T>& obj, Method meth) - : CallbackStorage<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. - if (!this->obj_) - return; - DispatchToMethod(this->obj_.get(), this->meth_, params); - } - }; - - WeakPtrFactory<T> weak_factory_; -}; - -} // namespace base - -#endif // BASE_MEMORY_SCOPED_CALLBACK_FACTORY_H_ diff --git a/chrome/browser/browsing_data_quota_helper_impl.h b/chrome/browser/browsing_data_quota_helper_impl.h index 83b4629..2928ab2 100644 --- a/chrome/browser/browsing_data_quota_helper_impl.h +++ b/chrome/browser/browsing_data_quota_helper_impl.h @@ -14,7 +14,6 @@ #include "base/callback_old.h" #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" -#include "base/memory/scoped_callback_factory.h" #include "base/memory/scoped_ptr.h" #include "base/time.h" #include "chrome/browser/browsing_data_quota_helper.h" diff --git a/chrome/browser/safe_browsing/client_side_detection_host.h b/chrome/browser/safe_browsing/client_side_detection_host.h index b8937fc..4a9ef12 100644 --- a/chrome/browser/safe_browsing/client_side_detection_host.h +++ b/chrome/browser/safe_browsing/client_side_detection_host.h @@ -11,7 +11,6 @@ #include "base/basictypes.h" #include "base/memory/ref_counted.h" -#include "base/memory/scoped_callback_factory.h" #include "base/memory/scoped_ptr.h" #include "chrome/browser/safe_browsing/browser_feature_extractor.h" #include "chrome/browser/safe_browsing/safe_browsing_service.h" diff --git a/chrome/renderer/safe_browsing/phishing_classifier_delegate.cc b/chrome/renderer/safe_browsing/phishing_classifier_delegate.cc index 96d8d9a..ce7b3bf 100644 --- a/chrome/renderer/safe_browsing/phishing_classifier_delegate.cc +++ b/chrome/renderer/safe_browsing/phishing_classifier_delegate.cc @@ -11,7 +11,6 @@ #include "base/lazy_instance.h" #include "base/logging.h" #include "base/metrics/histogram.h" -#include "base/memory/scoped_callback_factory.h" #include "chrome/common/safe_browsing/csd.pb.h" #include "chrome/common/safe_browsing/safebrowsing_messages.h" #include "chrome/renderer/safe_browsing/feature_extractor_clock.h" diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc index 9e12ef5..2a1f681 100644 --- a/content/browser/browser_main_loop.cc +++ b/content/browser/browser_main_loop.cc @@ -4,6 +4,7 @@ #include "content/browser/browser_main_loop.h" +#include "base/bind.h" #include "base/command_line.h" #include "base/debug/trace_event.h" #include "base/logging.h" diff --git a/content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc b/content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc index 98a7441..04e7041 100644 --- a/content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc +++ b/content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc @@ -7,7 +7,6 @@ #include "base/bind.h" #include "base/file_path.h" #include "base/file_util.h" -#include "base/memory/scoped_callback_factory.h" #include "base/message_loop.h" #include "base/message_loop_proxy.h" #include "base/scoped_temp_dir.h" diff --git a/webkit/appcache/appcache_quota_client_unittest.cc b/webkit/appcache/appcache_quota_client_unittest.cc index 28428bc..ca98fc3 100644 --- a/webkit/appcache/appcache_quota_client_unittest.cc +++ b/webkit/appcache/appcache_quota_client_unittest.cc @@ -6,7 +6,6 @@ #include <set> #include "base/bind.h" -#include "base/memory/scoped_callback_factory.h" #include "base/message_loop.h" #include "base/message_loop_proxy.h" #include "net/base/net_errors.h" diff --git a/webkit/chromeos/fileapi/cros_mount_point_provider.cc b/webkit/chromeos/fileapi/cros_mount_point_provider.cc index ddb4c4c..68c5024 100644 --- a/webkit/chromeos/fileapi/cros_mount_point_provider.cc +++ b/webkit/chromeos/fileapi/cros_mount_point_provider.cc @@ -5,7 +5,6 @@ #include "webkit/chromeos/fileapi/cros_mount_point_provider.h" #include "base/logging.h" -#include "base/memory/scoped_callback_factory.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop.h" #include "base/message_loop_proxy.h" diff --git a/webkit/fileapi/file_system_operation.h b/webkit/fileapi/file_system_operation.h index f1b948f..3126bc4 100644 --- a/webkit/fileapi/file_system_operation.h +++ b/webkit/fileapi/file_system_operation.h @@ -12,7 +12,6 @@ #include "base/file_util_proxy.h" #include "base/gtest_prod_util.h" #include "base/memory/ref_counted.h" -#include "base/memory/scoped_callback_factory.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop_proxy.h" #include "base/platform_file.h" diff --git a/webkit/fileapi/file_system_path_manager.cc b/webkit/fileapi/file_system_path_manager.cc index 0c27ad2..a6eb20f 100644 --- a/webkit/fileapi/file_system_path_manager.cc +++ b/webkit/fileapi/file_system_path_manager.cc @@ -6,7 +6,6 @@ #include "base/rand_util.h" #include "base/logging.h" -#include "base/memory/scoped_callback_factory.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop.h" #include "base/message_loop_proxy.h" diff --git a/webkit/fileapi/file_system_quota_unittest.cc b/webkit/fileapi/file_system_quota_unittest.cc index f901d43..14a729b 100644 --- a/webkit/fileapi/file_system_quota_unittest.cc +++ b/webkit/fileapi/file_system_quota_unittest.cc @@ -10,7 +10,6 @@ #include "base/bind.h" #include "base/file_util.h" #include "base/logging.h" -#include "base/memory/scoped_callback_factory.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop.h" #include "base/platform_file.h" diff --git a/webkit/fileapi/sandbox_mount_point_provider.cc b/webkit/fileapi/sandbox_mount_point_provider.cc index 6a0667de..e022c05 100644 --- a/webkit/fileapi/sandbox_mount_point_provider.cc +++ b/webkit/fileapi/sandbox_mount_point_provider.cc @@ -7,7 +7,6 @@ #include "base/bind.h" #include "base/command_line.h" #include "base/logging.h" -#include "base/memory/scoped_callback_factory.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop.h" #include "base/message_loop_proxy.h" diff --git a/webkit/plugins/ppapi/ppb_video_capture_impl.h b/webkit/plugins/ppapi/ppb_video_capture_impl.h index 64c43e8..7486e17 100644 --- a/webkit/plugins/ppapi/ppb_video_capture_impl.h +++ b/webkit/plugins/ppapi/ppb_video_capture_impl.h @@ -9,7 +9,6 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" -#include "base/memory/scoped_callback_factory.h" #include "base/memory/scoped_ptr.h" #include "media/video/capture/video_capture.h" #include "ppapi/c/dev/ppp_video_capture_dev.h" diff --git a/webkit/plugins/ppapi/ppb_video_decoder_impl.h b/webkit/plugins/ppapi/ppb_video_decoder_impl.h index 47a9af4..2da3fe6 100644 --- a/webkit/plugins/ppapi/ppb_video_decoder_impl.h +++ b/webkit/plugins/ppapi/ppb_video_decoder_impl.h @@ -9,7 +9,6 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" -#include "base/memory/scoped_callback_factory.h" #include "base/memory/scoped_ptr.h" #include "ppapi/c/dev/pp_video_dev.h" #include "ppapi/c/pp_var.h" diff --git a/webkit/plugins/ppapi/quota_file_io.cc b/webkit/plugins/ppapi/quota_file_io.cc index a8ae4d2..f8fc9dc 100644 --- a/webkit/plugins/ppapi/quota_file_io.cc +++ b/webkit/plugins/ppapi/quota_file_io.cc @@ -7,7 +7,6 @@ #include <algorithm> #include "base/bind.h" -#include "base/memory/scoped_callback_factory.h" #include "base/memory/weak_ptr.h" #include "base/message_loop_proxy.h" #include "base/stl_util.h" diff --git a/webkit/tools/test_shell/simple_file_system.cc b/webkit/tools/test_shell/simple_file_system.cc index bc6ff50..ef67a13 100644 --- a/webkit/tools/test_shell/simple_file_system.cc +++ b/webkit/tools/test_shell/simple_file_system.cc @@ -5,7 +5,6 @@ #include "webkit/tools/test_shell/simple_file_system.h" #include "base/file_path.h" -#include "base/memory/scoped_callback_factory.h" #include "base/message_loop.h" #include "base/message_loop_proxy.h" #include "base/time.h" |