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

Side by Side Diff: content/browser/in_process_webkit/indexed_db_dispatcher_host.cc

Issue 10204003: Use WebIDBKeyPath type in WebKit API, implement IndexedDBKeyPath type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move IndexedDBKeyPath to content namespace, formatting nits. Created 8 years, 7 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 | Annotate | Revision Log
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 "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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 parent_->SyncGetter<string16>(&map_, object_id, name, &WebIDBIndex::name); 525 parent_->SyncGetter<string16>(&map_, object_id, name, &WebIDBIndex::name);
524 } 526 }
525 527
526 void IndexedDBDispatcherHost::IndexDispatcherHost::OnStoreName( 528 void IndexedDBDispatcherHost::IndexDispatcherHost::OnStoreName(
527 int32 object_id, string16* store_name) { 529 int32 object_id, string16* store_name) {
528 parent_->SyncGetter<string16>( 530 parent_->SyncGetter<string16>(
529 &map_, object_id, store_name, &WebIDBIndex::storeName); 531 &map_, object_id, store_name, &WebIDBIndex::storeName);
530 } 532 }
531 533
532 void IndexedDBDispatcherHost::IndexDispatcherHost::OnKeyPath( 534 void IndexedDBDispatcherHost::IndexDispatcherHost::OnKeyPath(
533 int32 object_id, NullableString16* key_path) { 535 int32 object_id, content::IndexedDBKeyPath* key_path) {
534 parent_->SyncGetter<NullableString16>( 536 WebIDBIndex* idb_index = parent_->GetOrTerminateProcess(&map_, object_id);
535 &map_, object_id, key_path, &WebIDBIndex::keyPathString); 537 if (!idb_index)
538 return;
539
540 *key_path = content::IndexedDBKeyPath(idb_index->keyPath());
536 } 541 }
537 542
538 void IndexedDBDispatcherHost::IndexDispatcherHost::OnUnique( 543 void IndexedDBDispatcherHost::IndexDispatcherHost::OnUnique(
539 int32 object_id, bool* unique) { 544 int32 object_id, bool* unique) {
540 parent_->SyncGetter<bool>(&map_, object_id, unique, &WebIDBIndex::unique); 545 parent_->SyncGetter<bool>(&map_, object_id, unique, &WebIDBIndex::unique);
541 } 546 }
542 547
543 void IndexedDBDispatcherHost::IndexDispatcherHost::OnMultiEntry( 548 void IndexedDBDispatcherHost::IndexDispatcherHost::OnMultiEntry(
544 int32 object_id, bool* multi_entry) { 549 int32 object_id, bool* multi_entry) {
545 parent_->SyncGetter<bool>( 550 parent_->SyncGetter<bool>(
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 parent_->Send(message); 702 parent_->Send(message);
698 } 703 }
699 704
700 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnName( 705 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnName(
701 int32 object_id, string16* name) { 706 int32 object_id, string16* name) {
702 parent_->SyncGetter<string16>( 707 parent_->SyncGetter<string16>(
703 &map_, object_id, name, &WebIDBObjectStore::name); 708 &map_, object_id, name, &WebIDBObjectStore::name);
704 } 709 }
705 710
706 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnKeyPath( 711 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnKeyPath(
707 int32 object_id, NullableString16* keyPath) { 712 int32 object_id, content::IndexedDBKeyPath* key_path) {
708 parent_->SyncGetter<NullableString16>( 713 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
709 &map_, object_id, keyPath, &WebIDBObjectStore::keyPathString); 714 &map_,object_id);
715 if (!idb_object_store)
716 return;
717
718 *key_path = content::IndexedDBKeyPath(idb_object_store->keyPath());
710 } 719 }
711 720
712 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnIndexNames( 721 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnIndexNames(
713 int32 idb_object_store_id, std::vector<string16>* index_names) { 722 int32 idb_object_store_id, std::vector<string16>* index_names) {
714 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( 723 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
715 &map_, idb_object_store_id); 724 &map_, idb_object_store_id);
716 if (!idb_object_store) 725 if (!idb_object_store)
717 return; 726 return;
718 727
719 WebDOMStringList web_index_names = idb_object_store->indexNames(); 728 WebDOMStringList web_index_names = idb_object_store->indexNames();
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 } 1216 }
1208 idb_transaction->didCompleteTaskEvents(); 1217 idb_transaction->didCompleteTaskEvents();
1209 } 1218 }
1210 1219
1211 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( 1220 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed(
1212 int32 object_id) { 1221 int32 object_id) {
1213 transaction_size_map_.erase(object_id); 1222 transaction_size_map_.erase(object_id);
1214 transaction_url_map_.erase(object_id); 1223 transaction_url_map_.erase(object_id);
1215 parent_->DestroyObject(&map_, object_id); 1224 parent_->DestroyObject(&map_, object_id);
1216 } 1225 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698