OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef WEBKIT_QUOTA_QUOTA_TEMPORARY_STORAGE_EVICTOR_H_ | |
6 #define WEBKIT_QUOTA_QUOTA_TEMPORARY_STORAGE_EVICTOR_H_ | |
7 #pragma once | |
8 | |
9 #include "base/message_loop_proxy.h" | |
10 #include "base/memory/scoped_callback_factory.h" | |
11 #include "base/timer.h" | |
12 #include "webkit/quota/quota_manager.h" | |
13 #include "webkit/quota/quota_types.h" | |
14 | |
15 class GURL; | |
16 | |
17 namespace quota { | |
18 | |
19 class QuotaTemporaryStorageEvictor { | |
20 public: | |
21 QuotaTemporaryStorageEvictor( | |
22 QuotaEvictionHandler* quota_eviction_handler, | |
23 int64 interval_ms, | |
24 scoped_refptr<base::MessageLoopProxy> io_thread); | |
25 virtual ~QuotaTemporaryStorageEvictor(); | |
26 | |
27 void Start(); | |
28 | |
29 bool repeated_eviction() const { return repeated_eviction_; } | |
30 void set_repeated_eviction(bool repeated_eviction) { | |
31 repeated_eviction_ = repeated_eviction; | |
32 } | |
33 | |
34 private: | |
35 friend struct QuotaTemporaryStorageEvictorDeleter; | |
36 friend class QuotaTemporaryStorageEvictorTest; | |
37 | |
38 void StartEvictionTimerWithDelay(int delay_ms); | |
39 void ConsiderEviction(); | |
40 void OnGotUsageAndQuotaForEviction( | |
41 QuotaStatusCode status, | |
42 int64 usage, | |
43 int64 quota, | |
44 int64 available_disk_space); | |
45 void OnGotLRUOrigin(const GURL& origin); | |
46 void OnEvictionComplete(QuotaStatusCode status); | |
kinuko
2011/05/24 09:20:53
The method names look better/clearer now!
Dai Mikurube (NOT FULLTIME)
2011/05/24 11:30:52
Thanks :)
| |
47 | |
48 static const double kUsageRatioToStartEviction; | |
49 static const int64 kDefaultMinAvailableDiskSpaceToStartEviction; | |
50 | |
51 const int64 min_available_disk_space_to_start_eviction_; | |
52 | |
53 // Not owned; quota_eviction_handler owns us. | |
54 QuotaEvictionHandler* quota_eviction_handler_; | |
55 | |
56 int64 interval_ms_; | |
57 bool repeated_eviction_; | |
58 scoped_refptr<base::MessageLoopProxy> io_thread_; | |
59 | |
60 base::OneShotTimer<QuotaTemporaryStorageEvictor> timer_; | |
61 | |
62 base::ScopedCallbackFactory<QuotaTemporaryStorageEvictor> callback_factory_; | |
63 | |
64 DISALLOW_COPY_AND_ASSIGN(QuotaTemporaryStorageEvictor); | |
65 }; | |
66 | |
67 } // namespace quota | |
68 | |
69 #endif // WEBKIT_QUOTA_QUOTA_TEMPORARY_STORAGE_EVICTOR_H_ | |
OLD | NEW |