Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Side by Side Diff: storage/browser/quota/quota_temporary_storage_evictor.h

Issue 442383002: Move storage-related files from webkit/ to new top-level directory storage/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 WEBKIT_BROWSER_QUOTA_QUOTA_TEMPORARY_STORAGE_EVICTOR_H_ 5 #ifndef WEBKIT_BROWSER_QUOTA_QUOTA_TEMPORARY_STORAGE_EVICTOR_H_
6 #define WEBKIT_BROWSER_QUOTA_QUOTA_TEMPORARY_STORAGE_EVICTOR_H_ 6 #define WEBKIT_BROWSER_QUOTA_QUOTA_TEMPORARY_STORAGE_EVICTOR_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/threading/non_thread_safe.h" 12 #include "base/threading/non_thread_safe.h"
13 #include "base/timer/timer.h" 13 #include "base/timer/timer.h"
14 #include "webkit/browser/webkit_storage_browser_export.h" 14 #include "storage/common/storage_export.h"
15 #include "webkit/common/quota/quota_types.h" 15 #include "storage/common/quota/quota_types.h"
16 16
17 class GURL; 17 class GURL;
18 18
19 namespace content { 19 namespace content {
20 class QuotaTemporaryStorageEvictorTest; 20 class QuotaTemporaryStorageEvictorTest;
21 } 21 }
22 22
23 namespace quota { 23 namespace quota {
24 24
25 class QuotaEvictionHandler; 25 class QuotaEvictionHandler;
26 struct UsageAndQuota; 26 struct UsageAndQuota;
27 27
28 class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE QuotaTemporaryStorageEvictor 28 class STORAGE_EXPORT_PRIVATE QuotaTemporaryStorageEvictor
29 : public base::NonThreadSafe { 29 : public base::NonThreadSafe {
30 public: 30 public:
31 struct Statistics { 31 struct Statistics {
32 Statistics() 32 Statistics()
33 : num_errors_on_evicting_origin(0), 33 : num_errors_on_evicting_origin(0),
34 num_errors_on_getting_usage_and_quota(0), 34 num_errors_on_getting_usage_and_quota(0),
35 num_evicted_origins(0), 35 num_evicted_origins(0),
36 num_eviction_rounds(0), 36 num_eviction_rounds(0),
37 num_skipped_eviction_rounds(0) {} 37 num_skipped_eviction_rounds(0) {}
38 int64 num_errors_on_evicting_origin; 38 int64 num_errors_on_evicting_origin;
(...skipping 20 matching lines...) Expand all
59 59
60 base::Time start_time; 60 base::Time start_time;
61 int64 usage_overage_at_round; 61 int64 usage_overage_at_round;
62 int64 diskspace_shortage_at_round; 62 int64 diskspace_shortage_at_round;
63 63
64 int64 usage_on_beginning_of_round; 64 int64 usage_on_beginning_of_round;
65 int64 usage_on_end_of_round; 65 int64 usage_on_end_of_round;
66 int64 num_evicted_origins_in_round; 66 int64 num_evicted_origins_in_round;
67 }; 67 };
68 68
69 QuotaTemporaryStorageEvictor( 69 QuotaTemporaryStorageEvictor(QuotaEvictionHandler* quota_eviction_handler,
70 QuotaEvictionHandler* quota_eviction_handler, 70 int64 interval_ms);
71 int64 interval_ms);
72 virtual ~QuotaTemporaryStorageEvictor(); 71 virtual ~QuotaTemporaryStorageEvictor();
73 72
74 void GetStatistics(std::map<std::string, int64>* statistics); 73 void GetStatistics(std::map<std::string, int64>* statistics);
75 void ReportPerRoundHistogram(); 74 void ReportPerRoundHistogram();
76 void ReportPerHourHistogram(); 75 void ReportPerHourHistogram();
77 void Start(); 76 void Start();
78 77
79 int64 min_available_disk_space_to_start_eviction() { 78 int64 min_available_disk_space_to_start_eviction() {
80 return min_available_disk_space_to_start_eviction_; 79 return min_available_disk_space_to_start_eviction_;
81 } 80 }
82 void reset_min_available_disk_space_to_start_eviction() { 81 void reset_min_available_disk_space_to_start_eviction() {
83 min_available_disk_space_to_start_eviction_ = 82 min_available_disk_space_to_start_eviction_ =
84 kMinAvailableDiskSpaceToStartEvictionNotSpecified; 83 kMinAvailableDiskSpaceToStartEvictionNotSpecified;
85 } 84 }
86 void set_min_available_disk_space_to_start_eviction(int64 value) { 85 void set_min_available_disk_space_to_start_eviction(int64 value) {
87 min_available_disk_space_to_start_eviction_ = value; 86 min_available_disk_space_to_start_eviction_ = value;
88 } 87 }
89 88
90 private: 89 private:
91 friend class content::QuotaTemporaryStorageEvictorTest; 90 friend class content::QuotaTemporaryStorageEvictorTest;
92 91
93 void StartEvictionTimerWithDelay(int delay_ms); 92 void StartEvictionTimerWithDelay(int delay_ms);
94 void ConsiderEviction(); 93 void ConsiderEviction();
95 void OnGotUsageAndQuotaForEviction( 94 void OnGotUsageAndQuotaForEviction(QuotaStatusCode status,
96 QuotaStatusCode status, 95 const UsageAndQuota& quota_and_usage);
97 const UsageAndQuota& quota_and_usage);
98 void OnGotLRUOrigin(const GURL& origin); 96 void OnGotLRUOrigin(const GURL& origin);
99 void OnEvictionComplete(QuotaStatusCode status); 97 void OnEvictionComplete(QuotaStatusCode status);
100 98
101 void OnEvictionRoundStarted(); 99 void OnEvictionRoundStarted();
102 void OnEvictionRoundFinished(); 100 void OnEvictionRoundFinished();
103 101
104 // This is only used for tests. 102 // This is only used for tests.
105 void set_repeated_eviction(bool repeated_eviction) { 103 void set_repeated_eviction(bool repeated_eviction) {
106 repeated_eviction_ = repeated_eviction; 104 repeated_eviction_ = repeated_eviction;
107 } 105 }
(...skipping 17 matching lines...) Expand all
125 base::OneShotTimer<QuotaTemporaryStorageEvictor> eviction_timer_; 123 base::OneShotTimer<QuotaTemporaryStorageEvictor> eviction_timer_;
126 base::RepeatingTimer<QuotaTemporaryStorageEvictor> histogram_timer_; 124 base::RepeatingTimer<QuotaTemporaryStorageEvictor> histogram_timer_;
127 base::WeakPtrFactory<QuotaTemporaryStorageEvictor> weak_factory_; 125 base::WeakPtrFactory<QuotaTemporaryStorageEvictor> weak_factory_;
128 126
129 DISALLOW_COPY_AND_ASSIGN(QuotaTemporaryStorageEvictor); 127 DISALLOW_COPY_AND_ASSIGN(QuotaTemporaryStorageEvictor);
130 }; 128 };
131 129
132 } // namespace quota 130 } // namespace quota
133 131
134 #endif // WEBKIT_BROWSER_QUOTA_QUOTA_TEMPORARY_STORAGE_EVICTOR_H_ 132 #endif // WEBKIT_BROWSER_QUOTA_QUOTA_TEMPORARY_STORAGE_EVICTOR_H_
OLDNEW
« no previous file with comments | « storage/browser/quota/quota_task.cc ('k') | storage/browser/quota/quota_temporary_storage_evictor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698