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

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

Issue 2725723002: Purge new localstorage memory cache when under memory pressure. (Closed)
Patch Set: Created 3 years, 9 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 | content/browser/dom_storage/local_storage_context_mojo.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_context_wrapper.h" 5 #include "content/browser/dom_storage/dom_storage_context_wrapper.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 278
279 void DOMStorageContextWrapper::OnPurgeMemory() { 279 void DOMStorageContextWrapper::OnPurgeMemory() {
280 PurgeMemory(DOMStorageContextImpl::PURGE_AGGRESSIVE); 280 PurgeMemory(DOMStorageContextImpl::PURGE_AGGRESSIVE);
281 } 281 }
282 282
283 void DOMStorageContextWrapper::PurgeMemory(DOMStorageContextImpl::PurgeOption 283 void DOMStorageContextWrapper::PurgeMemory(DOMStorageContextImpl::PurgeOption
284 purge_option) { 284 purge_option) {
285 context_->task_runner()->PostTask( 285 context_->task_runner()->PostTask(
286 FROM_HERE, 286 FROM_HERE,
287 base::Bind(&DOMStorageContextImpl::PurgeMemory, context_, purge_option)); 287 base::Bind(&DOMStorageContextImpl::PurgeMemory, context_, purge_option));
288 if (mojo_state_ && purge_option == DOMStorageContextImpl::PURGE_AGGRESSIVE)
289 mojo_state_->PurgeMemory();
288 } 290 }
289 291
290 void DOMStorageContextWrapper::GotMojoLocalStorageUsage( 292 void DOMStorageContextWrapper::GotMojoLocalStorageUsage(
291 GetLocalStorageUsageCallback callback, 293 GetLocalStorageUsageCallback callback,
292 std::vector<LocalStorageUsageInfo> usage) { 294 std::vector<LocalStorageUsageInfo> usage) {
293 context_->task_runner()->PostShutdownBlockingTask( 295 context_->task_runner()->PostShutdownBlockingTask(
294 FROM_HERE, DOMStorageTaskRunner::PRIMARY_SEQUENCE, 296 FROM_HERE, DOMStorageTaskRunner::PRIMARY_SEQUENCE,
295 base::Bind(&GetLocalStorageUsageHelper, base::Passed(&usage), 297 base::Bind(&GetLocalStorageUsageHelper, base::Passed(&usage),
296 base::RetainedRef(base::ThreadTaskRunnerHandle::Get()), 298 base::RetainedRef(base::ThreadTaskRunnerHandle::Get()),
297 base::RetainedRef(context_), callback)); 299 base::RetainedRef(context_), callback));
298 } 300 }
299 301
300 } // namespace content 302 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/dom_storage/local_storage_context_mojo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698