| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_INDEX_WRITER_H_ | |
| 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_INDEX_WRITER_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/basictypes.h" | |
| 12 #include "base/memory/scoped_vector.h" | |
| 13 #include "content/browser/indexed_db/indexed_db_backing_store.h" | |
| 14 #include "content/browser/indexed_db/indexed_db_database_impl.h" | |
| 15 #include "content/browser/indexed_db/indexed_db_metadata.h" | |
| 16 #include "content/common/indexed_db/indexed_db_key_path.h" | |
| 17 | |
| 18 namespace content { | |
| 19 | |
| 20 class IndexedDBDatabaseImpl; | |
| 21 class IndexedDBTransaction; | |
| 22 struct IndexedDBObjectStoreMetadata; | |
| 23 | |
| 24 // TODO(alecflett): this namespace is temporary until we move its contents out | |
| 25 // to their own home. | |
| 26 namespace IndexedDBObjectStoreImpl { | |
| 27 | |
| 28 class IndexWriter { | |
| 29 public: | |
| 30 explicit IndexWriter(const IndexedDBIndexMetadata& index_metadata); | |
| 31 | |
| 32 IndexWriter(const IndexedDBIndexMetadata& index_metadata, | |
| 33 const IndexedDBDatabase::IndexKeys& index_keys); | |
| 34 | |
| 35 bool VerifyIndexKeys(IndexedDBBackingStore* store, | |
| 36 IndexedDBBackingStore::Transaction* transaction, | |
| 37 int64 database_id, | |
| 38 int64 object_store_id, | |
| 39 int64 index_id, | |
| 40 bool* can_add_keys, | |
| 41 const IndexedDBKey& primary_key, | |
| 42 string16* error_message = 0) const WARN_UNUSED_RESULT; | |
| 43 | |
| 44 void WriteIndexKeys(const IndexedDBBackingStore::RecordIdentifier& record, | |
| 45 IndexedDBBackingStore* store, | |
| 46 IndexedDBBackingStore::Transaction* transaction, | |
| 47 int64 database_id, | |
| 48 int64 object_store_id) const; | |
| 49 | |
| 50 ~IndexWriter(); | |
| 51 | |
| 52 private: | |
| 53 bool AddingKeyAllowed(IndexedDBBackingStore* store, | |
| 54 IndexedDBBackingStore::Transaction* transaction, | |
| 55 int64 database_id, | |
| 56 int64 object_store_id, | |
| 57 int64 index_id, | |
| 58 const IndexedDBKey& index_key, | |
| 59 const IndexedDBKey& primary_key, | |
| 60 bool* allowed) const WARN_UNUSED_RESULT; | |
| 61 | |
| 62 const IndexedDBIndexMetadata index_metadata_; | |
| 63 IndexedDBDatabase::IndexKeys index_keys_; | |
| 64 }; | |
| 65 | |
| 66 bool MakeIndexWriters( | |
| 67 scoped_refptr<IndexedDBTransaction> transaction, | |
| 68 IndexedDBBackingStore* store, | |
| 69 int64 database_id, | |
| 70 const IndexedDBObjectStoreMetadata& metadata, | |
| 71 const IndexedDBKey& primary_key, | |
| 72 bool key_was_generated, | |
| 73 const std::vector<int64>& index_ids, | |
| 74 const std::vector<IndexedDBDatabase::IndexKeys>& index_keys, | |
| 75 ScopedVector<IndexWriter>* index_writers, | |
| 76 string16* error_message, | |
| 77 bool* completed) WARN_UNUSED_RESULT; | |
| 78 }; | |
| 79 | |
| 80 } // namespace content | |
| 81 | |
| 82 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_INDEX_WRITER_H_ | |
| OLD | NEW |