| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 return area_count; | 176 return area_count; |
| 177 } | 177 } |
| 178 | 178 |
| 179 void DOMStorageNamespace::OnMemoryDump( | 179 void DOMStorageNamespace::OnMemoryDump( |
| 180 base::trace_event::ProcessMemoryDump* pmd) { | 180 base::trace_event::ProcessMemoryDump* pmd) { |
| 181 DCHECK(task_runner_->IsRunningOnPrimarySequence()); | 181 DCHECK(task_runner_->IsRunningOnPrimarySequence()); |
| 182 for (const auto& it : areas_) | 182 for (const auto& it : areas_) |
| 183 it.second.area_->OnMemoryDump(pmd); | 183 it.second.area_->OnMemoryDump(pmd); |
| 184 } | 184 } |
| 185 | 185 |
| 186 void DOMStorageNamespace::GetOriginsWithAreas( |
| 187 std::vector<GURL>* origins) const { |
| 188 origins->clear(); |
| 189 for (const auto& entry : areas_) |
| 190 origins->push_back(entry.first); |
| 191 } |
| 192 |
| 186 DOMStorageNamespace::AreaHolder* | 193 DOMStorageNamespace::AreaHolder* |
| 187 DOMStorageNamespace::GetAreaHolder(const GURL& origin) { | 194 DOMStorageNamespace::GetAreaHolder(const GURL& origin) { |
| 188 AreaMap::iterator found = areas_.find(origin); | 195 AreaMap::iterator found = areas_.find(origin); |
| 189 if (found == areas_.end()) | 196 if (found == areas_.end()) |
| 190 return NULL; | 197 return NULL; |
| 191 return &(found->second); | 198 return &(found->second); |
| 192 } | 199 } |
| 193 | 200 |
| 194 // AreaHolder | 201 // AreaHolder |
| 195 | 202 |
| 196 DOMStorageNamespace::AreaHolder::AreaHolder() | 203 DOMStorageNamespace::AreaHolder::AreaHolder() |
| 197 : open_count_(0) { | 204 : open_count_(0) { |
| 198 } | 205 } |
| 199 | 206 |
| 200 DOMStorageNamespace::AreaHolder::AreaHolder( | 207 DOMStorageNamespace::AreaHolder::AreaHolder( |
| 201 DOMStorageArea* area, int count) | 208 DOMStorageArea* area, int count) |
| 202 : area_(area), open_count_(count) { | 209 : area_(area), open_count_(count) { |
| 203 } | 210 } |
| 204 | 211 |
| 205 DOMStorageNamespace::AreaHolder::AreaHolder(const AreaHolder& other) = default; | 212 DOMStorageNamespace::AreaHolder::AreaHolder(const AreaHolder& other) = default; |
| 206 | 213 |
| 207 DOMStorageNamespace::AreaHolder::~AreaHolder() { | 214 DOMStorageNamespace::AreaHolder::~AreaHolder() { |
| 208 } | 215 } |
| 209 | 216 |
| 210 } // namespace content | 217 } // namespace content |
| OLD | NEW |