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

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

Issue 12225161: Revert 182090 (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1364/src/
Patch Set: Created 7 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/process.h" 11 #include "base/process.h"
12 #include "base/process_util.h" 12 #include "base/process_util.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "content/browser/in_process_webkit/indexed_db_callbacks.h" 14 #include "content/browser/in_process_webkit/indexed_db_callbacks.h"
15 #include "content/browser/in_process_webkit/indexed_db_context_impl.h" 15 #include "content/browser/in_process_webkit/indexed_db_context_impl.h"
16 #include "content/browser/in_process_webkit/indexed_db_database_callbacks.h" 16 #include "content/browser/in_process_webkit/indexed_db_database_callbacks.h"
17 #include "content/browser/in_process_webkit/indexed_db_transaction_callbacks.h" 17 #include "content/browser/in_process_webkit/indexed_db_transaction_callbacks.h"
18 #include "content/browser/renderer_host/render_message_filter.h" 18 #include "content/browser/renderer_host/render_message_filter.h"
19 #include "content/common/indexed_db/indexed_db_messages.h" 19 #include "content/common/indexed_db/indexed_db_messages.h"
20 #include "content/public/browser/browser_thread.h" 20 #include "content/public/browser/browser_thread.h"
21 #include "content/public/browser/user_metrics.h" 21 #include "content/public/browser/user_metrics.h"
22 #include "content/public/common/content_switches.h" 22 #include "content/public/common/content_switches.h"
23 #include "content/public/common/result_codes.h" 23 #include "content/public/common/result_codes.h"
24 #include "googleurl/src/gurl.h" 24 #include "googleurl/src/gurl.h"
25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMStringList.h" 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMStringList.h"
26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBCursor.h" 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBCursor.h"
27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabase.h" 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabase.h"
28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseCallbac ks.h" 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseCallbac ks.h"
29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseError.h "
30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseExcepti on.h"
31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBFactory.h" 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBFactory.h"
32 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBIndex.h" 30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBIndex.h"
33 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBMetadata.h" 31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBMetadata.h"
34 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBObjectStore.h" 32 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBObjectStore.h"
35 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransaction.h" 33 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransaction.h"
36 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" 34 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h"
37 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" 35 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h"
38 #include "webkit/base/file_path_string_conversions.h" 36 #include "webkit/base/file_path_string_conversions.h"
39 #include "webkit/database/database_util.h" 37 #include "webkit/database/database_util.h"
40 38
41 using webkit_database::DatabaseUtil; 39 using webkit_database::DatabaseUtil;
42 using WebKit::WebDOMStringList; 40 using WebKit::WebDOMStringList;
43 using WebKit::WebExceptionCode; 41 using WebKit::WebExceptionCode;
44 using WebKit::WebIDBCallbacks; 42 using WebKit::WebIDBCallbacks;
45 using WebKit::WebIDBCursor; 43 using WebKit::WebIDBCursor;
46 using WebKit::WebIDBDatabase; 44 using WebKit::WebIDBDatabase;
47 using WebKit::WebIDBDatabaseError;
48 using WebKit::WebIDBIndex; 45 using WebKit::WebIDBIndex;
49 using WebKit::WebIDBKey; 46 using WebKit::WebIDBKey;
50 using WebKit::WebIDBMetadata; 47 using WebKit::WebIDBMetadata;
51 using WebKit::WebIDBObjectStore; 48 using WebKit::WebIDBObjectStore;
52 using WebKit::WebIDBTransaction; 49 using WebKit::WebIDBTransaction;
53 using WebKit::WebSecurityOrigin; 50 using WebKit::WebSecurityOrigin;
54 using WebKit::WebSerializedScriptValue; 51 using WebKit::WebSerializedScriptValue;
55 using WebKit::WebVector; 52 using WebKit::WebVector;
56 53
57 namespace content { 54 namespace content {
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( 707 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
711 &map_, params.ipc_object_store_id); 708 &map_, params.ipc_object_store_id);
712 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 709 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
713 &parent_->transaction_dispatcher_host_->map_, params.ipc_transaction_id); 710 &parent_->transaction_dispatcher_host_->map_, params.ipc_transaction_id);
714 if (!idb_transaction || !idb_object_store) 711 if (!idb_transaction || !idb_object_store)
715 return; 712 return;
716 713
717 scoped_ptr<WebIDBCallbacks> callbacks( 714 scoped_ptr<WebIDBCallbacks> callbacks(
718 new IndexedDBCallbacks<WebIDBKey>(parent_, params.ipc_thread_id, 715 new IndexedDBCallbacks<WebIDBKey>(parent_, params.ipc_thread_id,
719 params.ipc_response_id)); 716 params.ipc_response_id));
720
721 if (params.index_ids.size() != params.index_keys.size()) {
722 callbacks->onError(WebIDBDatabaseError(
723 WebKit::WebIDBDatabaseExceptionUnknownError,
724 "Malformed IPC message: index_ids.size() != index_keys.size()"));
725 return;
726 }
727
728 idb_object_store->put(params.serialized_value, params.key, 717 idb_object_store->put(params.serialized_value, params.key,
729 params.put_mode, callbacks.release(), 718 params.put_mode, callbacks.release(),
730 *idb_transaction, params.index_ids, 719 *idb_transaction, params.index_ids,
731 params.index_keys); 720 params.index_keys);
732 int64 size = UTF16ToUTF8(params.serialized_value.data()).size(); 721 int64 size = UTF16ToUTF8(params.serialized_value.data()).size();
733 WebIDBTransactionIDToSizeMap* map = 722 WebIDBTransactionIDToSizeMap* map =
734 &parent_->transaction_dispatcher_host_->transaction_size_map_; 723 &parent_->transaction_dispatcher_host_->transaction_size_map_;
735 (*map)[params.ipc_transaction_id] += size; 724 (*map)[params.ipc_transaction_id] += size;
736 } 725 }
737 726
738 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnSetIndexKeys( 727 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnSetIndexKeys(
739 int32 ipc_object_store_id, 728 int32 ipc_object_store_id,
740 const IndexedDBKey& primary_key, 729 const IndexedDBKey& primary_key,
741 const std::vector<int64>& index_names, 730 const std::vector<int64>& index_names,
742 const std::vector<std::vector<IndexedDBKey> >& index_keys, 731 const std::vector<std::vector<IndexedDBKey> >& index_keys,
743 int32 ipc_transaction_id) { 732 int32 ipc_transaction_id) {
744 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); 733 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED));
745 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess( 734 WebIDBObjectStore* idb_object_store = parent_->GetOrTerminateProcess(
746 &map_, ipc_object_store_id); 735 &map_, ipc_object_store_id);
747 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( 736 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess(
748 &parent_->transaction_dispatcher_host_->map_, ipc_transaction_id); 737 &parent_->transaction_dispatcher_host_->map_, ipc_transaction_id);
749
750 if (index_names.size() != index_keys.size()) {
751 idb_transaction->abort();
752 return;
753 }
754
755 if (!idb_transaction || !idb_object_store) 738 if (!idb_transaction || !idb_object_store)
756 return; 739 return;
757 idb_object_store->setIndexKeys(primary_key, 740 idb_object_store->setIndexKeys(primary_key,
758 WebVector<long long>(index_names), 741 WebVector<long long>(index_names),
759 index_keys, *idb_transaction); 742 index_keys, *idb_transaction);
760 } 743 }
761 744
762 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnSetIndexesReady( 745 void IndexedDBDispatcherHost::ObjectStoreDispatcherHost::OnSetIndexesReady(
763 int32 ipc_object_store_id, 746 int32 ipc_object_store_id,
764 const std::vector<int64>& index_ids, 747 const std::vector<int64>& index_ids,
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( 1128 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed(
1146 int32 ipc_object_id) { 1129 int32 ipc_object_id) {
1147 // TODO(dgrogan): This doesn't seem to be happening with some version change 1130 // TODO(dgrogan): This doesn't seem to be happening with some version change
1148 // transactions. Possibly introduced with integer version support. 1131 // transactions. Possibly introduced with integer version support.
1149 transaction_size_map_.erase(ipc_object_id); 1132 transaction_size_map_.erase(ipc_object_id);
1150 transaction_url_map_.erase(ipc_object_id); 1133 transaction_url_map_.erase(ipc_object_id);
1151 parent_->DestroyObject(&map_, ipc_object_id); 1134 parent_->DestroyObject(&map_, ipc_object_id);
1152 } 1135 }
1153 1136
1154 } // namespace content 1137 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698