| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "content/browser/dom_storage/dom_storage_area.h" | 10 #include "content/browser/dom_storage/dom_storage_area.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 169 |
| 170 unsigned int DOMStorageNamespace::CountInMemoryAreas() const { | 170 unsigned int DOMStorageNamespace::CountInMemoryAreas() const { |
| 171 unsigned int area_count = 0; | 171 unsigned int area_count = 0; |
| 172 for (AreaMap::const_iterator it = areas_.begin(); it != areas_.end(); ++it) { | 172 for (AreaMap::const_iterator it = areas_.begin(); it != areas_.end(); ++it) { |
| 173 if (it->second.area_->IsLoadedInMemory()) | 173 if (it->second.area_->IsLoadedInMemory()) |
| 174 ++area_count; | 174 ++area_count; |
| 175 } | 175 } |
| 176 return area_count; | 176 return area_count; |
| 177 } | 177 } |
| 178 | 178 |
| 179 void DOMStorageNamespace::OnMemoryDump( |
| 180 base::trace_event::ProcessMemoryDump* pmd) { |
| 181 DCHECK(task_runner_->IsRunningOnPrimarySequence()); |
| 182 for (const auto& it : areas_) |
| 183 it.second.area_->OnMemoryDump(pmd); |
| 184 } |
| 185 |
| 179 DOMStorageNamespace::AreaHolder* | 186 DOMStorageNamespace::AreaHolder* |
| 180 DOMStorageNamespace::GetAreaHolder(const GURL& origin) { | 187 DOMStorageNamespace::GetAreaHolder(const GURL& origin) { |
| 181 AreaMap::iterator found = areas_.find(origin); | 188 AreaMap::iterator found = areas_.find(origin); |
| 182 if (found == areas_.end()) | 189 if (found == areas_.end()) |
| 183 return NULL; | 190 return NULL; |
| 184 return &(found->second); | 191 return &(found->second); |
| 185 } | 192 } |
| 186 | 193 |
| 187 // AreaHolder | 194 // AreaHolder |
| 188 | 195 |
| 189 DOMStorageNamespace::AreaHolder::AreaHolder() | 196 DOMStorageNamespace::AreaHolder::AreaHolder() |
| 190 : open_count_(0) { | 197 : open_count_(0) { |
| 191 } | 198 } |
| 192 | 199 |
| 193 DOMStorageNamespace::AreaHolder::AreaHolder( | 200 DOMStorageNamespace::AreaHolder::AreaHolder( |
| 194 DOMStorageArea* area, int count) | 201 DOMStorageArea* area, int count) |
| 195 : area_(area), open_count_(count) { | 202 : area_(area), open_count_(count) { |
| 196 } | 203 } |
| 197 | 204 |
| 198 DOMStorageNamespace::AreaHolder::AreaHolder(const AreaHolder& other) = default; | 205 DOMStorageNamespace::AreaHolder::AreaHolder(const AreaHolder& other) = default; |
| 199 | 206 |
| 200 DOMStorageNamespace::AreaHolder::~AreaHolder() { | 207 DOMStorageNamespace::AreaHolder::~AreaHolder() { |
| 201 } | 208 } |
| 202 | 209 |
| 203 } // namespace content | 210 } // namespace content |
| OLD | NEW |