Revert 268405 "Make sure that ScratchBuffer::Allocate() always r..."
[chromium-blink-merge.git] / content / browser / indexed_db / indexed_db_metadata.h
blob00970a61ee51d54540b6351e3d029391439c6c40
1 // Copyright (c) 2013 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.
5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_METADATA_H_
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_METADATA_H_
8 #include <map>
10 #include "base/basictypes.h"
11 #include "base/strings/string16.h"
12 #include "content/common/indexed_db/indexed_db_key_path.h"
14 namespace content {
16 struct IndexedDBIndexMetadata {
17 IndexedDBIndexMetadata() {}
18 IndexedDBIndexMetadata(const base::string16& name,
19 int64 id,
20 const IndexedDBKeyPath& key_path,
21 bool unique,
22 bool multi_entry)
23 : name(name),
24 id(id),
25 key_path(key_path),
26 unique(unique),
27 multi_entry(multi_entry) {}
28 base::string16 name;
29 int64 id;
30 IndexedDBKeyPath key_path;
31 bool unique;
32 bool multi_entry;
34 static const int64 kInvalidId = -1;
37 struct CONTENT_EXPORT IndexedDBObjectStoreMetadata {
38 IndexedDBObjectStoreMetadata();
39 IndexedDBObjectStoreMetadata(const base::string16& name,
40 int64 id,
41 const IndexedDBKeyPath& key_path,
42 bool auto_increment,
43 int64 max_index_id);
44 ~IndexedDBObjectStoreMetadata();
45 base::string16 name;
46 int64 id;
47 IndexedDBKeyPath key_path;
48 bool auto_increment;
49 int64 max_index_id;
51 static const int64 kInvalidId = -1;
53 typedef std::map<int64, IndexedDBIndexMetadata> IndexMap;
54 IndexMap indexes;
57 struct CONTENT_EXPORT IndexedDBDatabaseMetadata {
58 // TODO(jsbell): These can probably be collapsed into 0.
59 enum {
60 NO_INT_VERSION = -1,
61 DEFAULT_INT_VERSION = 0
64 typedef std::map<int64, IndexedDBObjectStoreMetadata> ObjectStoreMap;
66 IndexedDBDatabaseMetadata();
67 IndexedDBDatabaseMetadata(const base::string16& name,
68 int64 id,
69 const base::string16& version,
70 int64 int_version,
71 int64 max_object_store_id);
72 ~IndexedDBDatabaseMetadata();
74 base::string16 name;
75 int64 id;
76 base::string16 version;
77 int64 int_version;
78 int64 max_object_store_id;
80 ObjectStoreMap object_stores;
84 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_METADATA_H_