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

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: Review feedback Created 8 years, 8 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, 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 = 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 parent_->Send(message); 706 parent_->Send(message);
702 } 707 }
703 708
704 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnName( 709 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnName(
705 int32 object_id, string16* name) { 710 int32 object_id, string16* name) {
706 parent_->SyncGetter<string16>( 711 parent_->SyncGetter<string16>(
707 &map_, object_id, name, &WebIDBObjectStore::name); 712 &map_, object_id, name, &WebIDBObjectStore::name);
708 } 713 }
709 714
710 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnKeyPath( 715 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnKeyPath(
711 int32 object_id, NullableString16* keyPath) { 716 int32 object_id, IndexedDBKeyPath* key_path) {
712 parent_->SyncGetter<NullableString16>( 717 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
713 &map_, object_id, keyPath, &WebIDBObjectStore::keyPathString); 718 &map_,object_id);
719 if (!idb_object_store)
720 return;
721
722 *key_path = IndexedDBKeyPath(idb_object_store->keyPath());
714 } 723 }
715 724
716 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnIndexNames( 725 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnIndexNames(
717 int32 idb_object_store_id, std::vector<string16>* index_names) { 726 int32 idb_object_store_id, std::vector<string16>* index_names) {
718 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( 727 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
719 &map_, idb_object_store_id); 728 &map_, idb_object_store_id);
720 if (!idb_object_store) 729 if (!idb_object_store)
721 return; 730 return;
722 731
723 WebDOMStringList web_index_names = idb_object_store->indexNames(); 732 WebDOMStringList web_index_names = idb_object_store->indexNames();
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
1214 } 1223 }
1215 idb_transaction->didCompleteTaskEvents(); 1224 idb_transaction->didCompleteTaskEvents();
1216 } 1225 }
1217 1226
1218 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( 1227 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed(
1219 int32 object_id) { 1228 int32 object_id) {
1220 transaction_size_map_.erase(object_id); 1229 transaction_size_map_.erase(object_id);
1221 transaction_url_map_.erase(object_id); 1230 transaction_url_map_.erase(object_id);
1222 parent_->DestroyObject(&map_, object_id); 1231 parent_->DestroyObject(&map_, object_id);
1223 } 1232 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698