OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 #include "modules/indexeddb/IDBDatabaseProxy.h" |
| 6 |
| 7 #include "modules/indexeddb/IDBMojoUtil.h" |
| 8 |
| 9 namespace blink { |
| 10 |
| 11 IDBDatabaseProxy::IDBDatabaseProxy(indexed_db::mojom::blink::DatabasePtr databas
e) |
| 12 : m_database(std::move(database)) |
| 13 { |
| 14 } |
| 15 |
| 16 IDBDatabaseProxy* IDBDatabaseProxy::create(indexed_db::mojom::blink::DatabasePtr
database) |
| 17 { |
| 18 return new IDBDatabaseProxy(std::move(database)); |
| 19 } |
| 20 |
| 21 void IDBDatabaseProxy::CreateObjectStore(int64_t transactionId, int64_t objectSt
oreId, const WTF::String& name, const IDBKeyPath& keyPath, bool autoIncrement) |
| 22 { |
| 23 m_database->CreateObjectStore(transactionId, objectStoreId, name, createKeyP
ath(keyPath), autoIncrement); |
| 24 } |
| 25 |
| 26 void IDBDatabaseProxy::Close() |
| 27 { |
| 28 m_database->Close(); |
| 29 } |
| 30 |
| 31 void IDBDatabaseProxy::DeleteObjectStore(int64_t transactionId, int64_t objectSt
oreId) |
| 32 { |
| 33 m_database->DeleteObjectStore(transactionId, objectStoreId); |
| 34 } |
| 35 |
| 36 void IDBDatabaseProxy::CreateTransaction(int64_t id, const Vector<int64_t>& obje
ctStoreIds, indexed_db::mojom::blink::TransactionMode transactionMode) |
| 37 { |
| 38 Vector<int64_t> idCopy(objectStoreIds); |
| 39 m_database->CreateTransaction(id, std::move(idCopy), transactionMode); |
| 40 } |
| 41 |
| 42 void IDBDatabaseProxy::VersionChangeIgnored() |
| 43 { |
| 44 m_database->VersionChangeIgnored(); |
| 45 } |
| 46 |
| 47 void IDBDatabaseProxy::Abort(int64_t transactionId) |
| 48 { |
| 49 m_database->Abort(transactionId); |
| 50 } |
| 51 |
| 52 void IDBDatabaseProxy::Commit(int64_t transactionId) |
| 53 { |
| 54 m_database->Commit(transactionId); |
| 55 } |
| 56 |
| 57 void IDBDatabaseProxy::Get(int64_t transactionId, int64_t objectStoreId, int64_t
indexId, const IDBKeyRange* keyRange, bool keyOnly, const indexed_db::mojom::bl
ink::Database::GetCallback& callback) |
| 58 { |
| 59 m_database->Get(transactionId, objectStoreId, indexId, createKeyRange(keyRan
ge), keyOnly, callback); |
| 60 } |
| 61 |
| 62 void IDBDatabaseProxy::GetAll(int64_t transactionId, int64_t objectStoreId, int6
4_t indexId, const IDBKeyRange* keyRange, int64_t maxCount, bool keyOnly) |
| 63 { |
| 64 m_database->GetAll(transactionId, objectStoreId, indexId, createKeyRange(key
Range), maxCount, keyOnly); |
| 65 } |
| 66 |
| 67 #if 0 |
| 68 void IDBDatabaseProxy::Put(int64_t transactionId, int64_t objectStoreId, Vector<
int8_t> value, Vector<BlobInfoPtr> blobInfo, IDBKey key, PutMode putMode, Vector
<int64_t> indexIds, Vector<Vector<KeyPtr>> indexKeys) |
| 69 { |
| 70 m_database->Put(transactionId, objectStoreId, value, blobInfo, key, putMode,
indexIds, indexKeys); |
| 71 } |
| 72 #endif |
| 73 |
| 74 void IDBDatabaseProxy::DeleteRange(int64_t transactionId, int64_t objectStoreId,
const IDBKeyRange* keyRange) |
| 75 { |
| 76 m_database->DeleteRange(transactionId, objectStoreId, createKeyRange(keyRang
e)); |
| 77 } |
| 78 |
| 79 void IDBDatabaseProxy::Clear(int64_t transactionId, int64_t objectStoreId) |
| 80 { |
| 81 m_database->Clear(transactionId, objectStoreId); |
| 82 } |
| 83 |
| 84 void IDBDatabaseProxy::CreateIndex(int64_t transactionId, int64_t objectStoreId,
int64_t indexId, const WTF::String& name, const IDBKeyPath& keyPath, bool uniqu
e, bool multiEntry) |
| 85 { |
| 86 m_database->CreateIndex(transactionId, objectStoreId, indexId, name, createK
eyPath(keyPath), unique, multiEntry); |
| 87 } |
| 88 |
| 89 void IDBDatabaseProxy::DeleteIndex(int64_t transactionId, int64_t objectStoreId,
int64_t indexId) |
| 90 { |
| 91 m_database->DeleteIndex(transactionId, objectStoreId, indexId); |
| 92 } |
| 93 |
| 94 void IDBDatabaseProxy::SetIndexKeys(int64_t transactionId, int64_t objectStoreId
, const IDBKey* primaryKey, const Vector<int64_t> indexIds, const HeapVector<IDB
ObjectStore::IndexKeys>& indexKeys) |
| 95 { |
| 96 #if 0 |
| 97 Vector<int64_t> idCopy(indexIds); |
| 98 m_database->SetIndexKeys(transactionId, objectStoreId, createKey(primaryKey)
, std::move(idCopy), indexKeys); |
| 99 #endif |
| 100 } |
| 101 |
| 102 void IDBDatabaseProxy::SetIndexesReady(int64_t transactionId, int64_t objectStor
eId, const Vector<int64_t> indexIds) |
| 103 { |
| 104 Vector<int64_t> indexCopy(indexIds); |
| 105 m_database->SetIndexesReady(transactionId, objectStoreId, std::move(indexCop
y)); |
| 106 } |
| 107 |
| 108 void IDBDatabaseProxy::OpenCursor(int64_t transactionId, int64_t objectStoreId,
int64_t indexId, const IDBKeyRange* keyRange, indexed_db::mojom::blink::CursorDi
rection direction, bool keyOnly, indexed_db::mojom::blink::TaskType taskType) |
| 109 { |
| 110 m_database->OpenCursor(transactionId, objectStoreId, indexId, createKeyRange
(keyRange), direction, keyOnly, taskType); |
| 111 } |
| 112 |
| 113 void IDBDatabaseProxy::Count(int64_t transactionId, int64_t objectStoreId, int64
_t indexId, const IDBKeyRange* keyRange) |
| 114 { |
| 115 m_database->Count(transactionId, objectStoreId, indexId, createKeyRange(keyR
ange)); |
| 116 } |
| 117 |
| 118 void IDBDatabaseProxy::AckReceivedBlobs(const Vector<WTF::String> uuids) |
| 119 { |
| 120 Vector<WTF::String> uuidsCopy(uuids); |
| 121 m_database->AckReceivedBlobs(std::move(uuidsCopy)); |
| 122 } |
| 123 |
| 124 } // namespace blink |
OLD | NEW |