Chromium Code Reviews| Index: webkit/quota/quota_temporary_storage_evictor.h |
| diff --git a/webkit/quota/quota_temporary_storage_evictor.h b/webkit/quota/quota_temporary_storage_evictor.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..81a4314de3d818b286093b427c2cfaf415d7d978 |
| --- /dev/null |
| +++ b/webkit/quota/quota_temporary_storage_evictor.h |
| @@ -0,0 +1,66 @@ |
| +// 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 WEBKIT_QUOTA_QUOTA_TEMPORARY_STORAGE_EVICTOR_H_ |
| +#define WEBKIT_QUOTA_QUOTA_TEMPORARY_STORAGE_EVICTOR_H_ |
| +#pragma once |
| + |
| +#include "base/message_loop_proxy.h" |
| +#include "base/memory/scoped_callback_factory.h" |
| +#include "base/timer.h" |
| +#include "webkit/quota/quota_manager.h" |
| +#include "webkit/quota/quota_types.h" |
| + |
| +class GURL; |
| + |
| +namespace quota { |
| + |
| +class QuotaTemporaryStorageEvictor { |
| + public: |
| + QuotaTemporaryStorageEvictor( |
| + QuotaEvictionHandler* quota_eviction_handler, |
| + int64 interval_ms, |
| + scoped_refptr<base::MessageLoopProxy> io_thread); |
| + virtual ~QuotaTemporaryStorageEvictor(); |
| + |
| + void Start(); |
| + |
| + bool repeated_eviction() const { return repeated_eviction_; } |
| + void set_repeated_eviction(bool repeated_eviction) { |
| + repeated_eviction_ = repeated_eviction; |
| + } |
| + |
| + static const double kUsageRatioToStartEviction; |
| + const int64 kAvailableDiskSpaceToStartEviction; |
|
kinuko
2011/05/20 06:41:14
This is not static since you imagine we may give d
Dai Mikurube (NOT FULLTIME)
2011/05/20 07:36:54
Hmm, I guess I did two mistakes :
1. I read your p
kinuko
2011/05/20 08:27:02
Yeah the detailed rule is hidden in the expandable
Dai Mikurube (NOT FULLTIME)
2011/05/20 09:33:07
Ah, make sense. It was just a temporary value to
kinuko
2011/05/20 09:40:33
Will try!
|
| + |
| + private: |
| + friend struct QuotaTemporaryStorageEvictorDeleter; |
| + friend class QuotaTemporaryStorageEvictorTest; |
| + |
| + void MayStartEviction(int interval_ms); |
| + void GetUsageAndQuotaThenEvict(); |
| + void EvictIfRequired( |
| + QuotaStatusCode status, |
| + int64 usage, |
| + int64 quota, |
| + int64 physical_available_space); |
| + void DoEvict(const GURL& origin); |
| + void OnEvictionCompleted(QuotaStatusCode status); |
| + |
| + QuotaEvictionHandler* quota_eviction_handler_; |
|
kinuko
2011/05/20 06:41:14
Can we add a comment like "Not owned; eviction_han
Dai Mikurube (NOT FULLTIME)
2011/05/20 07:36:54
Done.
|
| + |
| + int64 interval_ms_; |
| + bool repeated_eviction_; |
| + scoped_refptr<base::MessageLoopProxy> io_thread_; |
| + |
| + base::OneShotTimer<QuotaTemporaryStorageEvictor> timer_; |
| + |
| + base::ScopedCallbackFactory<QuotaTemporaryStorageEvictor> callback_factory_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(QuotaTemporaryStorageEvictor); |
| +}; |
| + |
| +} // namespace quota |
| + |
| +#endif // WEBKIT_QUOTA_QUOTA_TEMPORARY_STORAGE_EVICTOR_H_ |