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

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

Issue 11828054: Remove IPC code for old methods. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix merge conflicts Created 7 years, 11 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"
11 #include "content/common/indexed_db/proxy_webidbcursor_impl.h" 11 #include "content/common/indexed_db/proxy_webidbcursor_impl.h"
12 #include "content/common/indexed_db/proxy_webidbdatabase_impl.h" 12 #include "content/common/indexed_db/proxy_webidbdatabase_impl.h"
13 #include "content/common/indexed_db/proxy_webidbindex_impl.h"
14 #include "content/common/indexed_db/proxy_webidbobjectstore_impl.h"
15 #include "content/common/indexed_db/proxy_webidbtransaction_impl.h" 13 #include "content/common/indexed_db/proxy_webidbtransaction_impl.h"
16 #include "ipc/ipc_channel.h" 14 #include "ipc/ipc_channel.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseCallbac ks.h" 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseCallbac ks.h"
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseError.h " 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseError.h "
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseExcepti on.h" 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseExcepti on.h"
21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyRange.h" 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyRange.h"
22 20
23 using base::ThreadLocalPointer; 21 using base::ThreadLocalPointer;
24 using WebKit::WebDOMStringList; 22 using WebKit::WebDOMStringList;
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 int64 transaction_id, 426 int64 transaction_id,
429 int64 object_store_id, 427 int64 object_store_id,
430 WebKit::WebIDBCallbacks* callbacks_ptr) { 428 WebKit::WebIDBCallbacks* callbacks_ptr) {
431 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); 429 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
432 int32 ipc_response_id = pending_callbacks_.Add(callbacks.release()); 430 int32 ipc_response_id = pending_callbacks_.Add(callbacks.release());
433 Send(new IndexedDBHostMsg_DatabaseClear( 431 Send(new IndexedDBHostMsg_DatabaseClear(
434 CurrentWorkerId(), ipc_response_id, ipc_database_id, 432 CurrentWorkerId(), ipc_response_id, ipc_database_id,
435 transaction_id, object_store_id)); 433 transaction_id, object_store_id));
436 } 434 }
437 435
438 void IndexedDBDispatcher::RequestIDBIndexOpenObjectCursor(
439 const WebIDBKeyRange& idb_key_range,
440 unsigned short direction,
441 WebIDBCallbacks* callbacks_ptr,
442 int32 ipc_index_id,
443 const WebIDBTransaction& transaction,
444 WebExceptionCode* ec) {
445 ResetCursorPrefetchCaches();
446 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
447 IndexedDBHostMsg_IndexOpenCursor_Params params;
448 params.ipc_thread_id = CurrentWorkerId();
449 params.ipc_response_id = pending_callbacks_.Add(callbacks.release());
450 params.key_range = IndexedDBKeyRange(idb_key_range);
451 params.direction = direction;
452 params.ipc_index_id = ipc_index_id;
453 params.ipc_transaction_id = TransactionId(transaction);
454 Send(new IndexedDBHostMsg_IndexOpenObjectCursor(params));
455 }
456
457 void IndexedDBDispatcher::RequestIDBIndexOpenKeyCursor(
458 const WebIDBKeyRange& idb_key_range,
459 unsigned short direction,
460 WebIDBCallbacks* callbacks_ptr,
461 int32 ipc_index_id,
462 const WebIDBTransaction& transaction,
463 WebExceptionCode* ec) {
464 ResetCursorPrefetchCaches();
465 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
466 IndexedDBHostMsg_IndexOpenCursor_Params params;
467 params.ipc_thread_id = CurrentWorkerId();
468 params.ipc_response_id = pending_callbacks_.Add(callbacks.release());
469 params.key_range = IndexedDBKeyRange(idb_key_range);
470 params.direction = direction;
471 params.ipc_index_id = ipc_index_id;
472 params.ipc_transaction_id = TransactionId(transaction);
473 Send(new IndexedDBHostMsg_IndexOpenKeyCursor(params));
474 }
475
476 void IndexedDBDispatcher::RequestIDBIndexCount(
477 const WebIDBKeyRange& idb_key_range,
478 WebIDBCallbacks* callbacks_ptr,
479 int32 ipc_index_id,
480 const WebIDBTransaction& transaction,
481 WebExceptionCode* ec) {
482 ResetCursorPrefetchCaches();
483 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
484 IndexedDBHostMsg_IndexCount_Params params;
485 params.ipc_thread_id = CurrentWorkerId();
486 params.ipc_response_id = pending_callbacks_.Add(callbacks.release());
487 params.key_range = IndexedDBKeyRange(idb_key_range);
488 params.ipc_index_id = ipc_index_id;
489 params.ipc_transaction_id = TransactionId(transaction);
490 Send(new IndexedDBHostMsg_IndexCount(params));
491 }
492
493 void IndexedDBDispatcher::RequestIDBIndexGetObject(
494 const IndexedDBKeyRange& key_range,
495 WebIDBCallbacks* callbacks_ptr,
496 int32 ipc_index_id,
497 const WebIDBTransaction& transaction,
498 WebExceptionCode* ec) {
499 ResetCursorPrefetchCaches();
500 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
501 int32 ipc_response_id = pending_callbacks_.Add(callbacks.release());
502 Send(new IndexedDBHostMsg_IndexGetObject(
503 ipc_index_id, CurrentWorkerId(),
504 ipc_response_id, key_range,
505 TransactionId(transaction)));
506 }
507
508 void IndexedDBDispatcher::RequestIDBIndexGetKey(
509 const IndexedDBKeyRange& key_range,
510 WebIDBCallbacks* callbacks_ptr,
511 int32 ipc_index_id,
512 const WebIDBTransaction& transaction,
513 WebExceptionCode* ec) {
514 ResetCursorPrefetchCaches();
515 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
516 int32 ipc_response_id = pending_callbacks_.Add(callbacks.release());
517 Send(new IndexedDBHostMsg_IndexGetKey(
518 ipc_index_id, CurrentWorkerId(), ipc_response_id, key_range,
519 TransactionId(transaction)));
520 }
521
522 void IndexedDBDispatcher::RequestIDBObjectStoreGet(
523 const IndexedDBKeyRange& key_range,
524 WebIDBCallbacks* callbacks_ptr,
525 int32 ipc_object_store_id,
526 const WebIDBTransaction& transaction,
527 WebExceptionCode* ec) {
528 ResetCursorPrefetchCaches();
529 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
530
531 int32 ipc_response_id = pending_callbacks_.Add(callbacks.release());
532 Send(new IndexedDBHostMsg_ObjectStoreGet(
533 ipc_object_store_id, CurrentWorkerId(), ipc_response_id,
534 key_range, TransactionId(transaction)));
535 }
536
537 void IndexedDBDispatcher::RequestIDBObjectStorePut(
538 const SerializedScriptValue& value,
539 const IndexedDBKey& key,
540 WebKit::WebIDBObjectStore::PutMode put_mode,
541 WebIDBCallbacks* callbacks_ptr,
542 int32 ipc_object_store_id,
543 const WebIDBTransaction& transaction,
544 const WebKit::WebVector<long long>& index_ids,
545 const WebKit::WebVector<WebKit::WebVector<
546 WebKit::WebIDBKey> >& index_keys) {
547 ResetCursorPrefetchCaches();
548 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
549 IndexedDBHostMsg_ObjectStorePut_Params params;
550 params.ipc_thread_id = CurrentWorkerId();
551 params.ipc_object_store_id = ipc_object_store_id;
552 params.ipc_response_id = pending_callbacks_.Add(callbacks.release());
553 params.serialized_value = value;
554 params.key = key;
555 params.put_mode = put_mode;
556 params.ipc_transaction_id = TransactionId(transaction);
557 params.index_ids.resize(index_ids.size());
558 for (size_t i = 0; i < index_ids.size(); ++i) {
559 params.index_ids[i] = index_ids[i];
560 }
561
562 params.index_keys.resize(index_keys.size());
563 for (size_t i = 0; i < index_keys.size(); ++i) {
564 params.index_keys[i].resize(index_keys[i].size());
565 for (size_t j = 0; j < index_keys[i].size(); ++j) {
566 params.index_keys[i][j] = IndexedDBKey(index_keys[i][j]);
567 }
568 }
569 Send(new IndexedDBHostMsg_ObjectStorePut(params));
570 }
571
572 void IndexedDBDispatcher::RequestIDBObjectStoreDelete(
573 const IndexedDBKeyRange& key_range,
574 WebIDBCallbacks* callbacks_ptr,
575 int32 ipc_object_store_id,
576 const WebIDBTransaction& transaction,
577 WebExceptionCode* ec) {
578 ResetCursorPrefetchCaches();
579 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
580
581 int32 ipc_response_id = pending_callbacks_.Add(callbacks.release());
582 Send(new IndexedDBHostMsg_ObjectStoreDelete(
583 ipc_object_store_id, CurrentWorkerId(), ipc_response_id, key_range,
584 TransactionId(transaction)));
585 }
586
587 void IndexedDBDispatcher::RequestIDBObjectStoreClear(
588 WebIDBCallbacks* callbacks_ptr,
589 int32 ipc_object_store_id,
590 const WebIDBTransaction& transaction,
591 WebExceptionCode* ec) {
592 ResetCursorPrefetchCaches();
593 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
594
595 int32 ipc_response_id = pending_callbacks_.Add(callbacks.release());
596 Send(new IndexedDBHostMsg_ObjectStoreClear(
597 ipc_object_store_id, CurrentWorkerId(), ipc_response_id,
598 TransactionId(transaction)));
599 }
600
601 void IndexedDBDispatcher::RequestIDBObjectStoreOpenCursor(
602 const WebIDBKeyRange& idb_key_range,
603 WebKit::WebIDBCursor::Direction direction,
604 WebIDBCallbacks* callbacks_ptr,
605 int32 ipc_object_store_id,
606 WebKit::WebIDBTransaction::TaskType task_type,
607 const WebIDBTransaction& transaction,
608 WebExceptionCode* ec) {
609 ResetCursorPrefetchCaches();
610 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
611 IndexedDBHostMsg_ObjectStoreOpenCursor_Params params;
612 params.ipc_thread_id = CurrentWorkerId();
613 params.ipc_response_id = pending_callbacks_.Add(callbacks.release());
614 params.key_range = IndexedDBKeyRange(idb_key_range);
615 params.direction = direction;
616 params.ipc_object_store_id = ipc_object_store_id;
617 params.task_type = task_type;
618 params.ipc_transaction_id = TransactionId(transaction);
619 Send(new IndexedDBHostMsg_ObjectStoreOpenCursor(params));
620 }
621
622 void IndexedDBDispatcher::RequestIDBObjectStoreCount(
623 const WebIDBKeyRange& idb_key_range,
624 WebIDBCallbacks* callbacks_ptr,
625 int32 ipc_object_store_id,
626 const WebIDBTransaction& transaction,
627 WebExceptionCode* ec) {
628 ResetCursorPrefetchCaches();
629 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
630 IndexedDBHostMsg_ObjectStoreCount_Params params;
631 params.ipc_thread_id = CurrentWorkerId();
632 params.ipc_response_id = pending_callbacks_.Add(callbacks.release());
633 params.key_range = IndexedDBKeyRange(idb_key_range);
634 params.ipc_object_store_id = ipc_object_store_id;
635 params.ipc_transaction_id = TransactionId(transaction);
636 Send(new IndexedDBHostMsg_ObjectStoreCount(params));
637 }
638
639 void IndexedDBDispatcher::RegisterWebIDBTransactionCallbacks( 436 void IndexedDBDispatcher::RegisterWebIDBTransactionCallbacks(
640 WebIDBTransactionCallbacks* callbacks, 437 WebIDBTransactionCallbacks* callbacks,
641 int32 id) { 438 int32 id) {
642 pending_transaction_callbacks_.AddWithID(callbacks, id); 439 pending_transaction_callbacks_.AddWithID(callbacks, id);
643 } 440 }
644 441
645 void IndexedDBDispatcher::CursorDestroyed(int32 ipc_cursor_id) { 442 void IndexedDBDispatcher::CursorDestroyed(int32 ipc_cursor_id) {
646 cursors_.erase(ipc_cursor_id); 443 cursors_.erase(ipc_cursor_id);
647 } 444 }
648 445
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 int32 ipc_exception_cursor_id) { 709 int32 ipc_exception_cursor_id) {
913 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator; 710 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator;
914 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { 711 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) {
915 if (i->first == ipc_exception_cursor_id) 712 if (i->first == ipc_exception_cursor_id)
916 continue; 713 continue;
917 i->second->ResetPrefetchCache(); 714 i->second->ResetPrefetchCache();
918 } 715 }
919 } 716 }
920 717
921 } // namespace content 718 } // namespace content
OLDNEW
« no previous file with comments | « content/common/indexed_db/indexed_db_dispatcher.h ('k') | content/common/indexed_db/indexed_db_dispatcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698