| 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 "content/renderer/dom_storage/dom_storage_cached_area.h" | 5 #include "content/renderer/dom_storage/dom_storage_cached_area.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 133 |
| 134 // It's a set item event. | 134 // It's a set item event. |
| 135 // We turn off quota checking here to accomodate the over budget | 135 // We turn off quota checking here to accomodate the over budget |
| 136 // allowance that's provided in the browser process. | 136 // allowance that's provided in the browser process. |
| 137 base::NullableString16 unused; | 137 base::NullableString16 unused; |
| 138 map_->set_quota(std::numeric_limits<int32_t>::max()); | 138 map_->set_quota(std::numeric_limits<int32_t>::max()); |
| 139 map_->SetItem(key.string(), new_value.string(), &unused); | 139 map_->SetItem(key.string(), new_value.string(), &unused); |
| 140 map_->set_quota(kPerStorageAreaQuota); | 140 map_->set_quota(kPerStorageAreaQuota); |
| 141 } | 141 } |
| 142 | 142 |
| 143 size_t DOMStorageCachedArea::MemoryBytesUsedByCache() const { | |
| 144 return map_.get() ? map_->bytes_used() : 0; | |
| 145 } | |
| 146 | |
| 147 void DOMStorageCachedArea::Prime(int connection_id) { | 143 void DOMStorageCachedArea::Prime(int connection_id) { |
| 148 DCHECK(!map_.get()); | 144 DCHECK(!map_.get()); |
| 149 | 145 |
| 150 // The LoadArea method is actually synchronous, but we have to | 146 // The LoadArea method is actually synchronous, but we have to |
| 151 // wait for an asyncly delivered message to know when incoming | 147 // wait for an asyncly delivered message to know when incoming |
| 152 // mutation events should be applied. Our valuemap is plucked | 148 // mutation events should be applied. Our valuemap is plucked |
| 153 // from ipc stream out of order, mutations in front if it need | 149 // from ipc stream out of order, mutations in front if it need |
| 154 // to be ignored. | 150 // to be ignored. |
| 155 | 151 |
| 156 // Ignore all mutations until OnLoadComplete time. | 152 // Ignore all mutations until OnLoadComplete time. |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 ignore_key_mutations_.erase(found); | 223 ignore_key_mutations_.erase(found); |
| 228 } | 224 } |
| 229 | 225 |
| 230 void DOMStorageCachedArea::OnClearComplete(bool success) { | 226 void DOMStorageCachedArea::OnClearComplete(bool success) { |
| 231 DCHECK(success); | 227 DCHECK(success); |
| 232 DCHECK(ignore_all_mutations_); | 228 DCHECK(ignore_all_mutations_); |
| 233 ignore_all_mutations_ = false; | 229 ignore_all_mutations_ = false; |
| 234 } | 230 } |
| 235 | 231 |
| 236 } // namespace content | 232 } // namespace content |
| OLD | NEW |