Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 545 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); | 545 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); |
| 546 WebIDBIndex* idb_index = parent_->GetOrTerminateProcess( | 546 WebIDBIndex* idb_index = parent_->GetOrTerminateProcess( |
| 547 &map_, params.idb_index_id); | 547 &map_, params.idb_index_id); |
| 548 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( | 548 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( |
| 549 &parent_->transaction_dispatcher_host_->map_, params.transaction_id); | 549 &parent_->transaction_dispatcher_host_->map_, params.transaction_id); |
| 550 if (!idb_transaction || !idb_index) | 550 if (!idb_transaction || !idb_index) |
| 551 return; | 551 return; |
| 552 | 552 |
| 553 *ec = 0; | 553 *ec = 0; |
| 554 scoped_ptr<WebIDBCallbacks> callbacks( | 554 scoped_ptr<WebIDBCallbacks> callbacks( |
| 555 new IndexedDBCallbacks<WebIDBCursor>(parent_, params.response_id)); | 555 new IndexedDBCallbacks<WebIDBCursor>(parent_, params.response_id, -1)); |
| 556 idb_index->openObjectCursor( | 556 idb_index->openObjectCursor( |
| 557 WebIDBKeyRange(params.lower_key, params.upper_key, params.lower_open, | 557 WebIDBKeyRange(params.lower_key, params.upper_key, params.lower_open, |
| 558 params.upper_open), | 558 params.upper_open), |
| 559 params.direction, callbacks.release(), *idb_transaction, *ec); | 559 params.direction, callbacks.release(), *idb_transaction, *ec); |
| 560 } | 560 } |
| 561 | 561 |
| 562 void IndexedDBDispatcherHost::IndexDispatcherHost::OnOpenKeyCursor( | 562 void IndexedDBDispatcherHost::IndexDispatcherHost::OnOpenKeyCursor( |
| 563 const IndexedDBHostMsg_IndexOpenCursor_Params& params, | 563 const IndexedDBHostMsg_IndexOpenCursor_Params& params, |
| 564 WebKit::WebExceptionCode* ec) { | 564 WebKit::WebExceptionCode* ec) { |
| 565 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); | 565 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); |
| 566 WebIDBIndex* idb_index = parent_->GetOrTerminateProcess( | 566 WebIDBIndex* idb_index = parent_->GetOrTerminateProcess( |
| 567 &map_, params.idb_index_id); | 567 &map_, params.idb_index_id); |
| 568 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( | 568 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( |
| 569 &parent_->transaction_dispatcher_host_->map_, params.transaction_id); | 569 &parent_->transaction_dispatcher_host_->map_, params.transaction_id); |
| 570 if (!idb_transaction || !idb_index) | 570 if (!idb_transaction || !idb_index) |
| 571 return; | 571 return; |
| 572 | 572 |
| 573 *ec = 0; | 573 *ec = 0; |
| 574 scoped_ptr<WebIDBCallbacks> callbacks( | 574 scoped_ptr<WebIDBCallbacks> callbacks( |
| 575 new IndexedDBCallbacks<WebIDBCursor>(parent_, params.response_id)); | 575 new IndexedDBCallbacks<WebIDBCursor>(parent_, params.response_id, -1)); |
| 576 idb_index->openKeyCursor( | 576 idb_index->openKeyCursor( |
| 577 WebIDBKeyRange(params.lower_key, params.upper_key, params.lower_open, | 577 WebIDBKeyRange(params.lower_key, params.upper_key, params.lower_open, |
| 578 params.upper_open), | 578 params.upper_open), |
| 579 params.direction, callbacks.release(), *idb_transaction, *ec); | 579 params.direction, callbacks.release(), *idb_transaction, *ec); |
| 580 } | 580 } |
| 581 | 581 |
| 582 void IndexedDBDispatcherHost::IndexDispatcherHost::OnGetObject( | 582 void IndexedDBDispatcherHost::IndexDispatcherHost::OnGetObject( |
| 583 int idb_index_id, | 583 int idb_index_id, |
| 584 int32 response_id, | 584 int32 response_id, |
| 585 const IndexedDBKey& key, | 585 const IndexedDBKey& key, |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 836 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( | 836 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( |
| 837 &parent_->object_store_dispatcher_host_->map_, | 837 &parent_->object_store_dispatcher_host_->map_, |
| 838 params.idb_object_store_id); | 838 params.idb_object_store_id); |
| 839 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( | 839 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( |
| 840 &parent_->transaction_dispatcher_host_->map_, params.transaction_id); | 840 &parent_->transaction_dispatcher_host_->map_, params.transaction_id); |
| 841 if (!idb_transaction || !idb_object_store) | 841 if (!idb_transaction || !idb_object_store) |
| 842 return; | 842 return; |
| 843 | 843 |
| 844 *ec = 0; | 844 *ec = 0; |
| 845 scoped_ptr<WebIDBCallbacks> callbacks( | 845 scoped_ptr<WebIDBCallbacks> callbacks( |
| 846 new IndexedDBCallbacks<WebIDBCursor>(parent_, params.response_id)); | 846 new IndexedDBCallbacks<WebIDBCursor>(parent_, params.response_id, -1)); |
| 847 idb_object_store->openCursor( | 847 idb_object_store->openCursor( |
| 848 WebIDBKeyRange(params.lower_key, params.upper_key, params.lower_open, | 848 WebIDBKeyRange(params.lower_key, params.upper_key, params.lower_open, |
| 849 params.upper_open), | 849 params.upper_open), |
| 850 params.direction, callbacks.release(), *idb_transaction, *ec); | 850 params.direction, callbacks.release(), *idb_transaction, *ec); |
| 851 } | 851 } |
| 852 | 852 |
| 853 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnDestroyed( | 853 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnDestroyed( |
| 854 int32 object_id) { | 854 int32 object_id) { |
| 855 parent_->DestroyObject(&map_, object_id); | 855 parent_->DestroyObject(&map_, object_id); |
| 856 } | 856 } |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 946 int32 response_id, | 946 int32 response_id, |
| 947 const IndexedDBKey& key, | 947 const IndexedDBKey& key, |
| 948 WebKit::WebExceptionCode* ec) { | 948 WebKit::WebExceptionCode* ec) { |
| 949 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); | 949 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); |
| 950 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id); | 950 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id); |
| 951 if (!idb_cursor) | 951 if (!idb_cursor) |
| 952 return; | 952 return; |
| 953 | 953 |
| 954 *ec = 0; | 954 *ec = 0; |
| 955 idb_cursor->continueFunction( | 955 idb_cursor->continueFunction( |
| 956 key, new IndexedDBCallbacks<WebIDBCursor>(parent_, response_id), *ec); | 956 key, new IndexedDBCallbacks<WebIDBCursor>(parent_, response_id, |
| 957 cursor_id), *ec); | |
| 957 } | 958 } |
| 958 | 959 |
| 959 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDelete( | 960 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDelete( |
| 960 int32 cursor_id, | 961 int32 cursor_id, |
| 961 int32 response_id, | 962 int32 response_id, |
| 962 WebKit::WebExceptionCode* ec) { | 963 WebKit::WebExceptionCode* ec) { |
| 963 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); | 964 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); |
| 964 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id); | 965 WebIDBCursor* idb_cursor = parent_->GetOrTerminateProcess(&map_, cursor_id); |
| 965 if (!idb_cursor) | 966 if (!idb_cursor) |
| 966 return; | 967 return; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1066 } | 1067 } |
| 1067 idb_transaction->didCompleteTaskEvents(); | 1068 idb_transaction->didCompleteTaskEvents(); |
| 1068 } | 1069 } |
| 1069 | 1070 |
| 1070 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( | 1071 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( |
| 1071 int32 object_id) { | 1072 int32 object_id) { |
| 1072 transaction_size_map_.erase(object_id); | 1073 transaction_size_map_.erase(object_id); |
| 1073 transaction_url_map_.erase(object_id); | 1074 transaction_url_map_.erase(object_id); |
| 1074 parent_->DestroyObject(&map_, object_id); | 1075 parent_->DestroyObject(&map_, object_id); |
| 1075 } | 1076 } |
| 1077 | |
| 1078 WebIDBCursor* IndexedDBDispatcherHost::getCursorFromId(int32 cursor_id) { | |
|
michaeln
2011/11/01 18:38:37
nit: please you move this method up in the .cc fil
hans
2011/11/02 17:16:58
Done.
| |
| 1079 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT)); | |
| 1080 return cursor_dispatcher_host_->map_.Lookup(cursor_id); | |
| 1081 } | |
| OLD | NEW |