Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Side by Side Diff: content/browser/dom_storage/dom_storage_namespace.cc

Issue 1900793003: Allow to clear session and local storage when not backed on disk (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 19 matching lines...) Expand all
30 : namespace_id_(namespace_id), 30 : namespace_id_(namespace_id),
31 persistent_namespace_id_(persistent_namespace_id), 31 persistent_namespace_id_(persistent_namespace_id),
32 task_runner_(task_runner), 32 task_runner_(task_runner),
33 session_storage_database_(session_storage_database) { 33 session_storage_database_(session_storage_database) {
34 DCHECK_NE(kLocalStorageNamespaceId, namespace_id); 34 DCHECK_NE(kLocalStorageNamespaceId, namespace_id);
35 } 35 }
36 36
37 DOMStorageNamespace::~DOMStorageNamespace() { 37 DOMStorageNamespace::~DOMStorageNamespace() {
38 } 38 }
39 39
40 void DOMStorageNamespace::ReadOrigins(std::vector<GURL>* origins) const {
41 origins->clear();
42 for (AreaMap::const_iterator it = areas_.begin(); it != areas_.end(); ++it)
michaeln 2016/05/05 00:38:23 range based for loop please for (const auto& entr
Julien Isorce Samsung 2016/05/05 11:05:04 Done.
43 origins->push_back(it->first);
44 }
45
40 DOMStorageArea* DOMStorageNamespace::OpenStorageArea(const GURL& origin) { 46 DOMStorageArea* DOMStorageNamespace::OpenStorageArea(const GURL& origin) {
41 if (AreaHolder* holder = GetAreaHolder(origin)) { 47 if (AreaHolder* holder = GetAreaHolder(origin)) {
42 ++(holder->open_count_); 48 ++(holder->open_count_);
43 return holder->area_.get(); 49 return holder->area_.get();
44 } 50 }
45 DOMStorageArea* area; 51 DOMStorageArea* area;
46 if (namespace_id_ == kLocalStorageNamespaceId) { 52 if (namespace_id_ == kLocalStorageNamespaceId) {
47 area = new DOMStorageArea(origin, directory_, task_runner_.get()); 53 area = new DOMStorageArea(origin, directory_, task_runner_.get());
48 } else { 54 } else {
49 area = new DOMStorageArea( 55 area = new DOMStorageArea(
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 DOMStorageArea* area, int count) 200 DOMStorageArea* area, int count)
195 : area_(area), open_count_(count) { 201 : area_(area), open_count_(count) {
196 } 202 }
197 203
198 DOMStorageNamespace::AreaHolder::AreaHolder(const AreaHolder& other) = default; 204 DOMStorageNamespace::AreaHolder::AreaHolder(const AreaHolder& other) = default;
199 205
200 DOMStorageNamespace::AreaHolder::~AreaHolder() { 206 DOMStorageNamespace::AreaHolder::~AreaHolder() {
201 } 207 }
202 208
203 } // namespace content 209 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698