| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef STORAGE_BROWSER_QUOTA_QUOTA_TEMPORARY_STORAGE_EVICTOR_H_ | 5 #ifndef STORAGE_BROWSER_QUOTA_QUOTA_TEMPORARY_STORAGE_EVICTOR_H_ |
| 6 #define STORAGE_BROWSER_QUOTA_QUOTA_TEMPORARY_STORAGE_EVICTOR_H_ | 6 #define STORAGE_BROWSER_QUOTA_QUOTA_TEMPORARY_STORAGE_EVICTOR_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/threading/non_thread_safe.h" | 16 #include "base/threading/non_thread_safe.h" |
| 17 #include "base/timer/timer.h" | 17 #include "base/timer/timer.h" |
| 18 #include "storage/browser/storage_browser_export.h" | 18 #include "storage/browser/storage_browser_export.h" |
| 19 #include "storage/common/quota/quota_types.h" | 19 #include "storage/common/quota/quota_types.h" |
| 20 | 20 |
| 21 class GURL; | 21 class GURL; |
| 22 | 22 |
| 23 namespace content { | 23 namespace content { |
| 24 class QuotaTemporaryStorageEvictorTest; | 24 class QuotaTemporaryStorageEvictorTest; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace storage { | 27 namespace storage { |
| 28 | 28 |
| 29 class QuotaEvictionHandler; | 29 class QuotaEvictionHandler; |
| 30 struct UsageAndQuota; | 30 struct XUsageAndQuota; |
| 31 | 31 |
| 32 class STORAGE_EXPORT QuotaTemporaryStorageEvictor : public base::NonThreadSafe { | 32 class STORAGE_EXPORT QuotaTemporaryStorageEvictor : public base::NonThreadSafe { |
| 33 public: | 33 public: |
| 34 struct Statistics { | 34 struct Statistics { |
| 35 Statistics() | 35 Statistics() |
| 36 : num_errors_on_evicting_origin(0), | 36 : num_errors_on_evicting_origin(0), |
| 37 num_errors_on_getting_usage_and_quota(0), | 37 num_errors_on_getting_usage_and_quota(0), |
| 38 num_evicted_origins(0), | 38 num_evicted_origins(0), |
| 39 num_eviction_rounds(0), | 39 num_eviction_rounds(0), |
| 40 num_skipped_eviction_rounds(0) {} | 40 num_skipped_eviction_rounds(0) {} |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 friend class content::QuotaTemporaryStorageEvictorTest; | 90 friend class content::QuotaTemporaryStorageEvictorTest; |
| 91 | 91 |
| 92 void StartEvictionTimerWithDelay(int delay_ms); | 92 void StartEvictionTimerWithDelay(int delay_ms); |
| 93 void ConsiderEviction(); | 93 void ConsiderEviction(); |
| 94 void OnGotVolumeInfo(bool success, | 94 void OnGotVolumeInfo(bool success, |
| 95 uint64_t available_space, | 95 uint64_t available_space, |
| 96 uint64_t total_size); | 96 uint64_t total_size); |
| 97 void OnGotUsageAndQuotaForEviction( | 97 void OnGotUsageAndQuotaForEviction( |
| 98 int64_t must_remain_available_space, | 98 int64_t must_remain_available_space, |
| 99 QuotaStatusCode status, | 99 QuotaStatusCode status, |
| 100 const UsageAndQuota& quota_and_usage); | 100 const XUsageAndQuota& quota_and_usage); |
| 101 void OnGotEvictionOrigin(const GURL& origin); | 101 void OnGotEvictionOrigin(const GURL& origin); |
| 102 void OnEvictionComplete(QuotaStatusCode status); | 102 void OnEvictionComplete(QuotaStatusCode status); |
| 103 | 103 |
| 104 void OnEvictionRoundStarted(); | 104 void OnEvictionRoundStarted(); |
| 105 void OnEvictionRoundFinished(); | 105 void OnEvictionRoundFinished(); |
| 106 | 106 |
| 107 // This is only used for tests. | 107 // This is only used for tests. |
| 108 void set_repeated_eviction(bool repeated_eviction) { | 108 void set_repeated_eviction(bool repeated_eviction) { |
| 109 repeated_eviction_ = repeated_eviction; | 109 repeated_eviction_ = repeated_eviction; |
| 110 } | 110 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 129 base::OneShotTimer eviction_timer_; | 129 base::OneShotTimer eviction_timer_; |
| 130 base::RepeatingTimer histogram_timer_; | 130 base::RepeatingTimer histogram_timer_; |
| 131 base::WeakPtrFactory<QuotaTemporaryStorageEvictor> weak_factory_; | 131 base::WeakPtrFactory<QuotaTemporaryStorageEvictor> weak_factory_; |
| 132 | 132 |
| 133 DISALLOW_COPY_AND_ASSIGN(QuotaTemporaryStorageEvictor); | 133 DISALLOW_COPY_AND_ASSIGN(QuotaTemporaryStorageEvictor); |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 } // namespace storage | 136 } // namespace storage |
| 137 | 137 |
| 138 #endif // STORAGE_BROWSER_QUOTA_QUOTA_TEMPORARY_STORAGE_EVICTOR_H_ | 138 #endif // STORAGE_BROWSER_QUOTA_QUOTA_TEMPORARY_STORAGE_EVICTOR_H_ |
| OLD | NEW |