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" |
11 #include "content/browser/in_process_webkit/indexed_db_context_impl.h" | 11 #include "content/browser/in_process_webkit/indexed_db_context_impl.h" |
12 #include "content/browser/in_process_webkit/indexed_db_database_callbacks.h" | 12 #include "content/browser/in_process_webkit/indexed_db_database_callbacks.h" |
13 #include "content/browser/in_process_webkit/indexed_db_transaction_callbacks.h" | 13 #include "content/browser/in_process_webkit/indexed_db_transaction_callbacks.h" |
14 #include "content/browser/renderer_host/render_message_filter.h" | 14 #include "content/browser/renderer_host/render_message_filter.h" |
15 #include "content/common/indexed_db/indexed_db_messages.h" | 15 #include "content/common/indexed_db/indexed_db_messages.h" |
16 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
17 #include "content/public/browser/user_metrics.h" | 17 #include "content/public/browser/user_metrics.h" |
18 #include "content/public/common/content_switches.h" | 18 #include "content/public/common/content_switches.h" |
19 #include "content/public/common/result_codes.h" | 19 #include "content/public/common/result_codes.h" |
20 #include "googleurl/src/gurl.h" | 20 #include "googleurl/src/gurl.h" |
21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMStringList.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMStringList.h" |
22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBCursor.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBCursor.h" |
23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabase.h" | 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabase.h" |
24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseError.h
" | 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseError.h
" |
25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBFactory.h" | 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBFactory.h" |
26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBIndex.h" | 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBIndex.h" |
| 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyPath.h" |
27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyRange.h" | 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyRange.h" |
28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBObjectStore.h" | 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBObjectStore.h" |
29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransaction.h" | 30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransaction.h" |
30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" | 31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" |
31 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" | 32 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" |
32 #include "webkit/database/database_util.h" | 33 #include "webkit/database/database_util.h" |
33 #include "webkit/glue/webkit_glue.h" | 34 #include "webkit/glue/webkit_glue.h" |
34 | 35 |
35 using content::BrowserMessageFilter; | 36 using content::BrowserMessageFilter; |
36 using content::BrowserThread; | 37 using content::BrowserThread; |
37 using content::UserMetricsAction; | 38 using content::UserMetricsAction; |
38 using webkit_database::DatabaseUtil; | 39 using webkit_database::DatabaseUtil; |
39 using WebKit::WebDOMStringList; | 40 using WebKit::WebDOMStringList; |
40 using WebKit::WebExceptionCode; | 41 using WebKit::WebExceptionCode; |
41 using WebKit::WebIDBCallbacks; | 42 using WebKit::WebIDBCallbacks; |
42 using WebKit::WebIDBCursor; | 43 using WebKit::WebIDBCursor; |
43 using WebKit::WebIDBDatabase; | 44 using WebKit::WebIDBDatabase; |
44 using WebKit::WebIDBDatabaseError; | 45 using WebKit::WebIDBDatabaseError; |
45 using WebKit::WebIDBIndex; | 46 using WebKit::WebIDBIndex; |
46 using WebKit::WebIDBKey; | 47 using WebKit::WebIDBKey; |
| 48 using WebKit::WebIDBKeyPath; |
47 using WebKit::WebIDBKeyRange; | 49 using WebKit::WebIDBKeyRange; |
48 using WebKit::WebIDBObjectStore; | 50 using WebKit::WebIDBObjectStore; |
49 using WebKit::WebIDBTransaction; | 51 using WebKit::WebIDBTransaction; |
50 using WebKit::WebSecurityOrigin; | 52 using WebKit::WebSecurityOrigin; |
51 using WebKit::WebSerializedScriptValue; | 53 using WebKit::WebSerializedScriptValue; |
52 using WebKit::WebVector; | 54 using WebKit::WebVector; |
53 | 55 |
54 namespace { | 56 namespace { |
55 | 57 |
56 template <class T> | 58 template <class T> |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 parent_->SyncGetter<string16>(&map_, object_id, name, &WebIDBIndex::name); | 528 parent_->SyncGetter<string16>(&map_, object_id, name, &WebIDBIndex::name); |
527 } | 529 } |
528 | 530 |
529 void IndexedDBDispatcherHost::IndexDispatcherHost::OnStoreName( | 531 void IndexedDBDispatcherHost::IndexDispatcherHost::OnStoreName( |
530 int32 object_id, string16* store_name) { | 532 int32 object_id, string16* store_name) { |
531 parent_->SyncGetter<string16>( | 533 parent_->SyncGetter<string16>( |
532 &map_, object_id, store_name, &WebIDBIndex::storeName); | 534 &map_, object_id, store_name, &WebIDBIndex::storeName); |
533 } | 535 } |
534 | 536 |
535 void IndexedDBDispatcherHost::IndexDispatcherHost::OnKeyPath( | 537 void IndexedDBDispatcherHost::IndexDispatcherHost::OnKeyPath( |
536 int32 object_id, NullableString16* key_path) { | 538 int32 object_id, IndexedDBKeyPath* key_path) { |
537 parent_->SyncGetter<NullableString16>( | 539 WebIDBIndex* idb_index = parent_->GetOrTerminateProcess(&map_, object_id); |
538 &map_, object_id, key_path, &WebIDBIndex::keyPathString); | 540 if (!idb_index) |
| 541 return; |
| 542 |
| 543 *key_path = IndexedDBKeyPath(idb_index->keyPath()); |
539 } | 544 } |
540 | 545 |
541 void IndexedDBDispatcherHost::IndexDispatcherHost::OnUnique( | 546 void IndexedDBDispatcherHost::IndexDispatcherHost::OnUnique( |
542 int32 object_id, bool* unique) { | 547 int32 object_id, bool* unique) { |
543 parent_->SyncGetter<bool>(&map_, object_id, unique, &WebIDBIndex::unique); | 548 parent_->SyncGetter<bool>(&map_, object_id, unique, &WebIDBIndex::unique); |
544 } | 549 } |
545 | 550 |
546 void IndexedDBDispatcherHost::IndexDispatcherHost::OnMultiEntry( | 551 void IndexedDBDispatcherHost::IndexDispatcherHost::OnMultiEntry( |
547 int32 object_id, bool* multi_entry) { | 552 int32 object_id, bool* multi_entry) { |
548 parent_->SyncGetter<bool>( | 553 parent_->SyncGetter<bool>( |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 parent_->Send(message); | 753 parent_->Send(message); |
749 } | 754 } |
750 | 755 |
751 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnName( | 756 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnName( |
752 int32 object_id, string16* name) { | 757 int32 object_id, string16* name) { |
753 parent_->SyncGetter<string16>( | 758 parent_->SyncGetter<string16>( |
754 &map_, object_id, name, &WebIDBObjectStore::name); | 759 &map_, object_id, name, &WebIDBObjectStore::name); |
755 } | 760 } |
756 | 761 |
757 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnKeyPath( | 762 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnKeyPath( |
758 int32 object_id, NullableString16* keyPath) { | 763 int32 object_id, IndexedDBKeyPath* key_path) { |
759 parent_->SyncGetter<NullableString16>( | 764 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( |
760 &map_, object_id, keyPath, &WebIDBObjectStore::keyPathString); | 765 &map_,object_id); |
| 766 if (!idb_object_store) |
| 767 return; |
| 768 |
| 769 *key_path = IndexedDBKeyPath(idb_object_store->keyPath()); |
761 } | 770 } |
762 | 771 |
763 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnIndexNames( | 772 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnIndexNames( |
764 int32 idb_object_store_id, std::vector<string16>* index_names) { | 773 int32 idb_object_store_id, std::vector<string16>* index_names) { |
765 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( | 774 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( |
766 &map_, idb_object_store_id); | 775 &map_, idb_object_store_id); |
767 if (!idb_object_store) | 776 if (!idb_object_store) |
768 return; | 777 return; |
769 | 778 |
770 WebDOMStringList web_index_names = idb_object_store->indexNames(); | 779 WebDOMStringList web_index_names = idb_object_store->indexNames(); |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1262 } | 1271 } |
1263 idb_transaction->didCompleteTaskEvents(); | 1272 idb_transaction->didCompleteTaskEvents(); |
1264 } | 1273 } |
1265 | 1274 |
1266 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( | 1275 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( |
1267 int32 object_id) { | 1276 int32 object_id) { |
1268 transaction_size_map_.erase(object_id); | 1277 transaction_size_map_.erase(object_id); |
1269 transaction_url_map_.erase(object_id); | 1278 transaction_url_map_.erase(object_id); |
1270 parent_->DestroyObject(&map_, object_id); | 1279 parent_->DestroyObject(&map_, object_id); |
1271 } | 1280 } |
OLD | NEW |