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 19 matching lines...) Expand all Loading... |
30 PrimeIfNeeded(connection_id); | 30 PrimeIfNeeded(connection_id); |
31 return map_->Key(index); | 31 return map_->Key(index); |
32 } | 32 } |
33 | 33 |
34 NullableString16 DomStorageCachedArea::GetItem( | 34 NullableString16 DomStorageCachedArea::GetItem( |
35 int connection_id, const string16& key) { | 35 int connection_id, const string16& key) { |
36 PrimeIfNeeded(connection_id); | 36 PrimeIfNeeded(connection_id); |
37 return map_->GetItem(key); | 37 return map_->GetItem(key); |
38 } | 38 } |
39 | 39 |
| 40 bool DomStorageCachedArea::ContainsItem( |
| 41 int connection_id, const string16& key) { |
| 42 PrimeIfNeeded(connection_id); |
| 43 return map_->ContainsItem(key); |
| 44 } |
| 45 |
40 bool DomStorageCachedArea::SetItem( | 46 bool DomStorageCachedArea::SetItem( |
41 int connection_id, const string16& key, | 47 int connection_id, const string16& key, |
42 const string16& value, const GURL& page_url) { | 48 const string16& value, const GURL& page_url) { |
43 // A quick check to reject obviously overbudget items to avoid | 49 // A quick check to reject obviously overbudget items to avoid |
44 // the priming the cache. | 50 // the priming the cache. |
45 if (key.length() + value.length() > dom_storage::kPerAreaQuota) | 51 if (key.length() + value.length() > dom_storage::kPerAreaQuota) |
46 return false; | 52 return false; |
47 | 53 |
48 PrimeIfNeeded(connection_id); | 54 PrimeIfNeeded(connection_id); |
49 NullableString16 unused; | 55 NullableString16 unused; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 ignore_key_mutations_.erase(found); | 191 ignore_key_mutations_.erase(found); |
186 } | 192 } |
187 | 193 |
188 void DomStorageCachedArea::OnClearComplete(bool success) { | 194 void DomStorageCachedArea::OnClearComplete(bool success) { |
189 DCHECK(success); | 195 DCHECK(success); |
190 DCHECK(ignore_all_mutations_); | 196 DCHECK(ignore_all_mutations_); |
191 ignore_all_mutations_ = false; | 197 ignore_all_mutations_ = false; |
192 } | 198 } |
193 | 199 |
194 } // namespace dom_storage | 200 } // namespace dom_storage |
OLD | NEW |