| 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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 bool IndexedDBDispatcherHost::DatabaseDispatcherHost::OnMessageReceived( | 306 bool IndexedDBDispatcherHost::DatabaseDispatcherHost::OnMessageReceived( |
| 307 const IPC::Message& message, bool* msg_is_ok) { | 307 const IPC::Message& message, bool* msg_is_ok) { |
| 308 bool handled = true; | 308 bool handled = true; |
| 309 IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::DatabaseDispatcherHost, | 309 IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::DatabaseDispatcherHost, |
| 310 message, *msg_is_ok) | 310 message, *msg_is_ok) |
| 311 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseMetadata, OnMetadata) | 311 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseMetadata, OnMetadata) |
| 312 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseCreateObjectStore, | 312 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseCreateObjectStore, |
| 313 OnCreateObjectStore) | 313 OnCreateObjectStore) |
| 314 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDeleteObjectStore, | 314 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDeleteObjectStore, |
| 315 OnDeleteObjectStore) | 315 OnDeleteObjectStore) |
| 316 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseSetVersion, OnSetVersion) | |
| 317 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseTransaction, OnTransaction) | 316 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseTransaction, OnTransaction) |
| 318 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseClose, OnClose) | 317 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseClose, OnClose) |
| 319 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDestroyed, OnDestroyed) | 318 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDestroyed, OnDestroyed) |
| 320 IPC_MESSAGE_UNHANDLED(handled = false) | 319 IPC_MESSAGE_UNHANDLED(handled = false) |
| 321 IPC_END_MESSAGE_MAP() | 320 IPC_END_MESSAGE_MAP() |
| 322 return handled; | 321 return handled; |
| 323 } | 322 } |
| 324 | 323 |
| 325 void IndexedDBDispatcherHost::DatabaseDispatcherHost::Send( | 324 void IndexedDBDispatcherHost::DatabaseDispatcherHost::Send( |
| 326 IPC::Message* message) { | 325 IPC::Message* message) { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 &map_, idb_database_id); | 397 &map_, idb_database_id); |
| 399 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( | 398 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( |
| 400 &parent_->transaction_dispatcher_host_->map_, transaction_id); | 399 &parent_->transaction_dispatcher_host_->map_, transaction_id); |
| 401 if (!idb_database || !idb_transaction) | 400 if (!idb_database || !idb_transaction) |
| 402 return; | 401 return; |
| 403 | 402 |
| 404 *ec = 0; | 403 *ec = 0; |
| 405 idb_database->deleteObjectStore(index_id, *idb_transaction, *ec); | 404 idb_database->deleteObjectStore(index_id, *idb_transaction, *ec); |
| 406 } | 405 } |
| 407 | 406 |
| 408 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnSetVersion( | |
| 409 int32 idb_database_id, | |
| 410 int32 thread_id, | |
| 411 int32 response_id, | |
| 412 const string16& version, | |
| 413 WebKit::WebExceptionCode* ec) { | |
| 414 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT_DEPRECATED)); | |
| 415 WebIDBDatabase* idb_database = parent_->GetOrTerminateProcess( | |
| 416 &map_, idb_database_id); | |
| 417 if (!idb_database) | |
| 418 return; | |
| 419 | |
| 420 *ec = 0; | |
| 421 idb_database->setVersion( | |
| 422 version, | |
| 423 new IndexedDBCallbacksTransaction(parent_, thread_id, response_id, | |
| 424 database_url_map_[idb_database_id]), | |
| 425 *ec); | |
| 426 } | |
| 427 | |
| 428 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnTransaction( | 407 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnTransaction( |
| 429 int32 thread_id, | 408 int32 thread_id, |
| 430 int32 idb_database_id, | 409 int32 idb_database_id, |
| 431 const std::vector<int64>& object_store_ids, | 410 const std::vector<int64>& object_store_ids, |
| 432 int32 mode, | 411 int32 mode, |
| 433 int32* idb_transaction_id) { | 412 int32* idb_transaction_id) { |
| 434 WebIDBDatabase* database = parent_->GetOrTerminateProcess( | 413 WebIDBDatabase* database = parent_->GetOrTerminateProcess( |
| 435 &map_, idb_database_id); | 414 &map_, idb_database_id); |
| 436 if (!database) | 415 if (!database) |
| 437 return; | 416 return; |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1092 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( | 1071 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( |
| 1093 int32 object_id) { | 1072 int32 object_id) { |
| 1094 // TODO(dgrogan): This doesn't seem to be happening with some version change | 1073 // TODO(dgrogan): This doesn't seem to be happening with some version change |
| 1095 // transactions. Possibly introduced with integer version support. | 1074 // transactions. Possibly introduced with integer version support. |
| 1096 transaction_size_map_.erase(object_id); | 1075 transaction_size_map_.erase(object_id); |
| 1097 transaction_url_map_.erase(object_id); | 1076 transaction_url_map_.erase(object_id); |
| 1098 parent_->DestroyObject(&map_, object_id); | 1077 parent_->DestroyObject(&map_, object_id); |
| 1099 } | 1078 } |
| 1100 | 1079 |
| 1101 } // namespace content | 1080 } // namespace content |
| OLD | NEW |