blob: 1d1e585cc41c377ab03d9ea9d898461d2c00ee20 [file] [log] [blame]
Torne (Richard Coles)868fa2f2013-06-11 10:57:03 +01001// Copyright (c) 2012 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_COMMON_DOM_STORAGE_DOM_STORAGE_TYPES_H_
6#define WEBKIT_COMMON_DOM_STORAGE_DOM_STORAGE_TYPES_H_
7
8#include <map>
9
10#include "base/basictypes.h"
Torne (Richard Coles)7d4cd472013-06-19 11:58:07 +010011#include "base/strings/nullable_string16.h"
Torne (Richard Coles)5e3f23d2013-06-11 16:24:11 +010012#include "base/strings/string16.h"
Ben Murdocheb525c52013-07-10 11:40:50 +010013#include "base/time/time.h"
14#include "url/gurl.h"
Torne (Richard Coles)7d4cd472013-06-19 11:58:07 +010015#include "webkit/common/webkit_storage_common_export.h"
Torne (Richard Coles)868fa2f2013-06-11 10:57:03 +010016
17namespace dom_storage {
18
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +010019// The quota for each storage area.
20// This value is enforced in renderer processes and the browser process.
21const size_t kPerAreaQuota = 10 * 1024 * 1024;
Torne (Richard Coles)868fa2f2013-06-11 10:57:03 +010022
23// In the browser process we allow some overage to
24// accomodate concurrent writes from different renderers
25// that were allowed because the limit imposed in the renderer
26// wasn't exceeded.
27const size_t kPerAreaOverQuotaAllowance = 100 * 1024;
28
29// Value to indicate the localstorage namespace vs non-zero
30// values for sessionstorage namespaces.
31const int64 kLocalStorageNamespaceId = 0;
32
33const int64 kInvalidSessionStorageNamespaceId = kLocalStorageNamespaceId;
34
35// Start purging memory if the number of in-memory areas exceeds this.
36const int64 kMaxInMemoryAreas = 100;
37
38// Value to indicate an area that not be opened.
39const int kInvalidAreaId = -1;
40
Torne (Richard Coles)7d4cd472013-06-19 11:58:07 +010041typedef std::map<base::string16, base::NullableString16> ValuesMap;
Torne (Richard Coles)868fa2f2013-06-11 10:57:03 +010042
Torne (Richard Coles)7d4cd472013-06-19 11:58:07 +010043struct WEBKIT_STORAGE_COMMON_EXPORT LocalStorageUsageInfo {
Torne (Richard Coles)868fa2f2013-06-11 10:57:03 +010044 GURL origin;
45 size_t data_size;
46 base::Time last_modified;
47
48 LocalStorageUsageInfo();
49 ~LocalStorageUsageInfo();
50};
51
Torne (Richard Coles)7d4cd472013-06-19 11:58:07 +010052struct WEBKIT_STORAGE_COMMON_EXPORT SessionStorageUsageInfo {
Torne (Richard Coles)868fa2f2013-06-11 10:57:03 +010053 GURL origin;
54 std::string persistent_namespace_id;
55
56 SessionStorageUsageInfo();
57 ~SessionStorageUsageInfo();
58};
59
60} // namespace dom_storage
61
62#endif // WEBKIT_COMMON_DOM_STORAGE_DOM_STORAGE_TYPES_H_