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