| 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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 bool IndexedDBDispatcherHost::DatabaseDispatcherHost::OnMessageReceived( | 308 bool IndexedDBDispatcherHost::DatabaseDispatcherHost::OnMessageReceived( |
| 309 const IPC::Message& message, bool* msg_is_ok) { | 309 const IPC::Message& message, bool* msg_is_ok) { |
| 310 bool handled = true; | 310 bool handled = true; |
| 311 IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::DatabaseDispatcherHost, | 311 IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::DatabaseDispatcherHost, |
| 312 message, *msg_is_ok) | 312 message, *msg_is_ok) |
| 313 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseMetadata, OnMetadata) | 313 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseMetadata, OnMetadata) |
| 314 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseCreateObjectStore, | 314 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseCreateObjectStore, |
| 315 OnCreateObjectStore) | 315 OnCreateObjectStore) |
| 316 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDeleteObjectStore, | 316 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDeleteObjectStore, |
| 317 OnDeleteObjectStore) | 317 OnDeleteObjectStore) |
| 318 // TODO(alecflett): Remove this as part of | |
| 319 // https://bugs.webkit.org/show_bug.cgi?id=102733. | |
| 320 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseTransactionOld, OnTransaction) | |
| 321 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseCreateTransaction, | 318 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseCreateTransaction, |
| 322 OnCreateTransaction) | 319 OnCreateTransaction) |
| 323 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseClose, OnClose) | 320 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseClose, OnClose) |
| 324 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDestroyed, OnDestroyed) | 321 IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseDestroyed, OnDestroyed) |
| 325 IPC_MESSAGE_UNHANDLED(handled = false) | 322 IPC_MESSAGE_UNHANDLED(handled = false) |
| 326 IPC_END_MESSAGE_MAP() | 323 IPC_END_MESSAGE_MAP() |
| 327 return handled; | 324 return handled; |
| 328 } | 325 } |
| 329 | 326 |
| 330 void IndexedDBDispatcherHost::DatabaseDispatcherHost::Send( | 327 void IndexedDBDispatcherHost::DatabaseDispatcherHost::Send( |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 &map_, idb_database_id); | 400 &map_, idb_database_id); |
| 404 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( | 401 WebIDBTransaction* idb_transaction = parent_->GetOrTerminateProcess( |
| 405 &parent_->transaction_dispatcher_host_->map_, transaction_id); | 402 &parent_->transaction_dispatcher_host_->map_, transaction_id); |
| 406 if (!idb_database || !idb_transaction) | 403 if (!idb_database || !idb_transaction) |
| 407 return; | 404 return; |
| 408 | 405 |
| 409 *ec = 0; | 406 *ec = 0; |
| 410 idb_database->deleteObjectStore(index_id, *idb_transaction, *ec); | 407 idb_database->deleteObjectStore(index_id, *idb_transaction, *ec); |
| 411 } | 408 } |
| 412 | 409 |
| 413 // TODO(alecflett): Remove this as part of | |
| 414 // https://bugs.webkit.org/show_bug.cgi?id=102733. | |
| 415 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnTransaction( | |
| 416 int32 thread_id, | |
| 417 int32 idb_database_id, | |
| 418 const std::vector<int64>& object_store_ids, | |
| 419 int32 mode, | |
| 420 int32* idb_transaction_id) { | |
| 421 WebIDBDatabase* database = parent_->GetOrTerminateProcess( | |
| 422 &map_, idb_database_id); | |
| 423 if (!database) | |
| 424 return; | |
| 425 | |
| 426 WebVector<long long> object_stores(object_store_ids.size()); | |
| 427 for (size_t i = 0; i < object_store_ids.size(); ++i) | |
| 428 object_stores[i] = object_store_ids[i]; | |
| 429 | |
| 430 WebIDBTransaction* transaction = database->transaction( | |
| 431 object_stores, mode); | |
| 432 *idb_transaction_id = parent_->Add(transaction, thread_id, | |
| 433 database_url_map_[idb_database_id]); | |
| 434 } | |
| 435 | |
| 436 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnCreateTransaction( | 410 void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnCreateTransaction( |
| 437 int32 thread_id, | 411 int32 thread_id, |
| 438 int32 idb_database_id, | 412 int32 idb_database_id, |
| 439 int64 transaction_id, | 413 int64 transaction_id, |
| 440 const std::vector<int64>& object_store_ids, | 414 const std::vector<int64>& object_store_ids, |
| 441 int32 mode, | 415 int32 mode, |
| 442 int32* idb_transaction_id) { | 416 int32* idb_transaction_id) { |
| 443 WebIDBDatabase* database = parent_->GetOrTerminateProcess( | 417 WebIDBDatabase* database = parent_->GetOrTerminateProcess( |
| 444 &map_, idb_database_id); | 418 &map_, idb_database_id); |
| 445 if (!database) | 419 if (!database) |
| (...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1112 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( | 1086 void IndexedDBDispatcherHost::TransactionDispatcherHost::OnDestroyed( |
| 1113 int32 object_id) { | 1087 int32 object_id) { |
| 1114 // TODO(dgrogan): This doesn't seem to be happening with some version change | 1088 // TODO(dgrogan): This doesn't seem to be happening with some version change |
| 1115 // transactions. Possibly introduced with integer version support. | 1089 // transactions. Possibly introduced with integer version support. |
| 1116 transaction_size_map_.erase(object_id); | 1090 transaction_size_map_.erase(object_id); |
| 1117 transaction_url_map_.erase(object_id); | 1091 transaction_url_map_.erase(object_id); |
| 1118 parent_->DestroyObject(&map_, object_id); | 1092 parent_->DestroyObject(&map_, object_id); |
| 1119 } | 1093 } |
| 1120 | 1094 |
| 1121 } // namespace content | 1095 } // namespace content |
| OLD | NEW |