| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ | 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ |
| 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ | 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
| 8 #include <list> | 11 #include <list> |
| 9 #include <map> | 12 #include <map> |
| 10 #include <string> | 13 #include <string> |
| 11 #include <utility> | 14 #include <utility> |
| 12 #include <vector> | 15 #include <vector> |
| 13 | 16 |
| 14 #include "base/basictypes.h" | 17 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
| 16 #include "content/browser/indexed_db/indexed_db.h" | 19 #include "content/browser/indexed_db/indexed_db.h" |
| 17 #include "content/browser/indexed_db/indexed_db_backing_store.h" | 20 #include "content/browser/indexed_db/indexed_db_backing_store.h" |
| 18 #include "content/browser/indexed_db/indexed_db_callbacks.h" | 21 #include "content/browser/indexed_db/indexed_db_callbacks.h" |
| 19 #include "content/browser/indexed_db/indexed_db_metadata.h" | 22 #include "content/browser/indexed_db/indexed_db_metadata.h" |
| 20 #include "content/browser/indexed_db/indexed_db_pending_connection.h" | 23 #include "content/browser/indexed_db/indexed_db_pending_connection.h" |
| 21 #include "content/browser/indexed_db/indexed_db_transaction_coordinator.h" | 24 #include "content/browser/indexed_db/indexed_db_transaction_coordinator.h" |
| 22 #include "content/browser/indexed_db/list_set.h" | 25 #include "content/browser/indexed_db/list_set.h" |
| 23 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h" | 26 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h" |
| 24 #include "url/gurl.h" | 27 #include "url/gurl.h" |
| 25 | 28 |
| 26 namespace content { | 29 namespace content { |
| 27 | 30 |
| 28 class IndexedDBBlobInfo; | 31 class IndexedDBBlobInfo; |
| 29 class IndexedDBConnection; | 32 class IndexedDBConnection; |
| 30 class IndexedDBDatabaseCallbacks; | 33 class IndexedDBDatabaseCallbacks; |
| 31 class IndexedDBFactory; | 34 class IndexedDBFactory; |
| 32 class IndexedDBKey; | 35 class IndexedDBKey; |
| 33 class IndexedDBKeyPath; | 36 class IndexedDBKeyPath; |
| 34 class IndexedDBKeyRange; | 37 class IndexedDBKeyRange; |
| 35 class IndexedDBTransaction; | 38 class IndexedDBTransaction; |
| 36 struct IndexedDBValue; | 39 struct IndexedDBValue; |
| 37 | 40 |
| 38 class CONTENT_EXPORT IndexedDBDatabase | 41 class CONTENT_EXPORT IndexedDBDatabase |
| 39 : NON_EXPORTED_BASE(public base::RefCounted<IndexedDBDatabase>) { | 42 : NON_EXPORTED_BASE(public base::RefCounted<IndexedDBDatabase>) { |
| 40 public: | 43 public: |
| 41 // An index and corresponding set of keys | 44 // An index and corresponding set of keys |
| 42 typedef std::pair<int64, std::vector<IndexedDBKey> > IndexKeys; | 45 typedef std::pair<int64_t, std::vector<IndexedDBKey>> IndexKeys; |
| 43 | 46 |
| 44 // Identifier is pair of (origin url, database name). | 47 // Identifier is pair of (origin url, database name). |
| 45 typedef std::pair<GURL, base::string16> Identifier; | 48 typedef std::pair<GURL, base::string16> Identifier; |
| 46 | 49 |
| 47 static const int64 kInvalidId = 0; | 50 static const int64_t kInvalidId = 0; |
| 48 static const int64 kMinimumIndexId = 30; | 51 static const int64_t kMinimumIndexId = 30; |
| 49 | 52 |
| 50 static scoped_refptr<IndexedDBDatabase> Create( | 53 static scoped_refptr<IndexedDBDatabase> Create( |
| 51 const base::string16& name, | 54 const base::string16& name, |
| 52 IndexedDBBackingStore* backing_store, | 55 IndexedDBBackingStore* backing_store, |
| 53 IndexedDBFactory* factory, | 56 IndexedDBFactory* factory, |
| 54 const Identifier& unique_identifier, | 57 const Identifier& unique_identifier, |
| 55 leveldb::Status* s); | 58 leveldb::Status* s); |
| 56 | 59 |
| 57 const Identifier& identifier() const { return identifier_; } | 60 const Identifier& identifier() const { return identifier_; } |
| 58 IndexedDBBackingStore* backing_store() { return backing_store_.get(); } | 61 IndexedDBBackingStore* backing_store() { return backing_store_.get(); } |
| 59 | 62 |
| 60 int64 id() const { return metadata_.id; } | 63 int64_t id() const { return metadata_.id; } |
| 61 const base::string16& name() const { return metadata_.name; } | 64 const base::string16& name() const { return metadata_.name; } |
| 62 | 65 |
| 63 void AddObjectStore(const IndexedDBObjectStoreMetadata& metadata, | 66 void AddObjectStore(const IndexedDBObjectStoreMetadata& metadata, |
| 64 int64 new_max_object_store_id); | 67 int64_t new_max_object_store_id); |
| 65 void RemoveObjectStore(int64 object_store_id); | 68 void RemoveObjectStore(int64_t object_store_id); |
| 66 void AddIndex(int64 object_store_id, | 69 void AddIndex(int64_t object_store_id, |
| 67 const IndexedDBIndexMetadata& metadata, | 70 const IndexedDBIndexMetadata& metadata, |
| 68 int64 new_max_index_id); | 71 int64_t new_max_index_id); |
| 69 void RemoveIndex(int64 object_store_id, int64 index_id); | 72 void RemoveIndex(int64_t object_store_id, int64_t index_id); |
| 70 | 73 |
| 71 void OpenConnection(const IndexedDBPendingConnection& connection); | 74 void OpenConnection(const IndexedDBPendingConnection& connection); |
| 72 void DeleteDatabase(scoped_refptr<IndexedDBCallbacks> callbacks); | 75 void DeleteDatabase(scoped_refptr<IndexedDBCallbacks> callbacks); |
| 73 const IndexedDBDatabaseMetadata& metadata() const { return metadata_; } | 76 const IndexedDBDatabaseMetadata& metadata() const { return metadata_; } |
| 74 | 77 |
| 75 void CreateObjectStore(int64 transaction_id, | 78 void CreateObjectStore(int64_t transaction_id, |
| 76 int64 object_store_id, | 79 int64_t object_store_id, |
| 77 const base::string16& name, | 80 const base::string16& name, |
| 78 const IndexedDBKeyPath& key_path, | 81 const IndexedDBKeyPath& key_path, |
| 79 bool auto_increment); | 82 bool auto_increment); |
| 80 void DeleteObjectStore(int64 transaction_id, int64 object_store_id); | 83 void DeleteObjectStore(int64_t transaction_id, int64_t object_store_id); |
| 81 void CreateTransaction(int64 transaction_id, | 84 void CreateTransaction(int64_t transaction_id, |
| 82 IndexedDBConnection* connection, | 85 IndexedDBConnection* connection, |
| 83 const std::vector<int64>& object_store_ids, | 86 const std::vector<int64_t>& object_store_ids, |
| 84 blink::WebIDBTransactionMode mode); | 87 blink::WebIDBTransactionMode mode); |
| 85 void Close(IndexedDBConnection* connection, bool forced); | 88 void Close(IndexedDBConnection* connection, bool forced); |
| 86 void ForceClose(); | 89 void ForceClose(); |
| 87 | 90 |
| 88 // Ack that one of the connections notified with a "versionchange" event did | 91 // Ack that one of the connections notified with a "versionchange" event did |
| 89 // not promptly close. Therefore a "blocked" event should be fired at the | 92 // not promptly close. Therefore a "blocked" event should be fired at the |
| 90 // pending connection. | 93 // pending connection. |
| 91 void VersionChangeIgnored(); | 94 void VersionChangeIgnored(); |
| 92 | 95 |
| 93 void Commit(int64 transaction_id); | 96 void Commit(int64_t transaction_id); |
| 94 void Abort(int64 transaction_id); | 97 void Abort(int64_t transaction_id); |
| 95 void Abort(int64 transaction_id, const IndexedDBDatabaseError& error); | 98 void Abort(int64_t transaction_id, const IndexedDBDatabaseError& error); |
| 96 | 99 |
| 97 void CreateIndex(int64 transaction_id, | 100 void CreateIndex(int64_t transaction_id, |
| 98 int64 object_store_id, | 101 int64_t object_store_id, |
| 99 int64 index_id, | 102 int64_t index_id, |
| 100 const base::string16& name, | 103 const base::string16& name, |
| 101 const IndexedDBKeyPath& key_path, | 104 const IndexedDBKeyPath& key_path, |
| 102 bool unique, | 105 bool unique, |
| 103 bool multi_entry); | 106 bool multi_entry); |
| 104 void DeleteIndex(int64 transaction_id, int64 object_store_id, int64 index_id); | 107 void DeleteIndex(int64_t transaction_id, |
| 108 int64_t object_store_id, |
| 109 int64_t index_id); |
| 105 | 110 |
| 106 IndexedDBTransactionCoordinator& transaction_coordinator() { | 111 IndexedDBTransactionCoordinator& transaction_coordinator() { |
| 107 return transaction_coordinator_; | 112 return transaction_coordinator_; |
| 108 } | 113 } |
| 109 const IndexedDBTransactionCoordinator& transaction_coordinator() const { | 114 const IndexedDBTransactionCoordinator& transaction_coordinator() const { |
| 110 return transaction_coordinator_; | 115 return transaction_coordinator_; |
| 111 } | 116 } |
| 112 | 117 |
| 113 void TransactionCreated(IndexedDBTransaction* transaction); | 118 void TransactionCreated(IndexedDBTransaction* transaction); |
| 114 void TransactionFinished(IndexedDBTransaction* transaction, bool committed); | 119 void TransactionFinished(IndexedDBTransaction* transaction, bool committed); |
| 115 | 120 |
| 116 // Called by transactions to report failure committing to the backing store. | 121 // Called by transactions to report failure committing to the backing store. |
| 117 void TransactionCommitFailed(const leveldb::Status& status); | 122 void TransactionCommitFailed(const leveldb::Status& status); |
| 118 | 123 |
| 119 void Get(int64 transaction_id, | 124 void Get(int64_t transaction_id, |
| 120 int64 object_store_id, | 125 int64_t object_store_id, |
| 121 int64 index_id, | 126 int64_t index_id, |
| 122 scoped_ptr<IndexedDBKeyRange> key_range, | 127 scoped_ptr<IndexedDBKeyRange> key_range, |
| 123 bool key_only, | 128 bool key_only, |
| 124 scoped_refptr<IndexedDBCallbacks> callbacks); | 129 scoped_refptr<IndexedDBCallbacks> callbacks); |
| 125 void GetAll(int64 transaction_id, | 130 void GetAll(int64_t transaction_id, |
| 126 int64 object_store_id, | 131 int64_t object_store_id, |
| 127 int64 index_id, | 132 int64_t index_id, |
| 128 scoped_ptr<IndexedDBKeyRange> key_range, | 133 scoped_ptr<IndexedDBKeyRange> key_range, |
| 129 bool key_only, | 134 bool key_only, |
| 130 int64 max_count, | 135 int64_t max_count, |
| 131 scoped_refptr<IndexedDBCallbacks> callbacks); | 136 scoped_refptr<IndexedDBCallbacks> callbacks); |
| 132 void Put(int64 transaction_id, | 137 void Put(int64_t transaction_id, |
| 133 int64 object_store_id, | 138 int64_t object_store_id, |
| 134 IndexedDBValue* value, | 139 IndexedDBValue* value, |
| 135 ScopedVector<storage::BlobDataHandle>* handles, | 140 ScopedVector<storage::BlobDataHandle>* handles, |
| 136 scoped_ptr<IndexedDBKey> key, | 141 scoped_ptr<IndexedDBKey> key, |
| 137 blink::WebIDBPutMode mode, | 142 blink::WebIDBPutMode mode, |
| 138 scoped_refptr<IndexedDBCallbacks> callbacks, | 143 scoped_refptr<IndexedDBCallbacks> callbacks, |
| 139 const std::vector<IndexKeys>& index_keys); | 144 const std::vector<IndexKeys>& index_keys); |
| 140 void SetIndexKeys(int64 transaction_id, | 145 void SetIndexKeys(int64_t transaction_id, |
| 141 int64 object_store_id, | 146 int64_t object_store_id, |
| 142 scoped_ptr<IndexedDBKey> primary_key, | 147 scoped_ptr<IndexedDBKey> primary_key, |
| 143 const std::vector<IndexKeys>& index_keys); | 148 const std::vector<IndexKeys>& index_keys); |
| 144 void SetIndexesReady(int64 transaction_id, | 149 void SetIndexesReady(int64_t transaction_id, |
| 145 int64 object_store_id, | 150 int64_t object_store_id, |
| 146 const std::vector<int64>& index_ids); | 151 const std::vector<int64_t>& index_ids); |
| 147 void OpenCursor(int64 transaction_id, | 152 void OpenCursor(int64_t transaction_id, |
| 148 int64 object_store_id, | 153 int64_t object_store_id, |
| 149 int64 index_id, | 154 int64_t index_id, |
| 150 scoped_ptr<IndexedDBKeyRange> key_range, | 155 scoped_ptr<IndexedDBKeyRange> key_range, |
| 151 blink::WebIDBCursorDirection, | 156 blink::WebIDBCursorDirection, |
| 152 bool key_only, | 157 bool key_only, |
| 153 blink::WebIDBTaskType task_type, | 158 blink::WebIDBTaskType task_type, |
| 154 scoped_refptr<IndexedDBCallbacks> callbacks); | 159 scoped_refptr<IndexedDBCallbacks> callbacks); |
| 155 void Count(int64 transaction_id, | 160 void Count(int64_t transaction_id, |
| 156 int64 object_store_id, | 161 int64_t object_store_id, |
| 157 int64 index_id, | 162 int64_t index_id, |
| 158 scoped_ptr<IndexedDBKeyRange> key_range, | 163 scoped_ptr<IndexedDBKeyRange> key_range, |
| 159 scoped_refptr<IndexedDBCallbacks> callbacks); | 164 scoped_refptr<IndexedDBCallbacks> callbacks); |
| 160 void DeleteRange(int64 transaction_id, | 165 void DeleteRange(int64_t transaction_id, |
| 161 int64 object_store_id, | 166 int64_t object_store_id, |
| 162 scoped_ptr<IndexedDBKeyRange> key_range, | 167 scoped_ptr<IndexedDBKeyRange> key_range, |
| 163 scoped_refptr<IndexedDBCallbacks> callbacks); | 168 scoped_refptr<IndexedDBCallbacks> callbacks); |
| 164 void Clear(int64 transaction_id, | 169 void Clear(int64_t transaction_id, |
| 165 int64 object_store_id, | 170 int64_t object_store_id, |
| 166 scoped_refptr<IndexedDBCallbacks> callbacks); | 171 scoped_refptr<IndexedDBCallbacks> callbacks); |
| 167 | 172 |
| 168 // Number of connections that have progressed passed initial open call. | 173 // Number of connections that have progressed passed initial open call. |
| 169 size_t ConnectionCount() const; | 174 size_t ConnectionCount() const; |
| 170 // Number of open calls that are blocked on other connections. | 175 // Number of open calls that are blocked on other connections. |
| 171 size_t PendingOpenCount() const; | 176 size_t PendingOpenCount() const; |
| 172 // Number of pending upgrades (0 or 1). Also included in ConnectionCount(). | 177 // Number of pending upgrades (0 or 1). Also included in ConnectionCount(). |
| 173 size_t PendingUpgradeCount() const; | 178 size_t PendingUpgradeCount() const; |
| 174 // Number of running upgrades (0 or 1). Also included in ConnectionCount(). | 179 // Number of running upgrades (0 or 1). Also included in ConnectionCount(). |
| 175 size_t RunningUpgradeCount() const; | 180 size_t RunningUpgradeCount() const; |
| 176 // Number of pending deletes, blocked on other connections. | 181 // Number of pending deletes, blocked on other connections. |
| 177 size_t PendingDeleteCount() const; | 182 size_t PendingDeleteCount() const; |
| 178 | 183 |
| 179 // Asynchronous tasks scheduled within transactions: | 184 // Asynchronous tasks scheduled within transactions: |
| 180 void CreateObjectStoreAbortOperation(int64 object_store_id, | 185 void CreateObjectStoreAbortOperation(int64_t object_store_id, |
| 181 IndexedDBTransaction* transaction); | 186 IndexedDBTransaction* transaction); |
| 182 void DeleteObjectStoreOperation( | 187 void DeleteObjectStoreOperation(int64_t object_store_id, |
| 183 int64 object_store_id, | 188 IndexedDBTransaction* transaction); |
| 184 IndexedDBTransaction* transaction); | |
| 185 void DeleteObjectStoreAbortOperation( | 189 void DeleteObjectStoreAbortOperation( |
| 186 const IndexedDBObjectStoreMetadata& object_store_metadata, | 190 const IndexedDBObjectStoreMetadata& object_store_metadata, |
| 187 IndexedDBTransaction* transaction); | 191 IndexedDBTransaction* transaction); |
| 188 void VersionChangeOperation(int64 version, | 192 void VersionChangeOperation(int64_t version, |
| 189 scoped_refptr<IndexedDBCallbacks> callbacks, | 193 scoped_refptr<IndexedDBCallbacks> callbacks, |
| 190 scoped_ptr<IndexedDBConnection> connection, | 194 scoped_ptr<IndexedDBConnection> connection, |
| 191 IndexedDBTransaction* transaction); | 195 IndexedDBTransaction* transaction); |
| 192 void VersionChangeAbortOperation(const base::string16& previous_version, | 196 void VersionChangeAbortOperation(const base::string16& previous_version, |
| 193 int64 previous_int_version, | 197 int64_t previous_int_version, |
| 194 IndexedDBTransaction* transaction); | 198 IndexedDBTransaction* transaction); |
| 195 void DeleteIndexOperation(int64 object_store_id, | 199 void DeleteIndexOperation(int64_t object_store_id, |
| 196 int64 index_id, | 200 int64_t index_id, |
| 197 IndexedDBTransaction* transaction); | 201 IndexedDBTransaction* transaction); |
| 198 void CreateIndexAbortOperation(int64 object_store_id, | 202 void CreateIndexAbortOperation(int64_t object_store_id, |
| 199 int64 index_id, | 203 int64_t index_id, |
| 200 IndexedDBTransaction* transaction); | 204 IndexedDBTransaction* transaction); |
| 201 void DeleteIndexAbortOperation(int64 object_store_id, | 205 void DeleteIndexAbortOperation(int64_t object_store_id, |
| 202 const IndexedDBIndexMetadata& index_metadata, | 206 const IndexedDBIndexMetadata& index_metadata, |
| 203 IndexedDBTransaction* transaction); | 207 IndexedDBTransaction* transaction); |
| 204 void GetOperation(int64 object_store_id, | 208 void GetOperation(int64_t object_store_id, |
| 205 int64 index_id, | 209 int64_t index_id, |
| 206 scoped_ptr<IndexedDBKeyRange> key_range, | 210 scoped_ptr<IndexedDBKeyRange> key_range, |
| 207 indexed_db::CursorType cursor_type, | 211 indexed_db::CursorType cursor_type, |
| 208 scoped_refptr<IndexedDBCallbacks> callbacks, | 212 scoped_refptr<IndexedDBCallbacks> callbacks, |
| 209 IndexedDBTransaction* transaction); | 213 IndexedDBTransaction* transaction); |
| 210 void GetAllOperation(int64 object_store_id, | 214 void GetAllOperation(int64_t object_store_id, |
| 211 int64 index_id, | 215 int64_t index_id, |
| 212 scoped_ptr<IndexedDBKeyRange> key_range, | 216 scoped_ptr<IndexedDBKeyRange> key_range, |
| 213 indexed_db::CursorType cursor_type, | 217 indexed_db::CursorType cursor_type, |
| 214 int64 max_count, | 218 int64_t max_count, |
| 215 scoped_refptr<IndexedDBCallbacks> callbacks, | 219 scoped_refptr<IndexedDBCallbacks> callbacks, |
| 216 IndexedDBTransaction* transaction); | 220 IndexedDBTransaction* transaction); |
| 217 struct PutOperationParams; | 221 struct PutOperationParams; |
| 218 void PutOperation(scoped_ptr<PutOperationParams> params, | 222 void PutOperation(scoped_ptr<PutOperationParams> params, |
| 219 IndexedDBTransaction* transaction); | 223 IndexedDBTransaction* transaction); |
| 220 void SetIndexesReadyOperation(size_t index_count, | 224 void SetIndexesReadyOperation(size_t index_count, |
| 221 IndexedDBTransaction* transaction); | 225 IndexedDBTransaction* transaction); |
| 222 struct OpenCursorOperationParams; | 226 struct OpenCursorOperationParams; |
| 223 void OpenCursorOperation(scoped_ptr<OpenCursorOperationParams> params, | 227 void OpenCursorOperation(scoped_ptr<OpenCursorOperationParams> params, |
| 224 IndexedDBTransaction* transaction); | 228 IndexedDBTransaction* transaction); |
| 225 void CountOperation(int64 object_store_id, | 229 void CountOperation(int64_t object_store_id, |
| 226 int64 index_id, | 230 int64_t index_id, |
| 227 scoped_ptr<IndexedDBKeyRange> key_range, | 231 scoped_ptr<IndexedDBKeyRange> key_range, |
| 228 scoped_refptr<IndexedDBCallbacks> callbacks, | 232 scoped_refptr<IndexedDBCallbacks> callbacks, |
| 229 IndexedDBTransaction* transaction); | 233 IndexedDBTransaction* transaction); |
| 230 void DeleteRangeOperation(int64 object_store_id, | 234 void DeleteRangeOperation(int64_t object_store_id, |
| 231 scoped_ptr<IndexedDBKeyRange> key_range, | 235 scoped_ptr<IndexedDBKeyRange> key_range, |
| 232 scoped_refptr<IndexedDBCallbacks> callbacks, | 236 scoped_refptr<IndexedDBCallbacks> callbacks, |
| 233 IndexedDBTransaction* transaction); | 237 IndexedDBTransaction* transaction); |
| 234 void ClearOperation(int64 object_store_id, | 238 void ClearOperation(int64_t object_store_id, |
| 235 scoped_refptr<IndexedDBCallbacks> callbacks, | 239 scoped_refptr<IndexedDBCallbacks> callbacks, |
| 236 IndexedDBTransaction* transaction); | 240 IndexedDBTransaction* transaction); |
| 237 | 241 |
| 238 protected: | 242 protected: |
| 239 IndexedDBDatabase(const base::string16& name, | 243 IndexedDBDatabase(const base::string16& name, |
| 240 IndexedDBBackingStore* backing_store, | 244 IndexedDBBackingStore* backing_store, |
| 241 IndexedDBFactory* factory, | 245 IndexedDBFactory* factory, |
| 242 const Identifier& unique_identifier); | 246 const Identifier& unique_identifier); |
| 243 virtual ~IndexedDBDatabase(); | 247 virtual ~IndexedDBDatabase(); |
| 244 | 248 |
| 245 // May be overridden in tests. | 249 // May be overridden in tests. |
| 246 virtual size_t GetMaxMessageSizeInBytes() const; | 250 virtual size_t GetMaxMessageSizeInBytes() const; |
| 247 | 251 |
| 248 private: | 252 private: |
| 249 friend class base::RefCounted<IndexedDBDatabase>; | 253 friend class base::RefCounted<IndexedDBDatabase>; |
| 250 friend class IndexedDBClassFactory; | 254 friend class IndexedDBClassFactory; |
| 251 | 255 |
| 252 class PendingDeleteCall; | 256 class PendingDeleteCall; |
| 253 class PendingSuccessCall; | 257 class PendingSuccessCall; |
| 254 class PendingUpgradeCall; | 258 class PendingUpgradeCall; |
| 255 | 259 |
| 256 typedef std::map<int64, IndexedDBTransaction*> TransactionMap; | 260 typedef std::map<int64_t, IndexedDBTransaction*> TransactionMap; |
| 257 typedef std::list<IndexedDBPendingConnection> PendingOpenCallList; | 261 typedef std::list<IndexedDBPendingConnection> PendingOpenCallList; |
| 258 typedef std::list<PendingDeleteCall*> PendingDeleteCallList; | 262 typedef std::list<PendingDeleteCall*> PendingDeleteCallList; |
| 259 typedef list_set<IndexedDBConnection*> ConnectionSet; | 263 typedef list_set<IndexedDBConnection*> ConnectionSet; |
| 260 | 264 |
| 261 bool IsOpenConnectionBlocked() const; | 265 bool IsOpenConnectionBlocked() const; |
| 262 leveldb::Status OpenInternal(); | 266 leveldb::Status OpenInternal(); |
| 263 void RunVersionChangeTransaction(scoped_refptr<IndexedDBCallbacks> callbacks, | 267 void RunVersionChangeTransaction(scoped_refptr<IndexedDBCallbacks> callbacks, |
| 264 scoped_ptr<IndexedDBConnection> connection, | 268 scoped_ptr<IndexedDBConnection> connection, |
| 265 int64 transaction_id, | 269 int64_t transaction_id, |
| 266 int64 requested_version); | 270 int64_t requested_version); |
| 267 void RunVersionChangeTransactionFinal( | 271 void RunVersionChangeTransactionFinal( |
| 268 scoped_refptr<IndexedDBCallbacks> callbacks, | 272 scoped_refptr<IndexedDBCallbacks> callbacks, |
| 269 scoped_ptr<IndexedDBConnection> connection, | 273 scoped_ptr<IndexedDBConnection> connection, |
| 270 int64 transaction_id, | 274 int64_t transaction_id, |
| 271 int64 requested_version); | 275 int64_t requested_version); |
| 272 void ProcessPendingCalls(); | 276 void ProcessPendingCalls(); |
| 273 | 277 |
| 274 bool IsDeleteDatabaseBlocked() const; | 278 bool IsDeleteDatabaseBlocked() const; |
| 275 void DeleteDatabaseFinal(scoped_refptr<IndexedDBCallbacks> callbacks); | 279 void DeleteDatabaseFinal(scoped_refptr<IndexedDBCallbacks> callbacks); |
| 276 | 280 |
| 277 scoped_ptr<IndexedDBConnection> CreateConnection( | 281 scoped_ptr<IndexedDBConnection> CreateConnection( |
| 278 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks, | 282 scoped_refptr<IndexedDBDatabaseCallbacks> database_callbacks, |
| 279 int child_process_id); | 283 int child_process_id); |
| 280 | 284 |
| 281 IndexedDBTransaction* GetTransaction(int64 transaction_id) const; | 285 IndexedDBTransaction* GetTransaction(int64_t transaction_id) const; |
| 282 | 286 |
| 283 bool ValidateObjectStoreId(int64 object_store_id) const; | 287 bool ValidateObjectStoreId(int64_t object_store_id) const; |
| 284 bool ValidateObjectStoreIdAndIndexId(int64 object_store_id, | 288 bool ValidateObjectStoreIdAndIndexId(int64_t object_store_id, |
| 285 int64 index_id) const; | 289 int64_t index_id) const; |
| 286 bool ValidateObjectStoreIdAndOptionalIndexId(int64 object_store_id, | 290 bool ValidateObjectStoreIdAndOptionalIndexId(int64_t object_store_id, |
| 287 int64 index_id) const; | 291 int64_t index_id) const; |
| 288 bool ValidateObjectStoreIdAndNewIndexId(int64 object_store_id, | 292 bool ValidateObjectStoreIdAndNewIndexId(int64_t object_store_id, |
| 289 int64 index_id) const; | 293 int64_t index_id) const; |
| 290 | 294 |
| 291 scoped_refptr<IndexedDBBackingStore> backing_store_; | 295 scoped_refptr<IndexedDBBackingStore> backing_store_; |
| 292 IndexedDBDatabaseMetadata metadata_; | 296 IndexedDBDatabaseMetadata metadata_; |
| 293 | 297 |
| 294 const Identifier identifier_; | 298 const Identifier identifier_; |
| 295 scoped_refptr<IndexedDBFactory> factory_; | 299 scoped_refptr<IndexedDBFactory> factory_; |
| 296 | 300 |
| 297 IndexedDBTransactionCoordinator transaction_coordinator_; | 301 IndexedDBTransactionCoordinator transaction_coordinator_; |
| 298 | 302 |
| 299 TransactionMap transactions_; | 303 TransactionMap transactions_; |
| 300 PendingOpenCallList pending_open_calls_; | 304 PendingOpenCallList pending_open_calls_; |
| 301 scoped_ptr<PendingUpgradeCall> pending_run_version_change_transaction_call_; | 305 scoped_ptr<PendingUpgradeCall> pending_run_version_change_transaction_call_; |
| 302 scoped_ptr<PendingSuccessCall> pending_second_half_open_; | 306 scoped_ptr<PendingSuccessCall> pending_second_half_open_; |
| 303 PendingDeleteCallList pending_delete_calls_; | 307 PendingDeleteCallList pending_delete_calls_; |
| 304 | 308 |
| 305 ConnectionSet connections_; | 309 ConnectionSet connections_; |
| 306 | 310 |
| 307 DISALLOW_COPY_AND_ASSIGN(IndexedDBDatabase); | 311 DISALLOW_COPY_AND_ASSIGN(IndexedDBDatabase); |
| 308 }; | 312 }; |
| 309 | 313 |
| 310 } // namespace content | 314 } // namespace content |
| 311 | 315 |
| 312 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ | 316 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ |
| OLD | NEW |