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_; } | |
michaeln
2011/05/23 19:53:47
I understand what Start() means, but what does rep
Dai Mikurube (NOT FULLTIME)
2011/05/24 05:59:04
The Evictor is expected to run repeatedly by itsel
| |
30 void set_repeated_eviction(bool repeated_eviction) { | |
31 repeated_eviction_ = repeated_eviction; | |
32 } | |
33 | |
34 static const double kUsageRatioToStartEviction; | |
35 static const int64 kDefaultMinAvailableDiskSpaceToStartEviction; | |
36 const int64 min_available_disk_space_to_start_eviction_; | |
michaeln
2011/05/23 19:53:47
Do these belong in the public interface?
Dai Mikurube (NOT FULLTIME)
2011/05/24 05:59:04
Ah, exactly. Moved them to private.
| |
37 | |
38 private: | |
39 friend struct QuotaTemporaryStorageEvictorDeleter; | |
40 friend class QuotaTemporaryStorageEvictorTest; | |
41 | |
42 void MayStartEviction(int interval_ms); | |
43 void GetUsageAndQuotaThenEvict(); | |
44 void EvictIfRequired( | |
45 QuotaStatusCode status, | |
46 int64 usage, | |
47 int64 quota, | |
48 int64 available_disk_space); | |
49 void DoEvict(const GURL& origin); | |
50 void OnEvictionCompleted(QuotaStatusCode status); | |
michaeln
2011/05/23 19:53:47
I found these method names to be difficult to foll
Dai Mikurube (NOT FULLTIME)
2011/05/24 05:59:04
Thank you for the suggestion. I chose your method
| |
51 | |
52 // Not owned; quota_eviction_handler owns us. | |
53 QuotaEvictionHandler* quota_eviction_handler_; | |
54 | |
55 int64 interval_ms_; | |
56 bool repeated_eviction_; | |
57 scoped_refptr<base::MessageLoopProxy> io_thread_; | |
58 | |
59 base::OneShotTimer<QuotaTemporaryStorageEvictor> timer_; | |
60 | |
61 base::ScopedCallbackFactory<QuotaTemporaryStorageEvictor> callback_factory_; | |
62 | |
63 DISALLOW_COPY_AND_ASSIGN(QuotaTemporaryStorageEvictor); | |
64 }; | |
65 | |
66 } // namespace quota | |
67 | |
68 #endif // WEBKIT_QUOTA_QUOTA_TEMPORARY_STORAGE_EVICTOR_H_ | |
OLD | NEW |