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

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

Issue 10830228: Chromium glue for Preemptive cursors and passing keys from renderer to browser (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 4 months 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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 params.index_keys[i].resize(index_keys[i].size()); 441 params.index_keys[i].resize(index_keys[i].size());
442 for (size_t j = 0; j < index_keys[i].size(); ++j) { 442 for (size_t j = 0; j < index_keys[i].size(); ++j) {
443 params.index_keys[i][j] = content::IndexedDBKey(index_keys[i][j]); 443 params.index_keys[i][j] = content::IndexedDBKey(index_keys[i][j]);
444 } 444 }
445 } 445 }
446 Send(new IndexedDBHostMsg_ObjectStorePut(params, ec)); 446 Send(new IndexedDBHostMsg_ObjectStorePut(params, ec));
447 if (*ec) 447 if (*ec)
448 pending_callbacks_.Remove(params.response_id); 448 pending_callbacks_.Remove(params.response_id);
449 } 449 }
450 450
451 void IndexedDBDispatcher::RequestIDBObjectStoreSetIndexKeys(
452 int32 idb_object_store_id,
453 const IndexedDBKey& primary_key,
454 const WebKit::WebVector<WebKit::WebString>& web_index_names,
455 const WebKit::WebVector<WebKit::WebVector<WebKit::WebIDBKey> >&
456 web_index_keys,
457 const WebKit::WebIDBTransaction& transaction) {
458
459 std::vector<string16> index_names(web_index_names.size());
dgrogan 2012/08/08 23:02:50 It looks like you could move this code to the call
alecflett 2012/08/09 20:54:18 Done.
460 for (size_t i = 0; i < web_index_names.size(); ++i) {
461 index_names[i] = web_index_names[i];
462 }
463
464 std::vector<std::vector<content::IndexedDBKey> >
465 index_keys(web_index_keys.size());
466 for (size_t i = 0; i < web_index_keys.size(); ++i) {
467 index_keys[i].resize(web_index_keys[i].size());
468 for (size_t j = 0; j < web_index_keys[i].size(); ++j) {
469 index_keys[i][j] = content::IndexedDBKey(web_index_keys[i][j]);
470 }
471 }
472 Send(new IndexedDBHostMsg_ObjectStoreSetIndexKeys(
473 idb_object_store_id,
474 primary_key,
475 index_names,
476 index_keys,
477 TransactionId(transaction)));
478 }
479
480 void IndexedDBDispatcher::RequestIDBObjectStoreSetIndexesReady(
481 int32 idb_object_store_id,
482 const WebKit::WebVector<WebKit::WebString>& index_names,
483 const WebKit::WebIDBTransaction& transaction) {
484 std::vector<string16> index_name_list(index_names.size());
485 for (size_t i = 0; i < index_names.size(); ++i) {
486 index_name_list[i] = index_names[i];
487 }
488
489 Send(new IndexedDBHostMsg_ObjectStoreSetIndexesReady(
490 idb_object_store_id,
491 index_name_list, TransactionId(transaction)));
492 }
493
451 void IndexedDBDispatcher::RequestIDBObjectStoreDelete( 494 void IndexedDBDispatcher::RequestIDBObjectStoreDelete(
452 const IndexedDBKeyRange& key_range, 495 const IndexedDBKeyRange& key_range,
453 WebIDBCallbacks* callbacks_ptr, 496 WebIDBCallbacks* callbacks_ptr,
454 int32 idb_object_store_id, 497 int32 idb_object_store_id,
455 const WebIDBTransaction& transaction, 498 const WebIDBTransaction& transaction,
456 WebExceptionCode* ec) { 499 WebExceptionCode* ec) {
457 ResetCursorPrefetchCaches(); 500 ResetCursorPrefetchCaches();
458 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); 501 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
459 502
460 int32 response_id = pending_callbacks_.Add(callbacks.release()); 503 int32 response_id = pending_callbacks_.Add(callbacks.release());
(...skipping 15 matching lines...) Expand all
476 int32 response_id = pending_callbacks_.Add(callbacks.release()); 519 int32 response_id = pending_callbacks_.Add(callbacks.release());
477 Send(new IndexedDBHostMsg_ObjectStoreClear( 520 Send(new IndexedDBHostMsg_ObjectStoreClear(
478 idb_object_store_id, CurrentWorkerId(), response_id, 521 idb_object_store_id, CurrentWorkerId(), response_id,
479 TransactionId(transaction), ec)); 522 TransactionId(transaction), ec));
480 if (*ec) 523 if (*ec)
481 pending_callbacks_.Remove(response_id); 524 pending_callbacks_.Remove(response_id);
482 } 525 }
483 526
484 void IndexedDBDispatcher::RequestIDBObjectStoreOpenCursor( 527 void IndexedDBDispatcher::RequestIDBObjectStoreOpenCursor(
485 const WebIDBKeyRange& idb_key_range, 528 const WebIDBKeyRange& idb_key_range,
486 unsigned short direction, 529 WebKit::WebIDBCursor::Direction direction,
487 WebIDBCallbacks* callbacks_ptr, 530 WebIDBCallbacks* callbacks_ptr,
488 int32 idb_object_store_id, 531 int32 idb_object_store_id,
532 WebKit::WebIDBTransaction::TaskType task_type,
489 const WebIDBTransaction& transaction, 533 const WebIDBTransaction& transaction,
490 WebExceptionCode* ec) { 534 WebExceptionCode* ec) {
491 ResetCursorPrefetchCaches(); 535 ResetCursorPrefetchCaches();
492 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); 536 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
493 IndexedDBHostMsg_ObjectStoreOpenCursor_Params params; 537 IndexedDBHostMsg_ObjectStoreOpenCursor_Params params;
494 params.thread_id = CurrentWorkerId(); 538 params.thread_id = CurrentWorkerId();
495 params.response_id = pending_callbacks_.Add(callbacks.release()); 539 params.response_id = pending_callbacks_.Add(callbacks.release());
496 params.key_range = IndexedDBKeyRange(idb_key_range); 540 params.key_range = IndexedDBKeyRange(idb_key_range);
497 params.direction = direction; 541 params.direction = direction;
498 params.idb_object_store_id = idb_object_store_id; 542 params.idb_object_store_id = idb_object_store_id;
543 params.task_type = task_type;
499 params.transaction_id = TransactionId(transaction); 544 params.transaction_id = TransactionId(transaction);
500 Send(new IndexedDBHostMsg_ObjectStoreOpenCursor(params, ec)); 545 Send(new IndexedDBHostMsg_ObjectStoreOpenCursor(params, ec));
501 if (*ec) 546 if (*ec)
502 pending_callbacks_.Remove(params.response_id); 547 pending_callbacks_.Remove(params.response_id);
503 } 548 }
504 549
505 void IndexedDBDispatcher::RequestIDBObjectStoreCount( 550 void IndexedDBDispatcher::RequestIDBObjectStoreCount(
506 const WebIDBKeyRange& idb_key_range, 551 const WebIDBKeyRange& idb_key_range,
507 WebIDBCallbacks* callbacks_ptr, 552 WebIDBCallbacks* callbacks_ptr,
508 int32 idb_object_store_id, 553 int32 idb_object_store_id,
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 } 814 }
770 815
771 void IndexedDBDispatcher::ResetCursorPrefetchCaches(int32 exception_cursor_id) { 816 void IndexedDBDispatcher::ResetCursorPrefetchCaches(int32 exception_cursor_id) {
772 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator; 817 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator;
773 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { 818 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) {
774 if (i->first == exception_cursor_id) 819 if (i->first == exception_cursor_id)
775 continue; 820 continue;
776 i->second->ResetPrefetchCache(); 821 i->second->ResetPrefetchCache();
777 } 822 }
778 } 823 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698