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/common/indexed_db/proxy_webidbdatabase_impl.h" | 5 #include "content/common/indexed_db/proxy_webidbdatabase_impl.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "content/common/child_thread.h" | 9 #include "content/common/child_thread.h" |
10 #include "content/common/indexed_db/indexed_db_messages.h" | 10 #include "content/common/indexed_db/indexed_db_messages.h" |
11 #include "content/common/indexed_db/indexed_db_dispatcher.h" | 11 #include "content/common/indexed_db/indexed_db_dispatcher.h" |
12 #include "content/common/indexed_db/proxy_webidbobjectstore_impl.h" | |
13 #include "content/common/indexed_db/proxy_webidbtransaction_impl.h" | 12 #include "content/common/indexed_db/proxy_webidbtransaction_impl.h" |
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" | 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" |
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebVector.h" | 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebVector.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyPath.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyPath.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBMetadata.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBMetadata.h" |
18 #include "webkit/glue/worker_task_runner.h" | 17 #include "webkit/glue/worker_task_runner.h" |
19 | 18 |
20 using WebKit::WebDOMStringList; | 19 using WebKit::WebDOMStringList; |
21 using WebKit::WebExceptionCode; | 20 using WebKit::WebExceptionCode; |
22 using WebKit::WebFrame; | 21 using WebKit::WebFrame; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 web_index_metadata.name = idb_index_metadata.name; | 84 web_index_metadata.name = idb_index_metadata.name; |
86 web_index_metadata.keyPath = idb_index_metadata.keyPath; | 85 web_index_metadata.keyPath = idb_index_metadata.keyPath; |
87 web_index_metadata.unique = idb_index_metadata.unique; | 86 web_index_metadata.unique = idb_index_metadata.unique; |
88 web_index_metadata.multiEntry = idb_index_metadata.multiEntry; | 87 web_index_metadata.multiEntry = idb_index_metadata.multiEntry; |
89 } | 88 } |
90 } | 89 } |
91 | 90 |
92 return web_metadata; | 91 return web_metadata; |
93 } | 92 } |
94 | 93 |
95 WebKit::WebIDBObjectStore* RendererWebIDBDatabaseImpl::createObjectStore( | |
96 long long id, | |
97 const WebKit::WebString& name, | |
98 const WebKit::WebIDBKeyPath& key_path, | |
99 bool auto_increment, | |
100 const WebKit::WebIDBTransaction& transaction, | |
101 WebExceptionCode& ec) { | |
102 IndexedDBHostMsg_DatabaseCreateObjectStoreOld_Params params; | |
103 params.id = id; | |
104 params.name = name; | |
105 params.key_path = IndexedDBKeyPath(key_path); | |
106 params.auto_increment = auto_increment; | |
107 params.ipc_transaction_id = IndexedDBDispatcher::TransactionId(transaction); | |
108 params.ipc_database_id = ipc_database_id_; | |
109 | |
110 int object_store; | |
111 IndexedDBDispatcher::Send( | |
112 new IndexedDBHostMsg_DatabaseCreateObjectStoreOld( | |
113 params, &object_store, &ec)); | |
114 if (!object_store) | |
115 return NULL; | |
116 return new RendererWebIDBObjectStoreImpl(object_store); | |
117 } | |
118 | |
119 void RendererWebIDBDatabaseImpl::createObjectStore( | 94 void RendererWebIDBDatabaseImpl::createObjectStore( |
120 long long transaction_id, | 95 long long transaction_id, |
121 long long object_store_id, | 96 long long object_store_id, |
122 const WebKit::WebString& name, | 97 const WebKit::WebString& name, |
123 const WebKit::WebIDBKeyPath& key_path, | 98 const WebKit::WebIDBKeyPath& key_path, |
124 bool auto_increment) { | 99 bool auto_increment) { |
125 IndexedDBHostMsg_DatabaseCreateObjectStore_Params params; | 100 IndexedDBHostMsg_DatabaseCreateObjectStore_Params params; |
126 params.ipc_database_id = ipc_database_id_; | 101 params.ipc_database_id = ipc_database_id_; |
127 params.transaction_id = transaction_id; | 102 params.transaction_id = transaction_id; |
128 params.object_store_id = object_store_id; | 103 params.object_store_id = object_store_id; |
129 params.name = name; | 104 params.name = name; |
130 params.key_path = IndexedDBKeyPath(key_path); | 105 params.key_path = IndexedDBKeyPath(key_path); |
131 params.auto_increment = auto_increment; | 106 params.auto_increment = auto_increment; |
132 | 107 |
133 IndexedDBDispatcher::Send( | 108 IndexedDBDispatcher::Send( |
134 new IndexedDBHostMsg_DatabaseCreateObjectStore(params)); | 109 new IndexedDBHostMsg_DatabaseCreateObjectStore(params)); |
135 } | 110 } |
136 | 111 |
137 void RendererWebIDBDatabaseImpl::deleteObjectStore( | 112 void RendererWebIDBDatabaseImpl::deleteObjectStore( |
138 long long object_store_id, | |
139 const WebIDBTransaction& transaction, | |
140 WebExceptionCode& ec) { | |
141 IndexedDBDispatcher::Send( | |
142 new IndexedDBHostMsg_DatabaseDeleteObjectStoreOld( | |
143 ipc_database_id_, object_store_id, | |
144 IndexedDBDispatcher::TransactionId(transaction), &ec)); | |
145 } | |
146 | |
147 void RendererWebIDBDatabaseImpl::deleteObjectStore( | |
148 long long transaction_id, | 113 long long transaction_id, |
149 long long object_store_id) { | 114 long long object_store_id) { |
150 IndexedDBDispatcher::Send( | 115 IndexedDBDispatcher::Send( |
151 new IndexedDBHostMsg_DatabaseDeleteObjectStore( | 116 new IndexedDBHostMsg_DatabaseDeleteObjectStore( |
152 ipc_database_id_, | 117 ipc_database_id_, |
153 transaction_id, | 118 transaction_id, |
154 object_store_id)); | 119 object_store_id)); |
155 } | 120 } |
156 | 121 |
157 WebKit::WebIDBTransaction* RendererWebIDBDatabaseImpl::createTransaction( | 122 WebKit::WebIDBTransaction* RendererWebIDBDatabaseImpl::createTransaction( |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 long long object_store_id, | 295 long long object_store_id, |
331 long long index_id) | 296 long long index_id) |
332 { | 297 { |
333 IndexedDBDispatcher::Send( | 298 IndexedDBDispatcher::Send( |
334 new IndexedDBHostMsg_DatabaseDeleteIndex( | 299 new IndexedDBHostMsg_DatabaseDeleteIndex( |
335 ipc_database_id_, | 300 ipc_database_id_, |
336 transaction_id, | 301 transaction_id, |
337 object_store_id, index_id)); | 302 object_store_id, index_id)); |
338 } | 303 } |
339 } // namespace content | 304 } // namespace content |
OLD | NEW |