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

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

Issue 11567029: Proxy new objectstore/index methods through IPC (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years 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_webidbdatabase_impl.h" 5 #include "content/common/indexed_db/proxy_webidbdatabase_impl.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "content/common/child_thread.h" 9 #include "content/common/child_thread.h"
10 #include "content/common/indexed_db/indexed_db_messages.h" 10 #include "content/common/indexed_db/indexed_db_messages.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 return NULL; 144 return NULL;
145 return new RendererWebIDBTransactionImpl(ipc_transaction_id); 145 return new RendererWebIDBTransactionImpl(ipc_transaction_id);
146 } 146 }
147 147
148 void RendererWebIDBDatabaseImpl::close() { 148 void RendererWebIDBDatabaseImpl::close() {
149 IndexedDBDispatcher* dispatcher = 149 IndexedDBDispatcher* dispatcher =
150 IndexedDBDispatcher::ThreadSpecificInstance(); 150 IndexedDBDispatcher::ThreadSpecificInstance();
151 dispatcher->RequestIDBDatabaseClose(ipc_database_id_); 151 dispatcher->RequestIDBDatabaseClose(ipc_database_id_);
152 } 152 }
153 153
154 void RendererWebIDBDatabaseImpl::get(
155 long long transaction_id,
156 long long object_store_id,
157 long long index_id,
158 const WebKit::WebIDBKeyRange& key_range,
159 bool key_only,
160 WebIDBCallbacks* callbacks) {
161 IndexedDBDispatcher* dispatcher =
162 IndexedDBDispatcher::ThreadSpecificInstance();
163 dispatcher->RequestIDBDatabaseGet(
164 transaction_id, ipc_database_id_, object_store_id, index_id,
165 IndexedDBKeyRange(key_range), key_only, callbacks);
166 }
167
168 void RendererWebIDBDatabaseImpl::put(
169 long long transaction_id,
170 long long object_store_id,
171 const WebVector<unsigned char>& value,
172 const WebKit::WebIDBKey& key,
173 PutMode put_mode,
174 WebIDBCallbacks* callbacks,
175 const WebVector<long long>& web_index_ids,
176 const WebVector<WebIndexKeys>& web_index_keys) {
177 IndexedDBDispatcher* dispatcher =
178 IndexedDBDispatcher::ThreadSpecificInstance();
179 dispatcher->RequestIDBDatabasePut(
180 transaction_id, ipc_database_id_, object_store_id,
181 value, IndexedDBKey(key), put_mode, callbacks,
182 web_index_ids, web_index_keys);
183 }
184
185 void RendererWebIDBDatabaseImpl::setIndexKeys(
186 long long transaction_id,
187 long long object_store_id,
188 const WebKit::WebIDBKey& primary_key,
189 const WebVector<long long>& index_ids,
190 const WebVector<WebIndexKeys>& index_keys) {
191 IndexedDBHostMsg_DatabaseSetIndexKeys_Params params;
192 params.ipc_database_id = ipc_database_id_;
193 params.transaction_id = transaction_id;
194 params.object_store_id = object_store_id;
195 params.primary_key = IndexedDBKey(primary_key);
196 params.index_ids.resize(index_ids.size());
197 for (size_t i = 0; i < index_ids.size(); ++i) {
198 params.index_ids[i] = index_ids[i];
199 }
200
201 params.index_keys.resize(index_keys.size());
202 for (size_t i = 0; i < index_keys.size(); ++i) {
203 params.index_keys[i].resize(index_keys[i].size());
204 for (size_t j = 0; j < index_keys[i].size(); ++j) {
205 params.index_keys[i][j] = content::IndexedDBKey(index_keys[i][j]);
206 }
207 }
208 IndexedDBDispatcher::Send(new IndexedDBHostMsg_DatabaseSetIndexKeys(
209 params));
210 }
211
212 void RendererWebIDBDatabaseImpl::setIndexesReady(
213 long long transaction_id,
214 long long object_store_id,
215 const WebVector<long long>& web_index_ids) {
216 std::vector<int64> index_ids(web_index_ids.size());
217 for (size_t i = 0; i < web_index_ids.size(); ++i) {
218 index_ids[i] = web_index_ids[i];
219 }
220 IndexedDBDispatcher::Send(new IndexedDBHostMsg_DatabaseSetIndexesReady(
221 ipc_database_id_, transaction_id, object_store_id, index_ids));
222 }
223
224 void RendererWebIDBDatabaseImpl::openCursor(
225 long long transaction_id,
226 long long object_store_id,
227 long long index_id,
228 const WebKit::WebIDBKeyRange& key_range,
229 unsigned short direction,
230 bool key_only,
231 TaskType task_type,
232 WebIDBCallbacks* callbacks) {
233 IndexedDBDispatcher* dispatcher =
234 IndexedDBDispatcher::ThreadSpecificInstance();
235 dispatcher->RequestIDBDatabaseOpenCursor(
236 ipc_database_id_,
237 transaction_id, object_store_id, index_id,
238 IndexedDBKeyRange(key_range), direction, key_only, task_type, callbacks);
239 }
240
241 void RendererWebIDBDatabaseImpl::count(
242 long long transaction_id,
243 long long object_store_id,
244 long long index_id,
245 const WebKit::WebIDBKeyRange& key_range,
246 WebIDBCallbacks* callbacks) {
247 IndexedDBDispatcher* dispatcher =
248 IndexedDBDispatcher::ThreadSpecificInstance();
249 dispatcher->RequestIDBDatabaseCount(
250 ipc_database_id_,
251 transaction_id, object_store_id, index_id,
252 IndexedDBKeyRange(key_range), callbacks);
253 }
254
255 void RendererWebIDBDatabaseImpl::deleteRange(
256 long long transaction_id,
257 long long object_store_id,
258 const WebKit::WebIDBKeyRange& key_range,
259 WebIDBCallbacks* callbacks) {
260 IndexedDBDispatcher* dispatcher =
261 IndexedDBDispatcher::ThreadSpecificInstance();
262 dispatcher->RequestIDBDatabaseDeleteRange(
263 ipc_database_id_,
264 transaction_id, object_store_id,
265 IndexedDBKeyRange(key_range), callbacks);
266 }
267
268 void RendererWebIDBDatabaseImpl::clear(
269 long long transaction_id,
270 long long object_store_id,
271 WebIDBCallbacks* callbacks) {
272 IndexedDBDispatcher* dispatcher =
273 IndexedDBDispatcher::ThreadSpecificInstance();
274 dispatcher->RequestIDBDatabaseClear(
275 ipc_database_id_,
276 transaction_id, object_store_id, callbacks);
277 }
154 } // namespace content 278 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698