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

Side by Side Diff: content/common/indexed_db/indexed_db_dispatcher.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/indexed_db_dispatcher.h" 5 #include "content/common/indexed_db/indexed_db_dispatcher.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/threading/thread_local.h" 8 #include "base/threading/thread_local.h"
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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 298
299 void IndexedDBDispatcher::RequestIDBDatabaseClose(int32 ipc_database_id) { 299 void IndexedDBDispatcher::RequestIDBDatabaseClose(int32 ipc_database_id) {
300 ResetCursorPrefetchCaches(); 300 ResetCursorPrefetchCaches();
301 Send(new IndexedDBHostMsg_DatabaseClose(ipc_database_id)); 301 Send(new IndexedDBHostMsg_DatabaseClose(ipc_database_id));
302 // There won't be pending database callbacks if the transaction was aborted in 302 // There won't be pending database callbacks if the transaction was aborted in
303 // the initial upgradeneeded event handler. 303 // the initial upgradeneeded event handler.
304 if (pending_database_callbacks_.Lookup(ipc_database_id)) 304 if (pending_database_callbacks_.Lookup(ipc_database_id))
305 pending_database_callbacks_.Remove(ipc_database_id); 305 pending_database_callbacks_.Remove(ipc_database_id);
306 } 306 }
307 307
308 void IndexedDBDispatcher::RequestIDBDatabaseGet(
309 int32 ipc_database_id,
310 int64 transaction_id,
311 int64 object_store_id,
312 int64 index_id,
313 const IndexedDBKeyRange& key_range,
314 bool key_only,
315 WebIDBCallbacks* callbacks) {
316 ResetCursorPrefetchCaches();
317 IndexedDBHostMsg_DatabaseGet_Params params;
318 init_params(params, callbacks);
319 params.ipc_database_id = ipc_database_id;
320 params.transaction_id = transaction_id;
321 params.object_store_id = object_store_id;
322 params.index_id = index_id;
323 params.key_range = key_range;
324 params.key_only = key_only;
325 Send(new IndexedDBHostMsg_DatabaseGet(params));
326 }
327
328
329 void IndexedDBDispatcher::RequestIDBDatabasePut(
330 int32 ipc_database_id,
331 int64 transaction_id,
332 int64 object_store_id,
333 const WebKit::WebVector<unsigned char>& value,
334 const IndexedDBKey& key,
335 WebKit::WebIDBDatabase::PutMode put_mode,
336 WebKit::WebIDBCallbacks* callbacks,
337 const WebKit::WebVector<long long>& index_ids,
338 const WebKit::WebVector<WebKit::WebVector<
339 WebKit::WebIDBKey> >& index_keys) {
340 ResetCursorPrefetchCaches();
341 IndexedDBHostMsg_DatabasePut_Params params;
342 init_params(params, callbacks);
343 params.ipc_database_id = ipc_database_id;
344 params.transaction_id = transaction_id;
345 params.object_store_id = object_store_id;
346
347 params.value.resize(value.size());
348 for (size_t i = 0; i < value.size(); ++i) {
349 params.value[i] = value[i];
350 }
351 params.key = key;
352 params.put_mode = put_mode;
353
354 params.index_ids.resize(index_ids.size());
355 for (size_t i = 0; i < index_ids.size(); ++i) {
356 params.index_ids[i] = index_ids[i];
357 }
358
359 params.index_keys.resize(index_keys.size());
360 for (size_t i = 0; i < index_keys.size(); ++i) {
361 params.index_keys[i].resize(index_keys[i].size());
362 for (size_t j = 0; j < index_keys[i].size(); ++j) {
363 params.index_keys[i][j] = IndexedDBKey(index_keys[i][j]);
364 }
365 }
366 Send(new IndexedDBHostMsg_DatabasePut(params));
367 }
368
369 void IndexedDBDispatcher::RequestIDBDatabaseOpenCursor(
370 int32 ipc_database_id,
371 int64 object_store_id,
372 int64 transaction_id,
373 int64 index_id,
374 const IndexedDBKeyRange& key_range,
375 unsigned short direction,
376 bool key_only,
377 WebKit::WebIDBDatabase::TaskType task_type,
378 WebIDBCallbacks* callbacks) {
379 ResetCursorPrefetchCaches();
380 IndexedDBHostMsg_DatabaseOpenCursor_Params params;
381 init_params(params, callbacks);
382 params.ipc_database_id = ipc_database_id;
383 params.transaction_id = transaction_id;
384 params.object_store_id = object_store_id;
385 params.index_id = index_id;
386 params.key_range = IndexedDBKeyRange(key_range);
387 params.direction = direction;
388 params.key_only = key_only;
389 params.task_type = task_type;
390 Send(new IndexedDBHostMsg_DatabaseOpenCursor(params));
391 }
392
393 void IndexedDBDispatcher::RequestIDBDatabaseCount(
394 int32 ipc_database_id,
395 int64 transaction_id,
396 int64 object_store_id,
397 int64 index_id,
398 const IndexedDBKeyRange& key_range,
399 WebKit::WebIDBCallbacks* callbacks) {
400 ResetCursorPrefetchCaches();
401 IndexedDBHostMsg_DatabaseCount_Params params;
402 init_params(params, callbacks);
403 params.ipc_database_id = ipc_database_id;
404 params.transaction_id = transaction_id;
405 params.object_store_id = transaction_id;
406 params.index_id = index_id;
407 params.key_range = IndexedDBKeyRange(key_range);
408 Send(new IndexedDBHostMsg_DatabaseCount(params));
409 }
410
411 void IndexedDBDispatcher::RequestIDBDatabaseDeleteRange(
412 int32 ipc_database_id,
413 int64 transaction_id,
414 int64 object_store_id,
415 const IndexedDBKeyRange& key_range,
416 WebKit::WebIDBCallbacks* callbacks)
417 {
418 IndexedDBHostMsg_DatabaseDeleteRange_Params params;
419 init_params(params, callbacks);
420 params.ipc_database_id = ipc_database_id;
421 params.transaction_id = transaction_id;
422 params.object_store_id = object_store_id;
423 params.key_range = key_range;
424 Send(new IndexedDBHostMsg_DatabaseDeleteRange(params));
425 }
426
427 void IndexedDBDispatcher::RequestIDBDatabaseClear(
428 int32 ipc_database_id,
429 int64 transaction_id,
430 int64 object_store_id,
431 WebKit::WebIDBCallbacks* callbacks_ptr) {
432 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
433 int32 ipc_response_id = pending_callbacks_.Add(callbacks.release());
434 Send(new IndexedDBHostMsg_DatabaseClear(
435 CurrentWorkerId(), ipc_response_id, ipc_database_id,
436 transaction_id, object_store_id));
437 }
438
308 void IndexedDBDispatcher::RequestIDBIndexOpenObjectCursor( 439 void IndexedDBDispatcher::RequestIDBIndexOpenObjectCursor(
309 const WebIDBKeyRange& idb_key_range, 440 const WebIDBKeyRange& idb_key_range,
310 unsigned short direction, 441 unsigned short direction,
311 WebIDBCallbacks* callbacks_ptr, 442 WebIDBCallbacks* callbacks_ptr,
312 int32 ipc_index_id, 443 int32 ipc_index_id,
313 const WebIDBTransaction& transaction, 444 const WebIDBTransaction& transaction,
314 WebExceptionCode* ec) { 445 WebExceptionCode* ec) {
315 ResetCursorPrefetchCaches(); 446 ResetCursorPrefetchCaches();
316 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); 447 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
317 IndexedDBHostMsg_IndexOpenCursor_Params params; 448 IndexedDBHostMsg_IndexOpenCursor_Params params;
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 int32 ipc_exception_cursor_id) { 913 int32 ipc_exception_cursor_id) {
783 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator; 914 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator;
784 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { 915 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) {
785 if (i->first == ipc_exception_cursor_id) 916 if (i->first == ipc_exception_cursor_id)
786 continue; 917 continue;
787 i->second->ResetPrefetchCache(); 918 i->second->ResetPrefetchCache();
788 } 919 }
789 } 920 }
790 921
791 } // namespace content 922 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698