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

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

Issue 1782053004: Change how the quota system computes the total poolsize for temporary storage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 1 month 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
OLDNEW
(Empty)
1 // Copyright 2016 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 STORAGE_BROWSER_QUOTA_QUOTA_SETTINGS_H_
6 #define STORAGE_BROWSER_QUOTA_QUOTA_SETTINGS_H_
7
8 #include <stdint.h>
9
10 #include "base/callback.h"
11 #include "base/files/file_path.h"
12 #include "base/optional.h"
13 #include "base/time/time.h"
14 #include "storage/browser/storage_browser_export.h"
15
16 namespace storage {
17
18 // Settings the storage lib embedder must provide to the QuotaManager.
19 struct QuotaSettings {
20 QuotaSettings() = default;
21 QuotaSettings(int64_t pool_size,
22 int64_t per_host_quota,
23 int64_t must_remain_available)
24 : pool_size(pool_size),
25 per_host_quota(per_host_quota),
26 must_remain_available(must_remain_available) {}
27
28 // The target size in bytes of the shared pool of disk space the quota
29 // system allows for use by by websites using HTML5 storage apis, for
30 // example an embedder may use 50% of the total volume size.
31 int64_t pool_size = 0;
32
33 // The amount in bytes of the pool an individual site may consume. The
34 // value must be less than or equal to the pool_size.
35 int64_t per_host_quota = 0;
36
37 // The amount of space that must remain available on the storage
38 // volume. As the volume approaches this limit, the quota system gets
39 // more aggressive about evicting data and disallowing new data.
40 int64_t must_remain_available = 0;
41
42 // The quota system querries the embedder for the QuataSettings,
43 // but will rate limit the frequency of the querries to no more than once
44 // per refresh interval.
45 base::TimeDelta refresh_interval = base::TimeDelta::Max();
46 };
47
48 // Function type used to return the settings in response to a
49 // GetQuotaSettingsFunc invocation. If the embedder cannot
50 // produce a settings values, base::nullopt can be returned.
51 using OptionalQuotaSettingsCallback =
52 base::Callback<void(base::Optional<QuotaSettings>)>;
53
54 // Function type used to query the embedder about the quota manager settings.
55 // This function is invoked on the UI thread.
56 using GetQuotaSettingsFunc =
57 base::Callback<void(const base::FilePath& partition_path,
58 bool is_incognito,
59 const OptionalQuotaSettingsCallback& callback)>;
60
61 STORAGE_EXPORT
kinuko 2016/11/10 17:49:22 Could we have a comment for this function?
michaeln 2016/11/11 02:31:53 Done.
62 base::Optional<storage::QuotaSettings> CalculateNominalDynamicSettings(
63 const base::FilePath& partition_path,
64 bool is_incognito);
65
66 inline QuotaSettings GetNoQuotaSettings() {
67 return QuotaSettings();
68 }
69
70 inline QuotaSettings GetHardCodedSettings(int64_t per_host_quota) {
kinuko 2016/11/10 17:49:22 Would be nice to have a short, one-line comment fo
michaeln 2016/11/11 02:31:53 Done.
71 return QuotaSettings(per_host_quota * 5, per_host_quota, per_host_quota);
72 }
73
74 } // namespace storage
75
76 #endif // STORAGE_BROWSER_QUOTA_QUOTA_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698