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

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

Issue 1140013003: Adjust LocalStorage commit rate limiting. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 | « content/browser/dom_storage/dom_storage_area.cc ('k') | 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 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/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 session_storage_database_.get(), task_runner_.get()); 52 session_storage_database_.get(), task_runner_.get());
53 } 53 }
54 areas_[origin] = AreaHolder(area, 1); 54 areas_[origin] = AreaHolder(area, 1);
55 return area; 55 return area;
56 } 56 }
57 57
58 void DOMStorageNamespace::CloseStorageArea(DOMStorageArea* area) { 58 void DOMStorageNamespace::CloseStorageArea(DOMStorageArea* area) {
59 AreaHolder* holder = GetAreaHolder(area->origin()); 59 AreaHolder* holder = GetAreaHolder(area->origin());
60 DCHECK(holder); 60 DCHECK(holder);
61 DCHECK_EQ(holder->area_.get(), area); 61 DCHECK_EQ(holder->area_.get(), area);
62 --(holder->open_count_); 62 if (!--(holder->open_count_) && holder->area_->HasUncommittedChanges())
63 holder->area_->ScheduleImmediateCommit();
63 // TODO(michaeln): Clean up areas that aren't needed in memory anymore. 64 // TODO(michaeln): Clean up areas that aren't needed in memory anymore.
64 // The in-process-webkit based impl didn't do this either, but would be nice. 65 // The in-process-webkit based impl didn't do this either, but would be nice.
65 } 66 }
66 67
67 DOMStorageArea* DOMStorageNamespace::GetOpenStorageArea(const GURL& origin) { 68 DOMStorageArea* DOMStorageNamespace::GetOpenStorageArea(const GURL& origin) {
68 AreaHolder* holder = GetAreaHolder(origin); 69 AreaHolder* holder = GetAreaHolder(origin);
69 if (holder && holder->open_count_) 70 if (holder && holder->open_count_)
70 return holder->area_.get(); 71 return holder->area_.get();
71 return NULL; 72 return NULL;
72 } 73 }
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 194
194 DOMStorageNamespace::AreaHolder::AreaHolder( 195 DOMStorageNamespace::AreaHolder::AreaHolder(
195 DOMStorageArea* area, int count) 196 DOMStorageArea* area, int count)
196 : area_(area), open_count_(count) { 197 : area_(area), open_count_(count) {
197 } 198 }
198 199
199 DOMStorageNamespace::AreaHolder::~AreaHolder() { 200 DOMStorageNamespace::AreaHolder::~AreaHolder() {
200 } 201 }
201 202
202 } // namespace content 203 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/dom_storage/dom_storage_area.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698