OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/dom_storage/dom_storage_namespace.h" | 5 #include "content/browser/dom_storage/dom_storage_namespace.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/location.h" | 12 #include "base/location.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
15 #include "content/browser/dom_storage/dom_storage_area.h" | 15 #include "content/browser/dom_storage/dom_storage_area.h" |
16 #include "content/browser/dom_storage/dom_storage_context_impl.h" | 16 #include "content/browser/dom_storage/dom_storage_context_impl.h" |
17 #include "content/browser/dom_storage/dom_storage_task_runner.h" | 17 #include "content/browser/dom_storage/dom_storage_task_runner.h" |
18 #include "content/browser/dom_storage/session_storage_database.h" | 18 #include "content/browser/dom_storage/session_storage_database.h" |
19 #include "content/common/child_process_host_impl.h" | |
20 #include "content/common/dom_storage/dom_storage_types.h" | 19 #include "content/common/dom_storage/dom_storage_types.h" |
| 20 #include "content/public/common/child_process_host.h" |
21 | 21 |
22 namespace content { | 22 namespace content { |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 static const unsigned int kMaxTransactionLogEntries = 8 * 1024; | 26 static const unsigned int kMaxTransactionLogEntries = 8 * 1024; |
27 | 27 |
28 } // namespace | 28 } // namespace |
29 | 29 |
30 DOMStorageNamespace::DOMStorageNamespace( | 30 DOMStorageNamespace::DOMStorageNamespace( |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 | 240 |
241 DOMStorageNamespace::AreaHolder* | 241 DOMStorageNamespace::AreaHolder* |
242 DOMStorageNamespace::GetAreaHolder(const GURL& origin) { | 242 DOMStorageNamespace::GetAreaHolder(const GURL& origin) { |
243 AreaMap::iterator found = areas_.find(origin); | 243 AreaMap::iterator found = areas_.find(origin); |
244 if (found == areas_.end()) | 244 if (found == areas_.end()) |
245 return NULL; | 245 return NULL; |
246 return &(found->second); | 246 return &(found->second); |
247 } | 247 } |
248 | 248 |
249 void DOMStorageNamespace::AddTransactionLogProcessId(int process_id) { | 249 void DOMStorageNamespace::AddTransactionLogProcessId(int process_id) { |
250 DCHECK(process_id != ChildProcessHostImpl::kInvalidChildProcessId); | 250 DCHECK(process_id != ChildProcessHost::kInvalidUniqueID); |
251 DCHECK(transactions_.count(process_id) == 0); | 251 DCHECK(transactions_.count(process_id) == 0); |
252 TransactionData* transaction_data = new TransactionData; | 252 TransactionData* transaction_data = new TransactionData; |
253 transactions_[process_id] = transaction_data; | 253 transactions_[process_id] = transaction_data; |
254 } | 254 } |
255 | 255 |
256 void DOMStorageNamespace::RemoveTransactionLogProcessId(int process_id) { | 256 void DOMStorageNamespace::RemoveTransactionLogProcessId(int process_id) { |
257 DCHECK(process_id != ChildProcessHostImpl::kInvalidChildProcessId); | 257 DCHECK(process_id != ChildProcessHost::kInvalidUniqueID); |
258 DCHECK(transactions_.count(process_id) == 1); | 258 DCHECK(transactions_.count(process_id) == 1); |
259 delete transactions_[process_id]; | 259 delete transactions_[process_id]; |
260 transactions_.erase(process_id); | 260 transactions_.erase(process_id); |
261 } | 261 } |
262 | 262 |
263 SessionStorageNamespace::MergeResult DOMStorageNamespace::Merge( | 263 SessionStorageNamespace::MergeResult DOMStorageNamespace::Merge( |
264 bool actually_merge, | 264 bool actually_merge, |
265 int process_id, | 265 int process_id, |
266 DOMStorageNamespace* other, | 266 DOMStorageNamespace* other, |
267 DOMStorageContextImpl* context) { | 267 DOMStorageContextImpl* context) { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 } | 346 } |
347 } | 347 } |
348 other->CloseStorageArea(area); | 348 other->CloseStorageArea(area); |
349 } | 349 } |
350 | 350 |
351 SwitchToNewAliasMaster(other, context); | 351 SwitchToNewAliasMaster(other, context); |
352 return SessionStorageNamespace::MERGE_RESULT_MERGEABLE; | 352 return SessionStorageNamespace::MERGE_RESULT_MERGEABLE; |
353 } | 353 } |
354 | 354 |
355 bool DOMStorageNamespace::IsLoggingRenderer(int process_id) { | 355 bool DOMStorageNamespace::IsLoggingRenderer(int process_id) { |
356 DCHECK(process_id != ChildProcessHostImpl::kInvalidChildProcessId); | 356 DCHECK(process_id != ChildProcessHost::kInvalidUniqueID); |
357 if (transactions_.count(process_id) < 1) | 357 if (transactions_.count(process_id) < 1) |
358 return false; | 358 return false; |
359 return !transactions_[process_id]->max_log_size_exceeded; | 359 return !transactions_[process_id]->max_log_size_exceeded; |
360 } | 360 } |
361 | 361 |
362 void DOMStorageNamespace::AddTransaction( | 362 void DOMStorageNamespace::AddTransaction( |
363 int process_id, const TransactionRecord& transaction) { | 363 int process_id, const TransactionRecord& transaction) { |
364 if (!IsLoggingRenderer(process_id)) | 364 if (!IsLoggingRenderer(process_id)) |
365 return; | 365 return; |
366 TransactionData* transaction_data = transactions_[process_id]; | 366 TransactionData* transaction_data = transactions_[process_id]; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 | 435 |
436 DOMStorageNamespace::AreaHolder::AreaHolder( | 436 DOMStorageNamespace::AreaHolder::AreaHolder( |
437 DOMStorageArea* area, int count) | 437 DOMStorageArea* area, int count) |
438 : area_(area), open_count_(count) { | 438 : area_(area), open_count_(count) { |
439 } | 439 } |
440 | 440 |
441 DOMStorageNamespace::AreaHolder::~AreaHolder() { | 441 DOMStorageNamespace::AreaHolder::~AreaHolder() { |
442 } | 442 } |
443 | 443 |
444 } // namespace content | 444 } // namespace content |
OLD | NEW |