Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(838)

Side by Side Diff: content/common/indexed_db/proxy_webidbobjectstore_impl.cc

Issue 11312178: Remove legacy IDB backend IPC glue for string-based references. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/indexed_db/proxy_webidbobjectstore_impl.h" 5 #include "content/common/indexed_db/proxy_webidbobjectstore_impl.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "content/common/indexed_db/indexed_db_messages.h" 9 #include "content/common/indexed_db/indexed_db_messages.h"
10 #include "content/public/common/serialized_script_value.h" 10 #include "content/public/common/serialized_script_value.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 WebIDBCallbacks* callbacks, 55 WebIDBCallbacks* callbacks,
56 const WebIDBTransaction& transaction, 56 const WebIDBTransaction& transaction,
57 WebExceptionCode& ec) { 57 WebExceptionCode& ec) {
58 IndexedDBDispatcher* dispatcher = 58 IndexedDBDispatcher* dispatcher =
59 IndexedDBDispatcher::ThreadSpecificInstance(); 59 IndexedDBDispatcher::ThreadSpecificInstance();
60 dispatcher->RequestIDBObjectStoreGet( 60 dispatcher->RequestIDBObjectStoreGet(
61 IndexedDBKeyRange(key_range), callbacks, 61 IndexedDBKeyRange(key_range), callbacks,
62 object_store_ipc_id_, transaction, &ec); 62 object_store_ipc_id_, transaction, &ec);
63 } 63 }
64 64
65 void RendererWebIDBObjectStoreImpl::putWithIndexKeys(
66 const WebSerializedScriptValue& value,
67 const WebIDBKey& key,
68 PutMode put_mode,
69 WebIDBCallbacks* callbacks,
70 const WebIDBTransaction& transaction,
71 const WebVector<WebString>& index_names,
72 const WebVector<WebVector<WebIDBKey> >& index_keys,
73 WebExceptionCode& ec) {
74 IndexedDBDispatcher* dispatcher =
75 IndexedDBDispatcher::ThreadSpecificInstance();
76 dispatcher->RequestIDBObjectStorePut(
77 SerializedScriptValue(value), IndexedDBKey(key),
78 put_mode, callbacks, object_store_ipc_id_, transaction,
79 index_names, index_keys, &ec);
80 }
81
82 void RendererWebIDBObjectStoreImpl::put( 65 void RendererWebIDBObjectStoreImpl::put(
83 const WebSerializedScriptValue& value, 66 const WebSerializedScriptValue& value,
84 const WebIDBKey& key, 67 const WebIDBKey& key,
85 PutMode put_mode, 68 PutMode put_mode,
86 WebIDBCallbacks* callbacks, 69 WebIDBCallbacks* callbacks,
87 const WebIDBTransaction& transaction, 70 const WebIDBTransaction& transaction,
88 const WebVector<long long>& index_ids, 71 const WebVector<long long>& index_ids,
89 const WebVector<WebVector<WebIDBKey> >& index_keys) { 72 const WebVector<WebVector<WebIDBKey> >& index_keys) {
90 IndexedDBDispatcher* dispatcher = 73 IndexedDBDispatcher* dispatcher =
91 IndexedDBDispatcher::ThreadSpecificInstance(); 74 IndexedDBDispatcher::ThreadSpecificInstance();
92 dispatcher->RequestIDBObjectStorePut( 75 dispatcher->RequestIDBObjectStorePut(
93 SerializedScriptValue(value), IndexedDBKey(key), 76 SerializedScriptValue(value), IndexedDBKey(key),
94 put_mode, callbacks, object_store_ipc_id_, transaction, 77 put_mode, callbacks, object_store_ipc_id_, transaction,
95 index_ids, index_keys); 78 index_ids, index_keys);
96 } 79 }
97 80
98 void RendererWebIDBObjectStoreImpl::setIndexKeys( 81 void RendererWebIDBObjectStoreImpl::setIndexKeys(
99 const WebKit::WebIDBKey& primaryKey, 82 const WebKit::WebIDBKey& primaryKey,
100 const WebKit::WebVector<WebKit::WebString>& index_names,
101 const WebKit::WebVector<WebIndexKeys>& index_keys,
102 const WebKit::WebIDBTransaction& transaction) {
103 std::vector<string16> index_names_list(index_names.size());
104 for (size_t i = 0; i < index_names.size(); ++i) {
105 index_names_list[i] = index_names[i];
106 }
107
108 std::vector<std::vector<content::IndexedDBKey> >
109 index_keys_list(index_keys.size());
110 for (size_t i = 0; i < index_keys.size(); ++i) {
111 index_keys_list[i].resize(index_keys[i].size());
112 for (size_t j = 0; j < index_keys[i].size(); ++j) {
113 index_keys_list[i][j] = content::IndexedDBKey(index_keys[i][j]);
114 }
115 }
116 IndexedDBDispatcher::Send(new IndexedDBHostMsg_ObjectStoreSetIndexKeysOld(
117 object_store_ipc_id_,
118 IndexedDBKey(primaryKey),
119 index_names_list,
120 index_keys_list,
121 IndexedDBDispatcher::TransactionId(transaction)));
122 }
123
124 void RendererWebIDBObjectStoreImpl::setIndexKeys(
125 const WebKit::WebIDBKey& primaryKey,
126 const WebKit::WebVector<long long>& index_ids, 83 const WebKit::WebVector<long long>& index_ids,
127 const WebKit::WebVector<WebIndexKeys>& index_keys, 84 const WebKit::WebVector<WebIndexKeys>& index_keys,
128 const WebKit::WebIDBTransaction& transaction) { 85 const WebKit::WebIDBTransaction& transaction) {
129 std::vector<int64> index_ids_list(index_ids.size()); 86 std::vector<int64> index_ids_list(index_ids.size());
130 for (size_t i = 0; i < index_ids.size(); ++i) { 87 for (size_t i = 0; i < index_ids.size(); ++i) {
131 index_ids_list[i] = index_ids[i]; 88 index_ids_list[i] = index_ids[i];
132 } 89 }
133 90
134 std::vector<std::vector<content::IndexedDBKey> > 91 std::vector<std::vector<content::IndexedDBKey> >
135 index_keys_list(index_keys.size()); 92 index_keys_list(index_keys.size());
136 for (size_t i = 0; i < index_keys.size(); ++i) { 93 for (size_t i = 0; i < index_keys.size(); ++i) {
137 index_keys_list[i].resize(index_keys[i].size()); 94 index_keys_list[i].resize(index_keys[i].size());
138 for (size_t j = 0; j < index_keys[i].size(); ++j) { 95 for (size_t j = 0; j < index_keys[i].size(); ++j) {
139 index_keys_list[i][j] = content::IndexedDBKey(index_keys[i][j]); 96 index_keys_list[i][j] = content::IndexedDBKey(index_keys[i][j]);
140 } 97 }
141 } 98 }
142 IndexedDBDispatcher::Send(new IndexedDBHostMsg_ObjectStoreSetIndexKeys( 99 IndexedDBDispatcher::Send(new IndexedDBHostMsg_ObjectStoreSetIndexKeys(
143 object_store_ipc_id_, 100 object_store_ipc_id_,
144 IndexedDBKey(primaryKey), 101 IndexedDBKey(primaryKey),
145 index_ids_list, 102 index_ids_list,
146 index_keys_list, 103 index_keys_list,
147 IndexedDBDispatcher::TransactionId(transaction))); 104 IndexedDBDispatcher::TransactionId(transaction)));
148 } 105 }
149 106
150 void RendererWebIDBObjectStoreImpl::setIndexesReady( 107 void RendererWebIDBObjectStoreImpl::setIndexesReady(
151 const WebKit::WebVector<WebKit::WebString>& index_names,
152 const WebKit::WebIDBTransaction& transaction) {
153
154 std::vector<string16> index_name_list(index_names.size());
155 for (size_t i = 0; i < index_names.size(); ++i) {
156 index_name_list[i] = index_names[i];
157 }
158
159 IndexedDBDispatcher::Send(new IndexedDBHostMsg_ObjectStoreSetIndexesReadyOld(
160 object_store_ipc_id_,
161 index_name_list, IndexedDBDispatcher::TransactionId(transaction)));
162 }
163
164 void RendererWebIDBObjectStoreImpl::setIndexesReady(
165 const WebKit::WebVector<long long>& index_ids, 108 const WebKit::WebVector<long long>& index_ids,
166 const WebKit::WebIDBTransaction& transaction) { 109 const WebKit::WebIDBTransaction& transaction) {
167 110
168 std::vector<int64> index_id_list(index_ids.size()); 111 std::vector<int64> index_id_list(index_ids.size());
169 for (size_t i = 0; i < index_ids.size(); ++i) { 112 for (size_t i = 0; i < index_ids.size(); ++i) {
170 index_id_list[i] = index_ids[i]; 113 index_id_list[i] = index_ids[i];
171 } 114 }
172 115
173 IndexedDBDispatcher::Send(new IndexedDBHostMsg_ObjectStoreSetIndexesReady( 116 IndexedDBDispatcher::Send(new IndexedDBHostMsg_ObjectStoreSetIndexesReady(
174 object_store_ipc_id_, 117 object_store_ipc_id_,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 159
217 int32 index_id; 160 int32 index_id;
218 IndexedDBDispatcher::Send( 161 IndexedDBDispatcher::Send(
219 new IndexedDBHostMsg_ObjectStoreCreateIndex(params, &index_id, &ec)); 162 new IndexedDBHostMsg_ObjectStoreCreateIndex(params, &index_id, &ec));
220 if (!index_id) 163 if (!index_id)
221 return NULL; 164 return NULL;
222 return new RendererWebIDBIndexImpl(index_id); 165 return new RendererWebIDBIndexImpl(index_id);
223 } 166 }
224 167
225 WebIDBIndex* RendererWebIDBObjectStoreImpl::index( 168 WebIDBIndex* RendererWebIDBObjectStoreImpl::index(
226 const WebString& name,
227 WebExceptionCode& ec) {
228 int32 idb_index_id;
229 IndexedDBDispatcher::Send(
230 new IndexedDBHostMsg_ObjectStoreIndexOld(object_store_ipc_id_, name,
231 &idb_index_id, &ec));
232 if (!idb_index_id)
233 return NULL;
234 return new RendererWebIDBIndexImpl(idb_index_id);
235 }
236
237 WebIDBIndex* RendererWebIDBObjectStoreImpl::index(
238 const long long index_id) { 169 const long long index_id) {
239 int32 idb_index_id; 170 int32 idb_index_id;
240 IndexedDBDispatcher::Send( 171 IndexedDBDispatcher::Send(
241 new IndexedDBHostMsg_ObjectStoreIndex(object_store_ipc_id_, index_id, 172 new IndexedDBHostMsg_ObjectStoreIndex(object_store_ipc_id_, index_id,
242 &idb_index_id)); 173 &idb_index_id));
243 if (!idb_index_id) 174 if (!idb_index_id)
244 return NULL; 175 return NULL;
245 return new RendererWebIDBIndexImpl(idb_index_id); 176 return new RendererWebIDBIndexImpl(idb_index_id);
246 } 177 }
247 178
248 void RendererWebIDBObjectStoreImpl::deleteIndex( 179 void RendererWebIDBObjectStoreImpl::deleteIndex(
249 const WebString& name,
250 const WebIDBTransaction& transaction,
251 WebExceptionCode& ec) {
252 IndexedDBDispatcher::Send(
253 new IndexedDBHostMsg_ObjectStoreDeleteIndexOld(
254 object_store_ipc_id_, name,
255 IndexedDBDispatcher::TransactionId(transaction), &ec));
256 }
257
258 void RendererWebIDBObjectStoreImpl::deleteIndex(
259 long long index_id, 180 long long index_id,
260 const WebIDBTransaction& transaction, 181 const WebIDBTransaction& transaction,
261 WebExceptionCode& ec) { 182 WebExceptionCode& ec) {
262 IndexedDBDispatcher::Send( 183 IndexedDBDispatcher::Send(
263 new IndexedDBHostMsg_ObjectStoreDeleteIndex( 184 new IndexedDBHostMsg_ObjectStoreDeleteIndex(
264 object_store_ipc_id_, index_id, 185 object_store_ipc_id_, index_id,
265 IndexedDBDispatcher::TransactionId(transaction), &ec)); 186 IndexedDBDispatcher::TransactionId(transaction), &ec));
266 } 187 }
267 188
268 void RendererWebIDBObjectStoreImpl::openCursor( 189 void RendererWebIDBObjectStoreImpl::openCursor(
(...skipping 15 matching lines...) Expand all
284 const WebIDBTransaction& transaction, 205 const WebIDBTransaction& transaction,
285 WebExceptionCode& ec) { 206 WebExceptionCode& ec) {
286 IndexedDBDispatcher* dispatcher = 207 IndexedDBDispatcher* dispatcher =
287 IndexedDBDispatcher::ThreadSpecificInstance(); 208 IndexedDBDispatcher::ThreadSpecificInstance();
288 dispatcher->RequestIDBObjectStoreCount( 209 dispatcher->RequestIDBObjectStoreCount(
289 idb_key_range, callbacks, object_store_ipc_id_, 210 idb_key_range, callbacks, object_store_ipc_id_,
290 transaction, &ec); 211 transaction, &ec);
291 } 212 }
292 213
293 } // namespace content 214 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698