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/indexed_db/indexed_db_dispatcher_host.h" | 5 #include "content/browser/indexed_db/indexed_db_dispatcher_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/guid.h" | 10 #include "base/guid.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 database_dispatcher_host_->transaction_url_map_[host_transaction_id] = url; | 186 database_dispatcher_host_->transaction_url_map_[host_transaction_id] = url; |
187 } | 187 } |
188 | 188 |
189 int64 IndexedDBDispatcherHost::HostTransactionId(int64 transaction_id) { | 189 int64 IndexedDBDispatcherHost::HostTransactionId(int64 transaction_id) { |
190 // Inject the renderer process id into the transaction id, to | 190 // Inject the renderer process id into the transaction id, to |
191 // uniquely identify this transaction, and effectively bind it to | 191 // uniquely identify this transaction, and effectively bind it to |
192 // the renderer that initiated it. The lower 32 bits of | 192 // the renderer that initiated it. The lower 32 bits of |
193 // transaction_id are guaranteed to be unique within that renderer. | 193 // transaction_id are guaranteed to be unique within that renderer. |
194 base::ProcessId pid = peer_pid(); | 194 base::ProcessId pid = peer_pid(); |
195 DCHECK(!(transaction_id >> 32)) << "Transaction ids can only be 32 bits"; | 195 DCHECK(!(transaction_id >> 32)) << "Transaction ids can only be 32 bits"; |
196 COMPILE_ASSERT(sizeof(base::ProcessId) <= sizeof(int32), | 196 static_assert(sizeof(base::ProcessId) <= sizeof(int32), |
197 Process_ID_must_fit_in_32_bits); | 197 "Process ID must fit in 32 bits"); |
198 | 198 |
199 return transaction_id | (static_cast<uint64>(pid) << 32); | 199 return transaction_id | (static_cast<uint64>(pid) << 32); |
200 } | 200 } |
201 | 201 |
202 int64 IndexedDBDispatcherHost::RendererTransactionId( | 202 int64 IndexedDBDispatcherHost::RendererTransactionId( |
203 int64 host_transaction_id) { | 203 int64 host_transaction_id) { |
204 DCHECK(host_transaction_id >> 32 == peer_pid()) | 204 DCHECK(host_transaction_id >> 32 == peer_pid()) |
205 << "Invalid renderer target for transaction id"; | 205 << "Invalid renderer target for transaction id"; |
206 return host_transaction_id & 0xffffffff; | 206 return host_transaction_id & 0xffffffff; |
207 } | 207 } |
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1021 } | 1021 } |
1022 | 1022 |
1023 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( | 1023 void IndexedDBDispatcherHost::CursorDispatcherHost::OnDestroyed( |
1024 int32 ipc_object_id) { | 1024 int32 ipc_object_id) { |
1025 DCHECK( | 1025 DCHECK( |
1026 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); | 1026 parent_->indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread()); |
1027 parent_->DestroyObject(&map_, ipc_object_id); | 1027 parent_->DestroyObject(&map_, ipc_object_id); |
1028 } | 1028 } |
1029 | 1029 |
1030 } // namespace content | 1030 } // namespace content |
OLD | NEW |