Chromium Code Reviews| Index: content/browser/indexed_db/indexed_db_dispatcher_host.cc |
| diff --git a/content/browser/indexed_db/indexed_db_dispatcher_host.cc b/content/browser/indexed_db/indexed_db_dispatcher_host.cc |
| index acde65a876dd0af484c00a24d43abe0472e8b055..c13ff7dd7bffb22180bcf057217275d9b12b575c 100644 |
| --- a/content/browser/indexed_db/indexed_db_dispatcher_host.cc |
| +++ b/content/browser/indexed_db/indexed_db_dispatcher_host.cc |
| @@ -20,6 +20,7 @@ |
| #include "content/browser/indexed_db/indexed_db_context_impl.h" |
| #include "content/browser/indexed_db/indexed_db_database_callbacks.h" |
| #include "content/browser/indexed_db/indexed_db_pending_connection.h" |
| +#include "content/browser/indexed_db/indexed_db_transaction.h" |
| #include "content/browser/indexed_db/indexed_db_value.h" |
| #include "content/browser/renderer_host/render_message_filter.h" |
| #include "content/common/indexed_db/indexed_db_messages.h" |
| @@ -103,61 +104,6 @@ bool IndexedDBDispatcherHost::OnMessageReceived(const IPC::Message& message) { |
| return false; |
| } |
| -bool IndexedDBDispatcherHost::RegisterTransactionId(int64_t host_transaction_id, |
| - const url::Origin& origin) { |
| - if (base::ContainsKey(transaction_size_map_, host_transaction_id)) |
| - return false; |
| - transaction_size_map_[host_transaction_id] = 0; |
| - transaction_origin_map_[host_transaction_id] = origin; |
| - return true; |
| -} |
| - |
| -bool IndexedDBDispatcherHost::GetTransactionSize(int64_t host_transaction_id, |
| - int64_t* transaction_size) { |
| - const auto it = transaction_size_map_.find(host_transaction_id); |
| - if (it == transaction_size_map_.end()) |
| - return false; |
| - *transaction_size = it->second; |
| - return true; |
| -} |
| - |
| -void IndexedDBDispatcherHost::AddToTransaction(int64_t host_transaction_id, |
| - int64_t value_length) { |
| - transaction_size_map_[host_transaction_id] += value_length; |
| -} |
| - |
| -int64_t IndexedDBDispatcherHost::HostTransactionId(int64_t transaction_id) { |
| - // Inject the renderer process id into the transaction id, to |
| - // uniquely identify this transaction, and effectively bind it to |
| - // the renderer that initiated it. The lower 32 bits of |
| - // transaction_id are guaranteed to be unique within that renderer. |
| - base::ProcessId pid = peer_pid(); |
| - DCHECK(!(transaction_id >> 32)) << "Transaction ids can only be 32 bits"; |
| - static_assert(sizeof(base::ProcessId) <= sizeof(int32_t), |
| - "Process ID must fit in 32 bits"); |
| - |
| - return transaction_id | (static_cast<uint64_t>(pid) << 32); |
| -} |
| - |
| -int64_t IndexedDBDispatcherHost::RendererTransactionId( |
| - int64_t host_transaction_id) { |
| - DCHECK(host_transaction_id >> 32 == peer_pid()) |
| - << "Invalid renderer target for transaction id"; |
| - return host_transaction_id & 0xffffffff; |
| -} |
| - |
| -// static |
| -uint32_t IndexedDBDispatcherHost::TransactionIdToRendererTransactionId( |
| - int64_t host_transaction_id) { |
| - return host_transaction_id & 0xffffffff; |
| -} |
| - |
| -// static |
| -uint32_t IndexedDBDispatcherHost::TransactionIdToProcessId( |
| - int64_t host_transaction_id) { |
| - return (host_transaction_id >> 32) & 0xffffffff; |
| -} |
| - |
| std::string IndexedDBDispatcherHost::HoldBlobData( |
| const IndexedDBBlobInfo& blob_info) { |
| DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| @@ -289,15 +235,13 @@ void IndexedDBDispatcherHost::OpenOnIDBThread( |
| base::TimeTicks begin_time = base::TimeTicks::Now(); |
| base::FilePath indexed_db_path = indexed_db_context_->data_path(); |
| - int64_t host_transaction_id = HostTransactionId(transaction_id); |
| - |
| // TODO(dgrogan): Don't let a non-existing database be opened (and therefore |
| // created) if this origin is already over quota. |
| callbacks->SetConnectionOpenStartTime(begin_time); |
| - callbacks->set_host_transaction_id(host_transaction_id); |
| + callbacks->set_host_transaction_id(transaction_id); |
|
Reilly Grant (use Gerrit)
2016/11/30 16:32:26
This isn't necessary anymore now that OnUpgradeNee
dmurph
2016/11/30 23:13:07
Done.
|
| std::unique_ptr<IndexedDBPendingConnection> connection = |
| base::MakeUnique<IndexedDBPendingConnection>( |
| - callbacks, database_callbacks, ipc_process_id_, host_transaction_id, |
| + callbacks, database_callbacks, ipc_process_id_, transaction_id, |
| version); |
| DCHECK(request_context_getter_); |
| context()->GetIDBFactory()->Open(name, std::move(connection), |
| @@ -317,15 +261,10 @@ void IndexedDBDispatcherHost::DeleteDatabaseOnIDBThread( |
| name, request_context_getter_, callbacks, origin, indexed_db_path); |
| } |
| -void IndexedDBDispatcherHost::FinishTransaction(int64_t host_transaction_id, |
| - bool committed) { |
| +void IndexedDBDispatcherHost::NotifyTransactionCommitted( |
| + const url::Origin& transaction_origin) { |
| DCHECK(indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); |
| - if (committed) { |
| - context()->TransactionComplete( |
| - transaction_origin_map_[host_transaction_id]); |
| - } |
| - transaction_origin_map_.erase(host_transaction_id); |
| - transaction_size_map_.erase(host_transaction_id); |
| + context()->TransactionComplete(transaction_origin); |
| } |
| } // namespace content |