| Index: webkit/quota/quota_temporary_storage_evictor.cc
|
| diff --git a/webkit/quota/quota_temporary_storage_evictor.cc b/webkit/quota/quota_temporary_storage_evictor.cc
|
| index 49229c3cef1349c5e98ce9cad3d38833e1b6bd63..728ad588dc66a1b4c0b575a766b1a81f7cf2864e 100644
|
| --- a/webkit/quota/quota_temporary_storage_evictor.cc
|
| +++ b/webkit/quota/quota_temporary_storage_evictor.cc
|
| @@ -4,6 +4,9 @@
|
|
|
| #include "webkit/quota/quota_temporary_storage_evictor.h"
|
|
|
| +#include <algorithm>
|
| +
|
| +#include "base/bind.h"
|
| #include "base/metrics/histogram.h"
|
| #include "googleurl/src/gurl.h"
|
| #include "webkit/quota/quota_manager.h"
|
| @@ -41,7 +44,7 @@ QuotaTemporaryStorageEvictor::QuotaTemporaryStorageEvictor(
|
| quota_eviction_handler_(quota_eviction_handler),
|
| interval_ms_(interval_ms),
|
| repeated_eviction_(true),
|
| - callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
|
| + weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
|
| DCHECK(quota_eviction_handler);
|
| }
|
|
|
| @@ -143,9 +146,9 @@ void QuotaTemporaryStorageEvictor::ConsiderEviction() {
|
| OnEvictionRoundStarted();
|
|
|
| // Get usage and disk space, then continue.
|
| - quota_eviction_handler_->GetUsageAndQuotaForEviction(callback_factory_.
|
| - NewCallback(
|
| - &QuotaTemporaryStorageEvictor::OnGotUsageAndQuotaForEviction));
|
| + quota_eviction_handler_->GetUsageAndQuotaForEviction(
|
| + base::Bind(&QuotaTemporaryStorageEvictor::OnGotUsageAndQuotaForEviction,
|
| + weak_factory_.GetWeakPtr()));
|
| }
|
|
|
| void QuotaTemporaryStorageEvictor::OnGotUsageAndQuotaForEviction(
|
| @@ -184,8 +187,8 @@ void QuotaTemporaryStorageEvictor::OnGotUsageAndQuotaForEviction(
|
| // TODO(michaeln): if the reason for eviction is low physical disk space,
|
| // make 'unlimited' origins subject to eviction too.
|
| quota_eviction_handler_->GetLRUOrigin(kStorageTypeTemporary,
|
| - callback_factory_.NewCallback(
|
| - &QuotaTemporaryStorageEvictor::OnGotLRUOrigin));
|
| + base::Bind(&QuotaTemporaryStorageEvictor::OnGotLRUOrigin,
|
| + weak_factory_.GetWeakPtr()));
|
| } else {
|
| if (repeated_eviction_) {
|
| // No action required, sleep for a while and check again later.
|
| @@ -215,8 +218,9 @@ void QuotaTemporaryStorageEvictor::OnGotLRUOrigin(const GURL& origin) {
|
| }
|
|
|
| quota_eviction_handler_->EvictOriginData(origin, kStorageTypeTemporary,
|
| - callback_factory_.NewCallback(
|
| - &QuotaTemporaryStorageEvictor::OnEvictionComplete));
|
| + base::Bind(
|
| + &QuotaTemporaryStorageEvictor::OnEvictionComplete,
|
| + weak_factory_.GetWeakPtr()));
|
| }
|
|
|
| void QuotaTemporaryStorageEvictor::OnEvictionComplete(
|
|
|