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

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

Issue 2622603002: Delete session area when session storage for an origin is deleted. (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/dom_storage/dom_storage_context_impl.h" 5 #include "content/browser/dom_storage/dom_storage_context_impl.h"
6 6
7 #include <inttypes.h> 7 #include <inttypes.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 10
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 persistent_namespace_id_to_namespace_id_.find( 249 persistent_namespace_id_to_namespace_id_.find(
250 usage_info.persistent_namespace_id); 250 usage_info.persistent_namespace_id);
251 if (it != persistent_namespace_id_to_namespace_id_.end()) { 251 if (it != persistent_namespace_id_to_namespace_id_.end()) {
252 dom_storage_namespace = GetStorageNamespace(it->second); 252 dom_storage_namespace = GetStorageNamespace(it->second);
253 } else { 253 } else {
254 int64_t namespace_id = AllocateSessionId(); 254 int64_t namespace_id = AllocateSessionId();
255 CreateSessionNamespace(namespace_id, usage_info.persistent_namespace_id); 255 CreateSessionNamespace(namespace_id, usage_info.persistent_namespace_id);
256 dom_storage_namespace = GetStorageNamespace(namespace_id); 256 dom_storage_namespace = GetStorageNamespace(namespace_id);
257 } 257 }
258 dom_storage_namespace->DeleteSessionStorageOrigin(usage_info.origin); 258 dom_storage_namespace->DeleteSessionStorageOrigin(usage_info.origin);
259 if (session_storage_database_.get()) {
260 task_runner_->PostShutdownBlockingTask(
261 FROM_HERE, DOMStorageTaskRunner::COMMIT_SEQUENCE,
262 base::Bind(base::IgnoreResult(&SessionStorageDatabase::DeleteArea),
263 session_storage_database_,
264 usage_info.persistent_namespace_id, usage_info.origin));
265 }
259 // Synthesize a 'cleared' event if the area is open so CachedAreas in 266 // Synthesize a 'cleared' event if the area is open so CachedAreas in
260 // renderers get emptied out too. 267 // renderers get emptied out too.
261 DOMStorageArea* area = 268 DOMStorageArea* area =
262 dom_storage_namespace->GetOpenStorageArea(usage_info.origin); 269 dom_storage_namespace->GetOpenStorageArea(usage_info.origin);
263 if (area) 270 if (area)
264 NotifyAreaCleared(area, usage_info.origin); 271 NotifyAreaCleared(area, usage_info.origin);
265 } 272 }
266 273
267 void DOMStorageContextImpl::Flush() { 274 void DOMStorageContextImpl::Flush() {
268 for (auto& entry : namespaces_) 275 for (auto& entry : namespaces_)
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 if (!deletable_persistent_namespace_ids_.empty()) { 638 if (!deletable_persistent_namespace_ids_.empty()) {
632 task_runner_->PostDelayedTask( 639 task_runner_->PostDelayedTask(
633 FROM_HERE, base::Bind( 640 FROM_HERE, base::Bind(
634 &DOMStorageContextImpl::DeleteNextUnusedNamespace, 641 &DOMStorageContextImpl::DeleteNextUnusedNamespace,
635 this), 642 this),
636 base::TimeDelta::FromSeconds(kSessionStoraceScavengingSeconds)); 643 base::TimeDelta::FromSeconds(kSessionStoraceScavengingSeconds));
637 } 644 }
638 } 645 }
639 646
640 } // namespace content 647 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698