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

Side by Side Diff: content/browser/in_process_webkit/indexed_db_dispatcher_host.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: Add crbug link 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/browser/in_process_webkit/indexed_db_dispatcher_host.h" 5 #include "content/browser/in_process_webkit/indexed_db_dispatcher_host.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 } 304 }
305 305
306 bool IndexedDBDispatcherHost::DatabaseDispatcherHost::OnMessageReceived( 306 bool IndexedDBDispatcherHost::DatabaseDispatcherHost::OnMessageReceived(
307 const IPC::Message& message, bool* msg_is_ok) { 307 const IPC::Message& message, bool* msg_is_ok) {
308 bool handled = true; 308 bool handled = true;
309 IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::DatabaseDispatcherHost, 309 IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::DatabaseDispatcherHost,
310 message, *msg_is_ok) 310 message, *msg_is_ok)
311 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseMetadata, OnMetadata) 311 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseMetadata, OnMetadata)
312 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseCreateObjectStore, 312 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseCreateObjectStore,
313 OnCreateObjectStore) 313 OnCreateObjectStore)
314 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDeleteObjectStoreOld,
315 OnDeleteObjectStoreOld)
316 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDeleteObjectStore, 314 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDeleteObjectStore,
317 OnDeleteObjectStore) 315 OnDeleteObjectStore)
318 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseSetVersion, OnSetVersion) 316 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseSetVersion, OnSetVersion)
319 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseTransactionOld,
320 OnTransactionOld)
321 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseTransaction, OnTransaction) 317 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseTransaction, OnTransaction)
322 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseClose, OnClose) 318 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseClose, OnClose)
323 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDestroyed, OnDestroyed) 319 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDestroyed, OnDestroyed)
324 IPC_MESSAGE_UNHANDLED(handled = false) 320 IPC_MESSAGE_UNHANDLED(handled = false)
325 IPC_END_MESSAGE_MAP() 321 IPC_END_MESSAGE_MAP()
326 return handled; 322 return handled;
327 } 323 }
328 324
329 void IndexedDBDispatcherHost::DatabaseDispatcherHost::Send( 325 void IndexedDBDispatcherHost::DatabaseDispatcherHost::Send(
330 IPC::Message* message) { 326 IPC::Message* message) {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 WebIDBObjectStore* object_store = idb_database->createObjectStore( 381 WebIDBObjectStore* object_store = idb_database->createObjectStore(
386 params.id, params.name, params.key_path, params.auto_increment, 382 params.id, params.name, params.key_path, params.auto_increment,
387 *idb_transaction, *ec); 383 *idb_transaction, *ec);
388 *object_store_id = *ec ? 0 : parent_->Add(object_store); 384 *object_store_id = *ec ? 0 : parent_->Add(object_store);
389 if (parent_->Context()->IsOverQuota( 385 if (parent_->Context()->IsOverQuota(
390 database_url_map_[params.idb_database_id])) { 386 database_url_map_[params.idb_database_id])) {
391 idb_transaction->abort(); 387 idb_transaction->abort();
392 } 388 }
393 } 389 }
394 390
395 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnDeleteObjectStoreOld(
396 int32 idb_database_id,
397 const string16& name,
398 int32 transaction_id,
399 WebKit::WebExceptionCode* ec) {
400 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
401 WebIDBDatabase* idb_database = parent_->GetOrTerminateProcess(
402 &map_, idb_database_id);
403 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
404 &parent_->transaction_dispatcher_host_->map_, transaction_id);
405 if (!idb_database || !idb_transaction)
406 return;
407
408 *ec = 0;
409 idb_database->deleteObjectStore(name, *idb_transaction, *ec);
410 }
411
412 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnDeleteObjectStore( 391 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnDeleteObjectStore(
413 int32 idb_database_id, 392 int32 idb_database_id,
414 int64 index_id, 393 int64 index_id,
415 int32 transaction_id, 394 int32 transaction_id,
416 WebKit::WebExceptionCode* ec) { 395 WebKit::WebExceptionCode* ec) {
417 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); 396 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
418 WebIDBDatabase* idb_database = parent_->GetOrTerminateProcess( 397 WebIDBDatabase* idb_database = parent_->GetOrTerminateProcess(
419 &map_, idb_database_id); 398 &map_, idb_database_id);
420 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 399 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
421 &parent_->transaction_dispatcher_host_->map_, transaction_id); 400 &parent_->transaction_dispatcher_host_->map_, transaction_id);
(...skipping 17 matching lines...) Expand all
439 return; 418 return;
440 419
441 *ec = 0; 420 *ec = 0;
442 idb_database->setVersion( 421 idb_database->setVersion(
443 version, 422 version,
444 new IndexedDBCallbacksTransaction(parent_, thread_id, response_id, 423 new IndexedDBCallbacksTransaction(parent_, thread_id, response_id,
445 database_url_map_[idb_database_id]), 424 database_url_map_[idb_database_id]),
446 *ec); 425 *ec);
447 } 426 }
448 427
449 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnTransactionOld(
450 int32 thread_id,
451 int32 idb_database_id,
452 const std::vector<string16>& names,
453 int32 mode,
454 int32* idb_transaction_id,
455 WebKit::WebExceptionCode* ec) {
456 WebIDBDatabase* database = parent_->GetOrTerminateProcess(
457 &map_, idb_database_id);
458 if (!database)
459 return;
460
461 WebDOMStringList object_stores;
462 for (std::vector<string16>::const_iterator it = names.begin();
463 it != names.end(); ++it) {
464 object_stores.append(*it);
465 }
466
467 *ec = 0;
468 WebIDBTransaction* transaction = database->transaction(
469 object_stores, mode, *ec);
470 DCHECK(!transaction != !*ec);
471 *idb_transaction_id =
472 *ec ? 0 : parent_->Add(transaction, thread_id,
473 database_url_map_[idb_database_id]);
474 }
475
476 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnTransaction( 428 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnTransaction(
477 int32 thread_id, 429 int32 thread_id,
478 int32 idb_database_id, 430 int32 idb_database_id,
479 const std::vector<int64>& object_store_ids, 431 const std::vector<int64>& object_store_ids,
480 int32 mode, 432 int32 mode,
481 int32* idb_transaction_id) { 433 int32* idb_transaction_id) {
482 WebIDBDatabase* database = parent_->GetOrTerminateProcess( 434 WebIDBDatabase* database = parent_->GetOrTerminateProcess(
483 &map_, idb_database_id); 435 &map_, idb_database_id);
484 if (!database) 436 if (!database)
485 return; 437 return;
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 IndexedDBDispatcherHost:: 620 IndexedDBDispatcherHost::
669 ObjectStoreDispatcherHost::~ObjectStoreDispatcherHost() { 621 ObjectStoreDispatcherHost::~ObjectStoreDispatcherHost() {
670 } 622 }
671 623
672 bool IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnMessageReceived( 624 bool IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnMessageReceived(
673 const IPC::Message& message, bool* msg_is_ok) { 625 const IPC::Message& message, bool* msg_is_ok) {
674 bool handled = true; 626 bool handled = true;
675 IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::ObjectStoreDispatcherHost, 627 IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::ObjectStoreDispatcherHost,
676 message, *msg_is_ok) 628 message, *msg_is_ok)
677 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreGet, OnGet) 629 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreGet, OnGet)
678 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStorePutOld, OnPutOld)
679 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStorePut, OnPut) 630 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStorePut, OnPut)
680 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreSetIndexKeysOld,
681 OnSetIndexKeysOld)
682 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreSetIndexKeys, 631 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreSetIndexKeys,
683 OnSetIndexKeys) 632 OnSetIndexKeys)
684 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreSetIndexesReadyOld,
685 OnSetIndexesReadyOld)
686 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreSetIndexesReady, 633 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreSetIndexesReady,
687 OnSetIndexesReady) 634 OnSetIndexesReady)
688 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreDelete, OnDelete) 635 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreDelete, OnDelete)
689 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreClear, OnClear) 636 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreClear, OnClear)
690 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreCreateIndex, OnCreateIndex) 637 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreCreateIndex, OnCreateIndex)
691 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreIndexOld, OnIndexOld)
692 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreIndex, OnIndex) 638 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreIndex, OnIndex)
693 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreDeleteIndexOld,
694 OnDeleteIndexOld)
695 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreDeleteIndex, OnDeleteIndex) 639 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreDeleteIndex, OnDeleteIndex)
696 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreOpenCursor, OnOpenCursor) 640 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreOpenCursor, OnOpenCursor)
697 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreCount, OnCount) 641 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreCount, OnCount)
698 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreDestroyed, OnDestroyed) 642 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreDestroyed, OnDestroyed)
699 IPC_MESSAGE_UNHANDLED(handled = false) 643 IPC_MESSAGE_UNHANDLED(handled = false)
700 IPC_END_MESSAGE_MAP() 644 IPC_END_MESSAGE_MAP()
701 return handled; 645 return handled;
702 } 646 }
703 647
704 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::Send( 648 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::Send(
(...skipping 16 matching lines...) Expand all
721 return; 665 return;
722 666
723 WebKit::WebExceptionCode ec = 0; 667 WebKit::WebExceptionCode ec = 0;
724 scoped_ptr<WebIDBCallbacks> callbacks( 668 scoped_ptr<WebIDBCallbacks> callbacks(
725 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, thread_id, 669 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, thread_id,
726 response_id)); 670 response_id));
727 idb_object_store->get(key_range, callbacks.release(), *idb_transaction, ec); 671 idb_object_store->get(key_range, callbacks.release(), *idb_transaction, ec);
728 DCHECK(!ec); 672 DCHECK(!ec);
729 } 673 }
730 674
731 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnPutOld(
732 const IndexedDBHostMsg_ObjectStorePutOld_Params& params) {
733 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
734 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
735 &map_, params.object_store_ipc_id);
736 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
737 &parent_->transaction_dispatcher_host_->map_, params.transaction_id);
738 if (!idb_transaction || !idb_object_store)
739 return;
740
741 WebKit::WebExceptionCode ec = 0;
742 scoped_ptr<WebIDBCallbacks> callbacks(
743 new IndexedDBCallbacks<WebIDBKey>(parent_, params.thread_id,
744 params.response_id));
745 idb_object_store->putWithIndexKeys(params.serialized_value, params.key,
746 params.put_mode, callbacks.release(),
747 *idb_transaction, params.index_names,
748 params.index_keys, ec);
749 DCHECK(!ec);
750 int64 size = UTF16ToUTF8(params.serialized_value.data()).size();
751 WebIDBTransactionIDToSizeMap* map =
752 &parent_->transaction_dispatcher_host_->transaction_size_map_;
753 (*map)[params.transaction_id] += size;
754 }
755
756 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnPut( 675 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnPut(
757 const IndexedDBHostMsg_ObjectStorePut_Params& params) { 676 const IndexedDBHostMsg_ObjectStorePut_Params& params) {
758 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); 677 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
759 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( 678 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
760 &map_, params.object_store_ipc_id); 679 &map_, params.object_store_ipc_id);
761 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 680 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
762 &parent_->transaction_dispatcher_host_->map_, params.transaction_id); 681 &parent_->transaction_dispatcher_host_->map_, params.transaction_id);
763 if (!idb_transaction || !idb_object_store) 682 if (!idb_transaction || !idb_object_store)
764 return; 683 return;
765 684
766 scoped_ptr<WebIDBCallbacks> callbacks( 685 scoped_ptr<WebIDBCallbacks> callbacks(
767 new IndexedDBCallbacks<WebIDBKey>(parent_, params.thread_id, 686 new IndexedDBCallbacks<WebIDBKey>(parent_, params.thread_id,
768 params.response_id)); 687 params.response_id));
769 idb_object_store->put(params.serialized_value, params.key, 688 idb_object_store->put(params.serialized_value, params.key,
770 params.put_mode, callbacks.release(), 689 params.put_mode, callbacks.release(),
771 *idb_transaction, params.index_ids, 690 *idb_transaction, params.index_ids,
772 params.index_keys); 691 params.index_keys);
773 int64 size = UTF16ToUTF8(params.serialized_value.data()).size(); 692 int64 size = UTF16ToUTF8(params.serialized_value.data()).size();
774 WebIDBTransactionIDToSizeMap* map = 693 WebIDBTransactionIDToSizeMap* map =
775 &parent_->transaction_dispatcher_host_->transaction_size_map_; 694 &parent_->transaction_dispatcher_host_->transaction_size_map_;
776 (*map)[params.transaction_id] += size; 695 (*map)[params.transaction_id] += size;
777 } 696 }
778 697
779 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnSetIndexKeysOld(
780 int32 object_store_ipc_id,
781 const IndexedDBKey& primary_key,
782 const std::vector<string16>& index_names,
783 const std::vector<std::vector<IndexedDBKey> >& index_keys,
784 int32 transaction_id) {
785 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
786 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
787 &map_, object_store_ipc_id);
788 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
789 &parent_->transaction_dispatcher_host_->map_, transaction_id);
790 if (!idb_transaction || !idb_object_store)
791 return;
792 idb_object_store->setIndexKeys(primary_key,
793 WebVector<WebKit::WebString>(index_names),
794 index_keys, *idb_transaction);
795 }
796
797 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnSetIndexKeys( 698 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnSetIndexKeys(
798 int32 object_store_ipc_id, 699 int32 object_store_ipc_id,
799 const IndexedDBKey& primary_key, 700 const IndexedDBKey& primary_key,
800 const std::vector<int64>& index_names, 701 const std::vector<int64>& index_names,
801 const std::vector<std::vector<IndexedDBKey> >& index_keys, 702 const std::vector<std::vector<IndexedDBKey> >& index_keys,
802 int32 transaction_id) { 703 int32 transaction_id) {
803 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); 704 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
804 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( 705 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
805 &map_, object_store_ipc_id); 706 &map_, object_store_ipc_id);
806 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 707 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
807 &parent_->transaction_dispatcher_host_->map_, transaction_id); 708 &parent_->transaction_dispatcher_host_->map_, transaction_id);
808 if (!idb_transaction || !idb_object_store) 709 if (!idb_transaction || !idb_object_store)
809 return; 710 return;
810 idb_object_store->setIndexKeys(primary_key, 711 idb_object_store->setIndexKeys(primary_key,
811 WebVector<long long>(index_names), 712 WebVector<long long>(index_names),
812 index_keys, *idb_transaction); 713 index_keys, *idb_transaction);
813 } 714 }
814 715
815 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnSetIndexesReadyOld(
816 int32 object_store_ipc_id,
817 const std::vector<string16>& index_names,
818 int32 transaction_id) {
819 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
820 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
821 &map_, object_store_ipc_id);
822 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
823 &parent_->transaction_dispatcher_host_->map_, transaction_id);
824 if (!idb_transaction || !idb_object_store)
825 return;
826
827 idb_object_store->setIndexesReady(WebVector<WebKit::WebString>(index_names),
828 *idb_transaction);
829 }
830
831 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnSetIndexesReady( 716 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnSetIndexesReady(
832 int32 object_store_ipc_id, 717 int32 object_store_ipc_id,
833 const std::vector<int64>& index_ids, 718 const std::vector<int64>& index_ids,
834 int32 transaction_id) { 719 int32 transaction_id) {
835 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); 720 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
836 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( 721 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
837 &map_, object_store_ipc_id); 722 &map_, object_store_ipc_id);
838 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 723 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
839 &parent_->transaction_dispatcher_host_->map_, transaction_id); 724 &parent_->transaction_dispatcher_host_->map_, transaction_id);
840 if (!idb_transaction || !idb_object_store) 725 if (!idb_transaction || !idb_object_store)
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 params.multi_entry, *idb_transaction, *ec); 790 params.multi_entry, *idb_transaction, *ec);
906 *index_id = *ec ? 0 : parent_->Add(index); 791 *index_id = *ec ? 0 : parent_->Add(index);
907 WebIDBObjectIDToURLMap* transaction_url_map = 792 WebIDBObjectIDToURLMap* transaction_url_map =
908 &parent_->transaction_dispatcher_host_->transaction_url_map_; 793 &parent_->transaction_dispatcher_host_->transaction_url_map_;
909 if (parent_->Context()->IsOverQuota( 794 if (parent_->Context()->IsOverQuota(
910 (*transaction_url_map)[params.transaction_id])) { 795 (*transaction_url_map)[params.transaction_id])) {
911 idb_transaction->abort(); 796 idb_transaction->abort();
912 } 797 }
913 } 798 }
914 799
915 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnIndexOld(
916 int32 object_store_ipc_id,
917 const string16& name,
918 int32* idb_index_id,
919 WebKit::WebExceptionCode* ec) {
920 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
921 &map_, object_store_ipc_id);
922 if (!idb_object_store)
923 return;
924
925 *ec = 0;
926 WebIDBIndex* index = idb_object_store->index(name, *ec);
927 *idb_index_id = parent_->Add(index);
928 }
929
930 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnIndex( 800 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnIndex(
931 int32 object_store_ipc_id, 801 int32 object_store_ipc_id,
932 int64 index_id, 802 int64 index_id,
933 int32* idb_index_id) { 803 int32* idb_index_id) {
934 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( 804 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
935 &map_, object_store_ipc_id); 805 &map_, object_store_ipc_id);
936 if (!idb_object_store) 806 if (!idb_object_store)
937 return; 807 return;
938 808
939 WebIDBIndex* index = idb_object_store->index(index_id); 809 WebIDBIndex* index = idb_object_store->index(index_id);
940 *idb_index_id = parent_->Add(index); 810 *idb_index_id = parent_->Add(index);
941 } 811 }
942 812
943 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnDeleteIndexOld(
944 int32 object_store_ipc_id,
945 const string16& name,
946 int32 transaction_id,
947 WebKit::WebExceptionCode* ec) {
948 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
949 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
950 &map_, object_store_ipc_id);
951 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
952 &parent_->transaction_dispatcher_host_->map_, transaction_id);
953 if (!idb_object_store || !idb_transaction)
954 return;
955
956 *ec = 0;
957 idb_object_store->deleteIndex(name, *idb_transaction, *ec);
958 }
959
960 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnDeleteIndex( 813 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnDeleteIndex(
961 int32 object_store_ipc_id, 814 int32 object_store_ipc_id,
962 int64 index_id, 815 int64 index_id,
963 int32 transaction_id, 816 int32 transaction_id,
964 WebKit::WebExceptionCode* ec) { 817 WebKit::WebExceptionCode* ec) {
965 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); 818 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
966 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( 819 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
967 &map_, object_store_ipc_id); 820 &map_, object_store_ipc_id);
968 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 821 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
969 &parent_->transaction_dispatcher_host_->map_, transaction_id); 822 &parent_->transaction_dispatcher_host_->map_, transaction_id);
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 } 1015 }
1163 } 1016 }
1164 1017
1165 bool IndexedDBDispatcherHost::TransactionDispatcherHost::OnMessageReceived( 1018 bool IndexedDBDispatcherHost::TransactionDispatcherHost::OnMessageReceived(
1166 const IPC::Message& message, bool* msg_is_ok) { 1019 const IPC::Message& message, bool* msg_is_ok) {
1167 bool handled = true; 1020 bool handled = true;
1168 IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::TransactionDispatcherHost, 1021 IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::TransactionDispatcherHost,
1169 message, *msg_is_ok) 1022 message, *msg_is_ok)
1170 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_TransactionCommit, OnCommit) 1023 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_TransactionCommit, OnCommit)
1171 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_TransactionAbort, OnAbort) 1024 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_TransactionAbort, OnAbort)
1172 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_TransactionObjectStoreOld,
1173 OnObjectStoreOld)
1174 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_TransactionObjectStore, OnObjectStore) 1025 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_TransactionObjectStore, OnObjectStore)
1175 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_TransactionDidCompleteTaskEvents, 1026 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_TransactionDidCompleteTaskEvents,
1176 OnDidCompleteTaskEvents) 1027 OnDidCompleteTaskEvents)
1177 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_TransactionDestroyed, OnDestroyed) 1028 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_TransactionDestroyed, OnDestroyed)
1178 IPC_MESSAGE_UNHANDLED(handled = false) 1029 IPC_MESSAGE_UNHANDLED(handled = false)
1179 IPC_END_MESSAGE_MAP() 1030 IPC_END_MESSAGE_MAP()
1180 return handled; 1031 return handled;
1181 } 1032 }
1182 1033
1183 void IndexedDBDispatcherHost::TransactionDispatcherHost::Send( 1034 void IndexedDBDispatcherHost::TransactionDispatcherHost::Send(
(...skipping 14 matching lines...) Expand all
1198 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnAbort( 1049 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnAbort(
1199 int32 transaction_id) { 1050 int32 transaction_id) {
1200 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 1051 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
1201 &map_, transaction_id); 1052 &map_, transaction_id);
1202 if (!idb_transaction) 1053 if (!idb_transaction)
1203 return; 1054 return;
1204 1055
1205 idb_transaction->abort(); 1056 idb_transaction->abort();
1206 } 1057 }
1207 1058
1208 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnObjectStoreOld(
1209 int32 transaction_id, const string16& name, int32* object_store_ipc_id,
1210 WebKit::WebExceptionCode* ec) {
1211 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
1212 &map_, transaction_id);
1213 if (!idb_transaction)
1214 return;
1215
1216 *ec = 0;
1217 WebIDBObjectStore* object_store = idb_transaction->objectStore(name, *ec);
1218 *object_store_ipc_id = object_store ? parent_->Add(object_store) : 0;
1219 }
1220
1221 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnObjectStore( 1059 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnObjectStore(
1222 int32 transaction_id, int64 object_store_id, int32* object_store_ipc_id, 1060 int32 transaction_id, int64 object_store_id, int32* object_store_ipc_id,
1223 WebKit::WebExceptionCode* ec) { 1061 WebKit::WebExceptionCode* ec) {
1224 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 1062 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
1225 &map_, transaction_id); 1063 &map_, transaction_id);
1226 if (!idb_transaction) 1064 if (!idb_transaction)
1227 return; 1065 return;
1228 1066
1229 *ec = 0; 1067 *ec = 0;
1230 WebIDBObjectStore* object_store = 1068 WebIDBObjectStore* object_store =
(...skipping 23 matching lines...) Expand all
1254 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( 1092 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed(
1255 int32 object_id) { 1093 int32 object_id) {
1256 // TODO(dgrogan): This doesn't seem to be happening with some version change 1094 // TODO(dgrogan): This doesn't seem to be happening with some version change
1257 // transactions. Possibly introduced with integer version support. 1095 // transactions. Possibly introduced with integer version support.
1258 transaction_size_map_.erase(object_id); 1096 transaction_size_map_.erase(object_id);
1259 transaction_url_map_.erase(object_id); 1097 transaction_url_map_.erase(object_id);
1260 parent_->DestroyObject(&map_, object_id); 1098 parent_->DestroyObject(&map_, object_id);
1261 } 1099 }
1262 1100
1263 } // namespace content 1101 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/in_process_webkit/indexed_db_dispatcher_host.h ('k') | content/common/indexed_db/indexed_db_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698