OLD | NEW |
---|---|
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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "content/browser/in_process_webkit/indexed_db_callbacks.h" | 10 #include "content/browser/in_process_webkit/indexed_db_callbacks.h" |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
498 message, *msg_is_ok) | 498 message, *msg_is_ok) |
499 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexName, OnName) | 499 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexName, OnName) |
500 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexStoreName, OnStoreName) | 500 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexStoreName, OnStoreName) |
501 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexKeyPath, OnKeyPath) | 501 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexKeyPath, OnKeyPath) |
502 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexUnique, OnUnique) | 502 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexUnique, OnUnique) |
503 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexMultiEntry, OnMultiEntry) | 503 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexMultiEntry, OnMultiEntry) |
504 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexOpenObjectCursor, | 504 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexOpenObjectCursor, |
505 OnOpenObjectCursor) | 505 OnOpenObjectCursor) |
506 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexOpenKeyCursor, OnOpenKeyCursor) | 506 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexOpenKeyCursor, OnOpenKeyCursor) |
507 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexCount, OnCount) | 507 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexCount, OnCount) |
508 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexGetObject, OnGetObject) | 508 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexGetObject, |
jsbell
2012/04/23 18:23:59
Nit: Does this fit on one line?
alecflett
2012/04/23 19:18:38
Done.
| |
509 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexGetObjectByRange, | 509 OnGetObject) |
510 OnGetObjectByRange) | |
511 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexGetKey, OnGetKey) | 510 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexGetKey, OnGetKey) |
512 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexGetKeyByRange, OnGetKeyByRange) | |
513 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexDestroyed, OnDestroyed) | 511 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_IndexDestroyed, OnDestroyed) |
514 IPC_MESSAGE_UNHANDLED(handled = false) | 512 IPC_MESSAGE_UNHANDLED(handled = false) |
515 IPC_END_MESSAGE_MAP() | 513 IPC_END_MESSAGE_MAP() |
516 return handled; | 514 return handled; |
517 } | 515 } |
518 | 516 |
519 void IndexedDBDispatcherHost::IndexDispatcherHost::Send( | 517 void IndexedDBDispatcherHost::IndexDispatcherHost::Send( |
520 IPC::Message* message) { | 518 IPC::Message* message) { |
521 parent_->Send(message); | 519 parent_->Send(message); |
522 } | 520 } |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
610 idb_index->count( | 608 idb_index->count( |
611 WebIDBKeyRange(params.lower_key, params.upper_key, params.lower_open, | 609 WebIDBKeyRange(params.lower_key, params.upper_key, params.lower_open, |
612 params.upper_open), | 610 params.upper_open), |
613 callbacks.release(), *idb_transaction, *ec); | 611 callbacks.release(), *idb_transaction, *ec); |
614 } | 612 } |
615 | 613 |
616 void IndexedDBDispatcherHost::IndexDispatcherHost::OnGetObject( | 614 void IndexedDBDispatcherHost::IndexDispatcherHost::OnGetObject( |
617 int idb_index_id, | 615 int idb_index_id, |
618 int32 thread_id, | 616 int32 thread_id, |
619 int32 response_id, | 617 int32 response_id, |
620 const IndexedDBKey& key, | |
621 int32 transaction_id, | |
622 WebKit::WebExceptionCode* ec) { | |
623 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | |
624 WebIDBIndex* idb_index = parent_->GetOrTerminateProcess( | |
625 &map_, idb_index_id); | |
626 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( | |
627 &parent_->transaction_dispatcher_host_->map_, transaction_id); | |
628 if (!idb_transaction || !idb_index) | |
629 return; | |
630 | |
631 *ec = 0; | |
632 scoped_ptr<WebIDBCallbacks> callbacks( | |
633 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, thread_id, | |
634 response_id)); | |
635 idb_index->getObject(key, callbacks.release(), *idb_transaction, *ec); | |
636 } | |
637 | |
638 void IndexedDBDispatcherHost::IndexDispatcherHost::OnGetObjectByRange( | |
639 int idb_index_id, | |
640 int32 thread_id, | |
641 int32 response_id, | |
642 const IndexedDBKeyRange& key_range, | 618 const IndexedDBKeyRange& key_range, |
643 int32 transaction_id, | 619 int32 transaction_id, |
644 WebKit::WebExceptionCode* ec) { | 620 WebKit::WebExceptionCode* ec) { |
645 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 621 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
646 WebIDBIndex* idb_index = parent_->GetOrTerminateProcess( | 622 WebIDBIndex* idb_index = parent_->GetOrTerminateProcess( |
647 &map_, idb_index_id); | 623 &map_, idb_index_id); |
648 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( | 624 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( |
649 &parent_->transaction_dispatcher_host_->map_, transaction_id); | 625 &parent_->transaction_dispatcher_host_->map_, transaction_id); |
650 if (!idb_transaction || !idb_index) | 626 if (!idb_transaction || !idb_index) |
651 return; | 627 return; |
652 | 628 |
653 *ec = 0; | 629 *ec = 0; |
654 scoped_ptr<WebIDBCallbacks> callbacks( | 630 scoped_ptr<WebIDBCallbacks> callbacks( |
655 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, thread_id, | 631 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, thread_id, |
656 response_id)); | 632 response_id)); |
657 idb_index->getObject(key_range, callbacks.release(), *idb_transaction, *ec); | 633 idb_index->getObject(key_range, callbacks.release(), *idb_transaction, *ec); |
658 } | 634 } |
659 | 635 |
660 void IndexedDBDispatcherHost::IndexDispatcherHost::OnGetKey( | 636 void IndexedDBDispatcherHost::IndexDispatcherHost::OnGetKey( |
661 int idb_index_id, | 637 int idb_index_id, |
662 int32 thread_id, | 638 int32 thread_id, |
663 int32 response_id, | 639 int32 response_id, |
664 const IndexedDBKey& key, | |
665 int32 transaction_id, | |
666 WebKit::WebExceptionCode* ec) { | |
667 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | |
668 WebIDBIndex* idb_index = parent_->GetOrTerminateProcess( | |
669 &map_, idb_index_id); | |
670 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( | |
671 &parent_->transaction_dispatcher_host_->map_, transaction_id); | |
672 if (!idb_transaction || !idb_index) | |
673 return; | |
674 | |
675 *ec = 0; | |
676 scoped_ptr<WebIDBCallbacks> callbacks( | |
677 new IndexedDBCallbacks<WebIDBKey>(parent_, thread_id, response_id)); | |
678 idb_index->getKey(key, callbacks.release(), *idb_transaction, *ec); | |
679 } | |
680 | |
681 void IndexedDBDispatcherHost::IndexDispatcherHost::OnGetKeyByRange( | |
682 int idb_index_id, | |
683 int32 thread_id, | |
684 int32 response_id, | |
685 const IndexedDBKeyRange& key_range, | 640 const IndexedDBKeyRange& key_range, |
686 int32 transaction_id, | 641 int32 transaction_id, |
687 WebKit::WebExceptionCode* ec) { | 642 WebKit::WebExceptionCode* ec) { |
688 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 643 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
689 WebIDBIndex* idb_index = parent_->GetOrTerminateProcess( | 644 WebIDBIndex* idb_index = parent_->GetOrTerminateProcess( |
690 &map_, idb_index_id); | 645 &map_, idb_index_id); |
691 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( | 646 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( |
692 &parent_->transaction_dispatcher_host_->map_, transaction_id); | 647 &parent_->transaction_dispatcher_host_->map_, transaction_id); |
693 if (!idb_transaction || !idb_index) | 648 if (!idb_transaction || !idb_index) |
694 return; | 649 return; |
(...skipping 25 matching lines...) Expand all Loading... | |
720 | 675 |
721 bool IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnMessageReceived( | 676 bool IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnMessageReceived( |
722 const IPC::Message& message, bool* msg_is_ok) { | 677 const IPC::Message& message, bool* msg_is_ok) { |
723 bool handled = true; | 678 bool handled = true; |
724 IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::ObjectStoreDispatcherHost, | 679 IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::ObjectStoreDispatcherHost, |
725 message, *msg_is_ok) | 680 message, *msg_is_ok) |
726 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreName, OnName) | 681 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreName, OnName) |
727 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreKeyPath, OnKeyPath) | 682 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreKeyPath, OnKeyPath) |
728 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreIndexNames, OnIndexNames) | 683 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreIndexNames, OnIndexNames) |
729 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreGet, OnGet) | 684 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreGet, OnGet) |
730 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreGetByRange, OnGetByRange) | |
731 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStorePut, OnPut) | 685 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStorePut, OnPut) |
732 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreDelete, OnDelete) | 686 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreDelete, OnDelete) |
733 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreDeleteRange, OnDeleteRange) | 687 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreDeleteRange, OnDeleteRange) |
734 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreClear, OnClear) | 688 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreClear, OnClear) |
735 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreCreateIndex, OnCreateIndex) | 689 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreCreateIndex, OnCreateIndex) |
736 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreIndex, OnIndex) | 690 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreIndex, OnIndex) |
737 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreDeleteIndex, OnDeleteIndex) | 691 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreDeleteIndex, OnDeleteIndex) |
738 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreOpenCursor, OnOpenCursor) | 692 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreOpenCursor, OnOpenCursor) |
739 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreCount, OnCount) | 693 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreCount, OnCount) |
740 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreDestroyed, OnDestroyed) | 694 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_ObjectStoreDestroyed, OnDestroyed) |
(...skipping 29 matching lines...) Expand all Loading... | |
770 WebDOMStringList web_index_names = idb_object_store->indexNames(); | 724 WebDOMStringList web_index_names = idb_object_store->indexNames(); |
771 index_names->reserve(web_index_names.length()); | 725 index_names->reserve(web_index_names.length()); |
772 for (unsigned i = 0; i < web_index_names.length(); ++i) | 726 for (unsigned i = 0; i < web_index_names.length(); ++i) |
773 index_names->push_back(web_index_names.item(i)); | 727 index_names->push_back(web_index_names.item(i)); |
774 } | 728 } |
775 | 729 |
776 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnGet( | 730 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnGet( |
777 int idb_object_store_id, | 731 int idb_object_store_id, |
778 int32 thread_id, | 732 int32 thread_id, |
779 int32 response_id, | 733 int32 response_id, |
780 const IndexedDBKey& key, | |
781 int32 transaction_id, | |
782 WebKit::WebExceptionCode* ec) { | |
783 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | |
784 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( | |
785 &map_, idb_object_store_id); | |
786 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( | |
787 &parent_->transaction_dispatcher_host_->map_, transaction_id); | |
788 if (!idb_transaction || !idb_object_store) | |
789 return; | |
790 | |
791 *ec = 0; | |
792 scoped_ptr<WebIDBCallbacks> callbacks( | |
793 new IndexedDBCallbacks<WebSerializedScriptValue>(parent_, thread_id, | |
794 response_id)); | |
795 idb_object_store->get(key, callbacks.release(), *idb_transaction, *ec); | |
796 } | |
797 | |
798 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnGetByRange( | |
799 int idb_object_store_id, | |
800 int32 thread_id, | |
801 int32 response_id, | |
802 const IndexedDBKeyRange& key_range, | 734 const IndexedDBKeyRange& key_range, |
803 int32 transaction_id, | 735 int32 transaction_id, |
804 WebKit::WebExceptionCode* ec) { | 736 WebKit::WebExceptionCode* ec) { |
805 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 737 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
806 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( | 738 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( |
807 &map_, idb_object_store_id); | 739 &map_, idb_object_store_id); |
808 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( | 740 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( |
809 &parent_->transaction_dispatcher_host_->map_, transaction_id); | 741 &parent_->transaction_dispatcher_host_->map_, transaction_id); |
810 if (!idb_transaction || !idb_object_store) | 742 if (!idb_transaction || !idb_object_store) |
811 return; | 743 return; |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1262 } | 1194 } |
1263 idb_transaction->didCompleteTaskEvents(); | 1195 idb_transaction->didCompleteTaskEvents(); |
1264 } | 1196 } |
1265 | 1197 |
1266 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( | 1198 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( |
1267 int32 object_id) { | 1199 int32 object_id) { |
1268 transaction_size_map_.erase(object_id); | 1200 transaction_size_map_.erase(object_id); |
1269 transaction_url_map_.erase(object_id); | 1201 transaction_url_map_.erase(object_id); |
1270 parent_->DestroyObject(&map_, object_id); | 1202 parent_->DestroyObject(&map_, object_id); |
1271 } | 1203 } |
OLD | NEW |