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 <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" |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
132 message, message_was_ok) || | 132 message, message_was_ok) || |
133 cursor_dispatcher_host_->OnMessageReceived(message, message_was_ok) || | 133 cursor_dispatcher_host_->OnMessageReceived(message, message_was_ok) || |
134 transaction_dispatcher_host_->OnMessageReceived(message, message_was_ok); | 134 transaction_dispatcher_host_->OnMessageReceived(message, message_was_ok); |
135 | 135 |
136 if (!handled) { | 136 if (!handled) { |
137 handled = true; | 137 handled = true; |
138 IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost, message, *message_was_ok) | 138 IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost, message, *message_was_ok) |
139 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_FactoryGetDatabaseNames, | 139 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_FactoryGetDatabaseNames, |
140 OnIDBFactoryGetDatabaseNames) | 140 OnIDBFactoryGetDatabaseNames) |
141 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_FactoryOpen, OnIDBFactoryOpen) | 141 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_FactoryOpen, OnIDBFactoryOpen) |
142 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_FactoryOpenLegacy, | |
143 OnIDBFactoryOpenLegacy) | |
142 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_FactoryDeleteDatabase, | 144 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_FactoryDeleteDatabase, |
143 OnIDBFactoryDeleteDatabase) | 145 OnIDBFactoryDeleteDatabase) |
144 IPC_MESSAGE_UNHANDLED(handled = false) | 146 IPC_MESSAGE_UNHANDLED(handled = false) |
145 IPC_END_MESSAGE_MAP() | 147 IPC_END_MESSAGE_MAP() |
146 } | 148 } |
147 | 149 |
148 return handled; | 150 return handled; |
149 } | 151 } |
150 | 152 |
151 int32 IndexedDBDispatcherHost::Add(WebIDBCursor* idb_cursor) { | 153 int32 IndexedDBDispatcherHost::Add(WebIDBCursor* idb_cursor) { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
215 | 217 |
216 WebSecurityOrigin origin( | 218 WebSecurityOrigin origin( |
217 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin)); | 219 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin)); |
218 | 220 |
219 Context()->GetIDBFactory()->getDatabaseNames( | 221 Context()->GetIDBFactory()->getDatabaseNames( |
220 new IndexedDBCallbacks<WebDOMStringList>(this, params.thread_id, | 222 new IndexedDBCallbacks<WebDOMStringList>(this, params.thread_id, |
221 params.response_id), origin, NULL, | 223 params.response_id), origin, NULL, |
222 webkit_glue::FilePathToWebString(indexed_db_path)); | 224 webkit_glue::FilePathToWebString(indexed_db_path)); |
223 } | 225 } |
224 | 226 |
227 // TODO(jsbell): Remove once WK90411 has rolled. | |
228 void IndexedDBDispatcherHost::OnIDBFactoryOpenLegacy( | |
229 const IndexedDBHostMsg_FactoryOpen_Params& params) { | |
230 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | |
231 FilePath indexed_db_path = indexed_db_context_->data_path(); | |
232 | |
233 GURL origin_url = DatabaseUtil::GetOriginFromIdentifier(params.origin); | |
234 WebSecurityOrigin origin( | |
235 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin)); | |
236 | |
237 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | |
238 | |
239 // TODO(dgrogan): Don't let a non-existing database be opened (and therefore | |
240 // created) if this origin is already over quota. | |
241 Context()->GetIDBFactory()->open( | |
242 params.name, | |
243 params.version, | |
244 new IndexedDBCallbacksDatabase(this, params.thread_id, | |
245 params.response_id, origin_url), | |
246 origin, NULL, webkit_glue::FilePathToWebString(indexed_db_path)); | |
247 } | |
248 | |
225 void IndexedDBDispatcherHost::OnIDBFactoryOpen( | 249 void IndexedDBDispatcherHost::OnIDBFactoryOpen( |
226 const IndexedDBHostMsg_FactoryOpen_Params& params) { | 250 const IndexedDBHostMsg_FactoryOpen_Params& params) { |
227 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 251 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
228 FilePath indexed_db_path = indexed_db_context_->data_path(); | 252 FilePath indexed_db_path = indexed_db_context_->data_path(); |
229 | 253 |
230 GURL origin_url = DatabaseUtil::GetOriginFromIdentifier(params.origin); | 254 GURL origin_url = DatabaseUtil::GetOriginFromIdentifier(params.origin); |
231 WebSecurityOrigin origin( | 255 WebSecurityOrigin origin( |
232 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin)); | 256 WebSecurityOrigin::createFromDatabaseIdentifier(params.origin)); |
233 | 257 |
234 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 258 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
235 | 259 |
236 // TODO(dgrogan): Don't let a non-existing database be opened (and therefore | 260 // TODO(dgrogan): Don't let a non-existing database be opened (and therefore |
237 // created) if this origin is already over quota. | 261 // created) if this origin is already over quota. |
238 Context()->GetIDBFactory()->open( | 262 Context()->GetIDBFactory()->open( |
dgrogan
2012/09/07 00:42:49
WebIDBFactory doesn't have a function with this si
| |
239 params.name, | 263 params.name, |
240 params.version, | 264 params.version, |
241 new IndexedDBCallbacksDatabase(this, params.thread_id, | 265 new IndexedDBCallbacksDatabase(this, params.thread_id, |
242 params.response_id, origin_url), | 266 params.response_id, origin_url), |
267 new IndexedDBDatabaseCallbacks(this, params.thread_id, | |
268 params.database_response_id), | |
243 origin, NULL, webkit_glue::FilePathToWebString(indexed_db_path)); | 269 origin, NULL, webkit_glue::FilePathToWebString(indexed_db_path)); |
244 } | 270 } |
245 | 271 |
246 void IndexedDBDispatcherHost::OnIDBFactoryDeleteDatabase( | 272 void IndexedDBDispatcherHost::OnIDBFactoryDeleteDatabase( |
247 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& params) { | 273 const IndexedDBHostMsg_FactoryDeleteDatabase_Params& params) { |
248 FilePath indexed_db_path = indexed_db_context_->data_path(); | 274 FilePath indexed_db_path = indexed_db_context_->data_path(); |
249 | 275 |
250 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | 276 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); |
251 Context()->GetIDBFactory()->deleteDatabase( | 277 Context()->GetIDBFactory()->deleteDatabase( |
252 params.name, | 278 params.name, |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
445 | 471 |
446 *ec = 0; | 472 *ec = 0; |
447 WebIDBTransaction* transaction = database->transaction( | 473 WebIDBTransaction* transaction = database->transaction( |
448 object_stores, mode, *ec); | 474 object_stores, mode, *ec); |
449 DCHECK(!transaction != !*ec); | 475 DCHECK(!transaction != !*ec); |
450 *idb_transaction_id = | 476 *idb_transaction_id = |
451 *ec ? 0 : parent_->Add(transaction, thread_id, | 477 *ec ? 0 : parent_->Add(transaction, thread_id, |
452 database_url_map_[idb_database_id]); | 478 database_url_map_[idb_database_id]); |
453 } | 479 } |
454 | 480 |
481 // TODO(jsbell): Remove once WK90411 has rolled. | |
455 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnOpen( | 482 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnOpen( |
456 int32 idb_database_id, int32 thread_id, int32 response_id) { | 483 int32 idb_database_id, int32 thread_id, int32 response_id) { |
457 WebIDBDatabase* database = parent_->GetOrTerminateProcess( | 484 WebIDBDatabase* database = parent_->GetOrTerminateProcess( |
458 &map_, idb_database_id); | 485 &map_, idb_database_id); |
459 if (!database) | 486 if (!database) |
460 return; | 487 return; |
461 database->open(new IndexedDBDatabaseCallbacks(parent_, thread_id, | 488 database->open(new IndexedDBDatabaseCallbacks(parent_, thread_id, |
462 response_id)); | 489 response_id)); |
463 } | 490 } |
464 | 491 |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1108 } | 1135 } |
1109 | 1136 |
1110 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( | 1137 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( |
1111 int32 object_id) { | 1138 int32 object_id) { |
1112 // TODO(dgrogan): This doesn't seem to be happening with some version change | 1139 // TODO(dgrogan): This doesn't seem to be happening with some version change |
1113 // transactions. Possibly introduced with integer version support. | 1140 // transactions. Possibly introduced with integer version support. |
1114 transaction_size_map_.erase(object_id); | 1141 transaction_size_map_.erase(object_id); |
1115 transaction_url_map_.erase(object_id); | 1142 transaction_url_map_.erase(object_id); |
1116 parent_->DestroyObject(&map_, object_id); | 1143 parent_->DestroyObject(&map_, object_id); |
1117 } | 1144 } |
OLD | NEW |