OLD | NEW |
| (Empty) |
1 // Copyright 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_CHILD_INDEXED_DB_WEBIDBDATABASE_IMPL_H_ | |
6 #define CONTENT_CHILD_INDEXED_DB_WEBIDBDATABASE_IMPL_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include "base/memory/ref_counted.h" | |
11 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBCursor.h" | |
12 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabase.h" | |
13 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h" | |
14 | |
15 namespace blink { | |
16 class WebBlobInfo; | |
17 class WebIDBCallbacks; | |
18 class WebIDBDatabaseCallbacks; | |
19 class WebIDBObserver; | |
20 class WebString; | |
21 } | |
22 | |
23 namespace content { | |
24 class ThreadSafeSender; | |
25 | |
26 class WebIDBDatabaseImpl : public blink::WebIDBDatabase { | |
27 public: | |
28 WebIDBDatabaseImpl(int32_t ipc_database_id, | |
29 int32_t ipc_database_callbacks_id, | |
30 ThreadSafeSender* thread_safe_sender); | |
31 ~WebIDBDatabaseImpl() override; | |
32 | |
33 // blink::WebIDBDatabase | |
34 void createObjectStore(long long transaction_id, | |
35 long long objectstore_id, | |
36 const blink::WebString& name, | |
37 const blink::WebIDBKeyPath& key_path, | |
38 bool auto_increment) override; | |
39 void deleteObjectStore(long long transaction_id, | |
40 long long object_store_id) override; | |
41 void createTransaction(long long transaction_id, | |
42 blink::WebIDBDatabaseCallbacks* callbacks, | |
43 const blink::WebVector<long long>& scope, | |
44 blink::WebIDBTransactionMode mode) override; | |
45 | |
46 void close() override; | |
47 void versionChangeIgnored() override; | |
48 | |
49 int32_t addObserver(std::unique_ptr<blink::WebIDBObserver>, | |
50 long long transactionId) override; | |
51 bool containsObserverId(int32_t id) const override; | |
52 void removeObservers( | |
53 const std::vector<int32_t>& observer_ids_to_remove) override; | |
54 | |
55 void get(long long transactionId, | |
56 long long objectStoreId, | |
57 long long indexId, | |
58 const blink::WebIDBKeyRange&, | |
59 bool keyOnly, | |
60 blink::WebIDBCallbacks*) override; | |
61 void getAll(long long transactionId, | |
62 long long objectStoreId, | |
63 long long indexId, | |
64 const blink::WebIDBKeyRange&, | |
65 long long maxCount, | |
66 bool keyOnly, | |
67 blink::WebIDBCallbacks*) override; | |
68 void put(long long transactionId, | |
69 long long objectStoreId, | |
70 const blink::WebData& value, | |
71 const blink::WebVector<blink::WebBlobInfo>& webBlobInfo, | |
72 const blink::WebIDBKey&, | |
73 blink::WebIDBPutMode, | |
74 blink::WebIDBCallbacks*, | |
75 const blink::WebVector<long long>& indexIds, | |
76 const blink::WebVector<WebIndexKeys>&) override; | |
77 void setIndexKeys(long long transactionId, | |
78 long long objectStoreId, | |
79 const blink::WebIDBKey&, | |
80 const blink::WebVector<long long>& indexIds, | |
81 const blink::WebVector<WebIndexKeys>&) override; | |
82 void setIndexesReady(long long transactionId, | |
83 long long objectStoreId, | |
84 const blink::WebVector<long long>& indexIds) override; | |
85 void openCursor(long long transactionId, | |
86 long long objectStoreId, | |
87 long long indexId, | |
88 const blink::WebIDBKeyRange&, | |
89 blink::WebIDBCursorDirection direction, | |
90 bool keyOnly, | |
91 blink::WebIDBTaskType, | |
92 blink::WebIDBCallbacks*) override; | |
93 void count(long long transactionId, | |
94 long long objectStoreId, | |
95 long long indexId, | |
96 const blink::WebIDBKeyRange&, | |
97 blink::WebIDBCallbacks*) override; | |
98 void deleteRange(long long transactionId, | |
99 long long objectStoreId, | |
100 const blink::WebIDBKeyRange&, | |
101 blink::WebIDBCallbacks*) override; | |
102 void clear(long long transactionId, | |
103 long long objectStoreId, | |
104 blink::WebIDBCallbacks*) override; | |
105 void createIndex(long long transactionId, | |
106 long long objectStoreId, | |
107 long long indexId, | |
108 const blink::WebString& name, | |
109 const blink::WebIDBKeyPath&, | |
110 bool unique, | |
111 bool multiEntry) override; | |
112 void deleteIndex(long long transactionId, | |
113 long long objectStoreId, | |
114 long long indexId) override; | |
115 void abort(long long transaction_id) override; | |
116 void commit(long long transaction_id) override; | |
117 void ackReceivedBlobs( | |
118 const blink::WebVector<blink::WebString>& uuids) override; | |
119 | |
120 private: | |
121 int32_t ipc_database_id_; | |
122 int32_t ipc_database_callbacks_id_; | |
123 std::set<int32_t> observer_ids_; | |
124 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | |
125 }; | |
126 | |
127 } // namespace content | |
128 | |
129 #endif // CONTENT_CHILD_INDEXED_DB_WEBIDBDATABASE_IMPL_H_ | |
OLD | NEW |