| 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 <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <utility> |
| 11 #include <vector> | 12 #include <vector> |
| 12 | 13 |
| 13 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 14 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 15 #include "content/browser/indexed_db/indexed_db.h" | 16 #include "content/browser/indexed_db/indexed_db.h" |
| 16 #include "content/browser/indexed_db/indexed_db_backing_store.h" | 17 #include "content/browser/indexed_db/indexed_db_backing_store.h" |
| 17 #include "content/browser/indexed_db/indexed_db_callbacks.h" | 18 #include "content/browser/indexed_db/indexed_db_callbacks.h" |
| 18 #include "content/browser/indexed_db/indexed_db_metadata.h" | 19 #include "content/browser/indexed_db/indexed_db_metadata.h" |
| 19 #include "content/browser/indexed_db/indexed_db_transaction_coordinator.h" | 20 #include "content/browser/indexed_db/indexed_db_transaction_coordinator.h" |
| 20 #include "content/browser/indexed_db/list_set.h" | 21 #include "content/browser/indexed_db/list_set.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 37 NORMAL_TASK = 0, | 38 NORMAL_TASK = 0, |
| 38 PREEMPTIVE_TASK | 39 PREEMPTIVE_TASK |
| 39 }; | 40 }; |
| 40 | 41 |
| 41 enum PutMode { | 42 enum PutMode { |
| 42 ADD_OR_UPDATE, | 43 ADD_OR_UPDATE, |
| 43 ADD_ONLY, | 44 ADD_ONLY, |
| 44 CURSOR_UPDATE | 45 CURSOR_UPDATE |
| 45 }; | 46 }; |
| 46 | 47 |
| 47 typedef std::vector<IndexedDBKey> IndexKeys; | 48 // An index and corresponding set of keys |
| 49 typedef std::pair<int64, std::vector<IndexedDBKey> > IndexKeys; |
| 50 |
| 48 // Identifier is pair of (origin url, database name). | 51 // Identifier is pair of (origin url, database name). |
| 49 typedef std::pair<GURL, base::string16> Identifier; | 52 typedef std::pair<GURL, base::string16> Identifier; |
| 50 | 53 |
| 51 static const int64 kInvalidId = 0; | 54 static const int64 kInvalidId = 0; |
| 52 static const int64 kMinimumIndexId = 30; | 55 static const int64 kMinimumIndexId = 30; |
| 53 | 56 |
| 54 static scoped_refptr<IndexedDBDatabase> Create( | 57 static scoped_refptr<IndexedDBDatabase> Create( |
| 55 const base::string16& name, | 58 const base::string16& name, |
| 56 IndexedDBBackingStore* backing_store, | 59 IndexedDBBackingStore* backing_store, |
| 57 IndexedDBFactory* factory, | 60 IndexedDBFactory* factory, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 int64 index_id, | 126 int64 index_id, |
| 124 scoped_ptr<IndexedDBKeyRange> key_range, | 127 scoped_ptr<IndexedDBKeyRange> key_range, |
| 125 bool key_only, | 128 bool key_only, |
| 126 scoped_refptr<IndexedDBCallbacks> callbacks); | 129 scoped_refptr<IndexedDBCallbacks> callbacks); |
| 127 void Put(int64 transaction_id, | 130 void Put(int64 transaction_id, |
| 128 int64 object_store_id, | 131 int64 object_store_id, |
| 129 std::string* value, | 132 std::string* value, |
| 130 scoped_ptr<IndexedDBKey> key, | 133 scoped_ptr<IndexedDBKey> key, |
| 131 PutMode mode, | 134 PutMode mode, |
| 132 scoped_refptr<IndexedDBCallbacks> callbacks, | 135 scoped_refptr<IndexedDBCallbacks> callbacks, |
| 133 const std::vector<int64>& index_ids, | |
| 134 const std::vector<IndexKeys>& index_keys); | 136 const std::vector<IndexKeys>& index_keys); |
| 135 void SetIndexKeys(int64 transaction_id, | 137 void SetIndexKeys(int64 transaction_id, |
| 136 int64 object_store_id, | 138 int64 object_store_id, |
| 137 scoped_ptr<IndexedDBKey> primary_key, | 139 scoped_ptr<IndexedDBKey> primary_key, |
| 138 const std::vector<int64>& index_ids, | |
| 139 const std::vector<IndexKeys>& index_keys); | 140 const std::vector<IndexKeys>& index_keys); |
| 140 void SetIndexesReady(int64 transaction_id, | 141 void SetIndexesReady(int64 transaction_id, |
| 141 int64 object_store_id, | 142 int64 object_store_id, |
| 142 const std::vector<int64>& index_ids); | 143 const std::vector<int64>& index_ids); |
| 143 void OpenCursor(int64 transaction_id, | 144 void OpenCursor(int64 transaction_id, |
| 144 int64 object_store_id, | 145 int64 object_store_id, |
| 145 int64 index_id, | 146 int64 index_id, |
| 146 scoped_ptr<IndexedDBKeyRange> key_range, | 147 scoped_ptr<IndexedDBKeyRange> key_range, |
| 147 indexed_db::CursorDirection, | 148 indexed_db::CursorDirection, |
| 148 bool key_only, | 149 bool key_only, |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 typedef std::list<PendingDeleteCall*> PendingDeleteCallList; | 292 typedef std::list<PendingDeleteCall*> PendingDeleteCallList; |
| 292 PendingDeleteCallList pending_delete_calls_; | 293 PendingDeleteCallList pending_delete_calls_; |
| 293 | 294 |
| 294 typedef list_set<IndexedDBConnection*> ConnectionSet; | 295 typedef list_set<IndexedDBConnection*> ConnectionSet; |
| 295 ConnectionSet connections_; | 296 ConnectionSet connections_; |
| 296 }; | 297 }; |
| 297 | 298 |
| 298 } // namespace content | 299 } // namespace content |
| 299 | 300 |
| 300 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ | 301 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ |
| OLD | NEW |