OLD | NEW |
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 "webkit/dom_storage/dom_storage_cached_area.h" | 5 #include "webkit/dom_storage/dom_storage_cached_area.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "webkit/dom_storage/dom_storage_map.h" | 8 #include "webkit/dom_storage/dom_storage_map.h" |
9 #include "webkit/dom_storage/dom_storage_proxy.h" | 9 #include "webkit/dom_storage/dom_storage_proxy.h" |
10 | 10 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 124 |
125 // It's a set item event. | 125 // It's a set item event. |
126 // We turn off quota checking here to accomodate the over budget | 126 // We turn off quota checking here to accomodate the over budget |
127 // allowance that's provided in the browser process. | 127 // allowance that's provided in the browser process. |
128 NullableString16 unused; | 128 NullableString16 unused; |
129 map_->set_quota(kint32max); | 129 map_->set_quota(kint32max); |
130 map_->SetItem(key.string(), new_value.string(), &unused); | 130 map_->SetItem(key.string(), new_value.string(), &unused); |
131 map_->set_quota(dom_storage::kPerAreaQuota); | 131 map_->set_quota(dom_storage::kPerAreaQuota); |
132 } | 132 } |
133 | 133 |
| 134 size_t DomStorageCachedArea::MemoryBytesUsedByCache() const { |
| 135 return map_ ? map_->bytes_used() : 0; |
| 136 } |
| 137 |
134 void DomStorageCachedArea::Prime(int connection_id) { | 138 void DomStorageCachedArea::Prime(int connection_id) { |
135 DCHECK(!map_); | 139 DCHECK(!map_); |
136 | 140 |
137 // The LoadArea method is actually synchronous, but we have to | 141 // The LoadArea method is actually synchronous, but we have to |
138 // wait for an asyncly delivered message to know when incoming | 142 // wait for an asyncly delivered message to know when incoming |
139 // mutation events should be applied. Our valuemap is plucked | 143 // mutation events should be applied. Our valuemap is plucked |
140 // from ipc stream out of order, mutations in front if it need | 144 // from ipc stream out of order, mutations in front if it need |
141 // to be ignored. | 145 // to be ignored. |
142 | 146 |
143 // Ignore all mutations until OnLoadComplete time. | 147 // Ignore all mutations until OnLoadComplete time. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 ignore_key_mutations_.erase(found); | 189 ignore_key_mutations_.erase(found); |
186 } | 190 } |
187 | 191 |
188 void DomStorageCachedArea::OnClearComplete(bool success) { | 192 void DomStorageCachedArea::OnClearComplete(bool success) { |
189 DCHECK(success); | 193 DCHECK(success); |
190 DCHECK(ignore_all_mutations_); | 194 DCHECK(ignore_all_mutations_); |
191 ignore_all_mutations_ = false; | 195 ignore_all_mutations_ = false; |
192 } | 196 } |
193 | 197 |
194 } // namespace dom_storage | 198 } // namespace dom_storage |
OLD | NEW |