Chromium Code Reviews| Index: webkit/quota/quota_types.h |
| diff --git a/webkit/quota/quota_types.h b/webkit/quota/quota_types.h |
| index 5e12536ef58010dc508d46fa33328b00d7fc6b14..6b421d39a3b851574210dcdb4a0a722c20900f3c 100644 |
| --- a/webkit/quota/quota_types.h |
| +++ b/webkit/quota/quota_types.h |
| @@ -12,8 +12,7 @@ |
| #include <string> |
| #include "base/basictypes.h" |
| -#include "base/callback_old.h" |
| -#include "base/stl_util.h" |
| +#include "base/callback.h" |
| class GURL; |
| @@ -37,22 +36,20 @@ enum QuotaStatusCode { |
| }; |
| // Common callback types that are used throughout in the quota module. |
| -typedef Callback2<StorageType, int64>::Type UsageCallback; |
| -typedef Callback3<StorageType, int64, int64>::Type GlobalUsageCallback; |
| -typedef Callback3<QuotaStatusCode, |
| - StorageType, |
| - int64>::Type QuotaCallback; |
| -typedef Callback3<const std::string& /* host */, |
| - StorageType, |
| - int64>::Type HostUsageCallback; |
| -typedef Callback4<QuotaStatusCode, |
| - const std::string& /* host */, |
| - StorageType, |
| - int64>::Type HostQuotaCallback; |
| -typedef Callback2<QuotaStatusCode, |
| - int64>::Type AvailableSpaceCallback; |
| -typedef Callback1<QuotaStatusCode>::Type StatusCallback; |
| -typedef Callback2<const std::set<GURL>&, StorageType>::Type GetOriginsCallback; |
| +typedef base::Callback<void (StorageType, int64)> UsageCallback; |
|
awong
2011/09/29 18:05:15
remove space after void.
tzik
2011/10/11 04:53:57
Done.
|
| +typedef base::Callback<void (StorageType, int64, int64)> GlobalUsageCallback; |
| +typedef base::Callback<void (QuotaStatusCode, StorageType, int64)> |
| + QuotaCallback; |
| +typedef base::Callback<void (const std::string&, StorageType, int64)> |
| + HostUsageCallback; |
| +typedef base::Callback<void (QuotaStatusCode, |
| + const std::string&, |
| + StorageType, |
| + int64)> HostQuotaCallback; |
| +typedef base::Callback<void (QuotaStatusCode, int64)> AvailableSpaceCallback; |
| +typedef base::Callback<void (QuotaStatusCode)> StatusCallback; |
| +typedef base::Callback<void (const std::set<GURL>&, StorageType)> |
| + GetOriginsCallback; |
| // Simple template wrapper for a callback queue. |
| template <typename CallbackType> |
| @@ -61,9 +58,7 @@ class CallbackQueueBase { |
| typedef typename std::deque<CallbackType> Queue; |
| typedef typename Queue::iterator iterator; |
| - virtual ~CallbackQueueBase() { |
| - STLDeleteContainerPointers(callbacks_.begin(), callbacks_.end()); |
| - } |
| + virtual ~CallbackQueueBase() {} |
| // Returns true if the given |callback| is the first one added to the queue. |
| bool Add(CallbackType callback) { |
| @@ -88,8 +83,7 @@ class CallbackQueue1 : public CallbackQueueBase<CallbackType1> { |
| // Note: template-derived class needs 'this->' to access its base class. |
| for (typename Queue::iterator iter = this->callbacks_.begin(); |
| iter != this->callbacks_.end(); ++iter) { |
| - (*iter)->Run(arg); |
| - delete *iter; |
| + iter->Run(arg); |
| } |
| this->callbacks_.clear(); |
| } |
| @@ -103,8 +97,7 @@ class CallbackQueue2 : public CallbackQueueBase<CallbackType2> { |
| void Run(A1 arg1, A2 arg2) { |
| for (typename Queue::iterator iter = this->callbacks_.begin(); |
| iter != this->callbacks_.end(); ++iter) { |
| - (*iter)->Run(arg1, arg2); |
| - delete *iter; |
| + iter->Run(arg1, arg2); |
| } |
| this->callbacks_.clear(); |
| } |
| @@ -118,8 +111,7 @@ class CallbackQueue3 : public CallbackQueueBase<CallbackType3> { |
| void Run(A1 arg1, A2 arg2, A3 arg3) { |
| for (typename Queue::iterator iter = this->callbacks_.begin(); |
| iter != this->callbacks_.end(); ++iter) { |
| - (*iter)->Run(arg1, arg2, arg3); |
| - delete *iter; |
| + iter->Run(arg1, arg2, arg3); |
| } |
| this->callbacks_.clear(); |
| } |
| @@ -134,18 +126,17 @@ class CallbackQueue4 : public CallbackQueueBase<CallbackType4> { |
| void Run(A1 arg1, A2 arg2, A3 arg3, A4 arg4) { |
| for (typename Queue::iterator iter = this->callbacks_.begin(); |
| iter != this->callbacks_.end(); ++iter) { |
| - (*iter)->Run(arg1, arg2, arg3, arg4); |
| - delete *iter; |
| + iter->Run(arg1, arg2, arg3, arg4); |
| } |
| this->callbacks_.clear(); |
| } |
| }; |
| -typedef CallbackQueue2<UsageCallback*, |
| +typedef CallbackQueue2<UsageCallback, |
| StorageType, int64> UsageCallbackQueue; |
| -typedef CallbackQueue3<GlobalUsageCallback*, |
| +typedef CallbackQueue3<GlobalUsageCallback, |
| StorageType, int64, int64> GlobalUsageCallbackQueue; |
| -typedef CallbackQueue3<QuotaCallback*, |
| +typedef CallbackQueue3<QuotaCallback, |
| QuotaStatusCode, |
| StorageType, int64> QuotaCallbackQueue; |
| @@ -272,10 +263,10 @@ class CallbackQueueMap4 |
| } |
| }; |
| -typedef CallbackQueueMap3<HostUsageCallback*, std::string, |
| +typedef CallbackQueueMap3<HostUsageCallback, std::string, |
| const std::string&, |
| StorageType, int64> HostUsageCallbackMap; |
| -typedef CallbackQueueMap4<HostQuotaCallback*, std::string, |
| +typedef CallbackQueueMap4<HostQuotaCallback, std::string, |
| QuotaStatusCode, |
| const std::string&, |
| StorageType, int64> HostQuotaCallbackMap; |