Apply _RELATIVE relocations ahead of others.
[chromium-blink-merge.git] / content / browser / indexed_db / indexed_db_index_writer.h
blobef4bb16a52519b9f32325cc61bcce6082231e02e
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_INDEX_WRITER_H_
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_INDEX_WRITER_H_
8 #include <map>
9 #include <vector>
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.h"
15 #include "content/browser/indexed_db/indexed_db_metadata.h"
16 #include "content/common/indexed_db/indexed_db_key_path.h"
18 namespace content {
20 class IndexedDBTransaction;
21 struct IndexedDBObjectStoreMetadata;
23 class IndexWriter {
24 public:
25 explicit IndexWriter(const IndexedDBIndexMetadata& index_metadata);
27 IndexWriter(const IndexedDBIndexMetadata& index_metadata,
28 const IndexedDBDatabase::IndexKeys& index_keys);
30 bool VerifyIndexKeys(IndexedDBBackingStore* store,
31 IndexedDBBackingStore::Transaction* transaction,
32 int64 database_id,
33 int64 object_store_id,
34 int64 index_id,
35 bool* can_add_keys,
36 const IndexedDBKey& primary_key,
37 base::string16* error_message) const WARN_UNUSED_RESULT;
39 void WriteIndexKeys(const IndexedDBBackingStore::RecordIdentifier& record,
40 IndexedDBBackingStore* store,
41 IndexedDBBackingStore::Transaction* transaction,
42 int64 database_id,
43 int64 object_store_id) const;
45 ~IndexWriter();
47 private:
48 bool AddingKeyAllowed(IndexedDBBackingStore* store,
49 IndexedDBBackingStore::Transaction* transaction,
50 int64 database_id,
51 int64 object_store_id,
52 int64 index_id,
53 const IndexedDBKey& index_key,
54 const IndexedDBKey& primary_key,
55 bool* allowed) const WARN_UNUSED_RESULT;
57 const IndexedDBIndexMetadata index_metadata_;
58 IndexedDBDatabase::IndexKeys index_keys_;
60 DISALLOW_COPY_AND_ASSIGN(IndexWriter);
63 bool MakeIndexWriters(
64 IndexedDBTransaction* transaction,
65 IndexedDBBackingStore* store,
66 int64 database_id,
67 const IndexedDBObjectStoreMetadata& metadata,
68 const IndexedDBKey& primary_key,
69 bool key_was_generated,
70 const std::vector<IndexedDBDatabase::IndexKeys>& index_keys,
71 ScopedVector<IndexWriter>* index_writers,
72 base::string16* error_message,
73 bool* completed) WARN_UNUSED_RESULT;
75 } // namespace content
77 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_INDEX_WRITER_H_