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

Side by Side Diff: webkit/quota/quota_temporary_storage_evictor.h

Issue 7002024: Implement QuotaTemporaryStorageEvictor. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Reflected the comments. Created 9 years, 7 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
« no previous file with comments | « webkit/quota/quota_manager.h ('k') | webkit/quota/quota_temporary_storage_evictor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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/memory/scoped_callback_factory.h"
10 #include "base/timer.h"
11 #include "webkit/quota/quota_types.h"
12
13 class GURL;
14
15 namespace base {
16 class MessageLoopProxy;
17 }
18
19 namespace quota {
20
21 class QuotaEvictionHandler;
22
23 class QuotaTemporaryStorageEvictor {
24 public:
25 QuotaTemporaryStorageEvictor(
26 QuotaEvictionHandler* quota_eviction_handler,
27 int64 interval_ms,
28 scoped_refptr<base::MessageLoopProxy> io_thread);
29 virtual ~QuotaTemporaryStorageEvictor();
30
31 void Start();
32
33 bool repeated_eviction() const { return repeated_eviction_; }
34 void set_repeated_eviction(bool repeated_eviction) {
35 repeated_eviction_ = repeated_eviction;
36 }
37
38 private:
39 friend class QuotaTemporaryStorageEvictorTest;
40
41 void StartEvictionTimerWithDelay(int delay_ms);
42 void ConsiderEviction();
43 void OnGotUsageAndQuotaForEviction(
44 QuotaStatusCode status,
45 int64 usage,
46 int64 quota,
47 int64 available_disk_space);
48 void OnGotLRUOrigin(const GURL& origin);
49 void OnEvictionComplete(QuotaStatusCode status);
50
51 static const double kUsageRatioToStartEviction;
52 static const int64 kDefaultMinAvailableDiskSpaceToStartEviction;
53
54 const int64 min_available_disk_space_to_start_eviction_;
55
56 // Not owned; quota_eviction_handler owns us.
57 QuotaEvictionHandler* quota_eviction_handler_;
58
59 int64 interval_ms_;
60 bool repeated_eviction_;
61 scoped_refptr<base::MessageLoopProxy> io_thread_;
62
63 base::OneShotTimer<QuotaTemporaryStorageEvictor> timer_;
64
65 base::ScopedCallbackFactory<QuotaTemporaryStorageEvictor> callback_factory_;
66
67 DISALLOW_COPY_AND_ASSIGN(QuotaTemporaryStorageEvictor);
68 };
69
70 } // namespace quota
71
72 #endif // WEBKIT_QUOTA_QUOTA_TEMPORARY_STORAGE_EVICTOR_H_
OLDNEW
« no previous file with comments | « webkit/quota/quota_manager.h ('k') | webkit/quota/quota_temporary_storage_evictor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698