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

Side by Side Diff: webkit/dom_storage/dom_storage_cached_area.cc

Issue 16155009: Update webkit/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
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 "base/time.h" 8 #include "base/time.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "webkit/dom_storage/dom_storage_map.h" 10 #include "webkit/dom_storage/dom_storage_map.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 // Ignore all mutations until OnClearComplete time. 84 // Ignore all mutations until OnClearComplete time.
85 ignore_all_mutations_ = true; 85 ignore_all_mutations_ = true;
86 proxy_->ClearArea( 86 proxy_->ClearArea(
87 connection_id, page_url, 87 connection_id, page_url,
88 base::Bind(&DomStorageCachedArea::OnClearComplete, 88 base::Bind(&DomStorageCachedArea::OnClearComplete,
89 weak_factory_.GetWeakPtr())); 89 weak_factory_.GetWeakPtr()));
90 } 90 }
91 91
92 void DomStorageCachedArea::ApplyMutation( 92 void DomStorageCachedArea::ApplyMutation(
93 const NullableString16& key, const NullableString16& new_value) { 93 const NullableString16& key, const NullableString16& new_value) {
94 if (!map_ || ignore_all_mutations_) 94 if (!map_.get() || ignore_all_mutations_)
95 return; 95 return;
96 96
97 if (key.is_null()) { 97 if (key.is_null()) {
98 // It's a clear event. 98 // It's a clear event.
99 scoped_refptr<DomStorageMap> old = map_; 99 scoped_refptr<DomStorageMap> old = map_;
100 map_ = new DomStorageMap(dom_storage::kPerAreaQuota); 100 map_ = new DomStorageMap(dom_storage::kPerAreaQuota);
101 101
102 // We have to retain local additions which happened after this 102 // We have to retain local additions which happened after this
103 // clear operation from another process. 103 // clear operation from another process.
104 std::map<base::string16, int>::iterator iter = 104 std::map<base::string16, int>::iterator iter =
(...skipping 23 matching lines...) Expand all
128 // It's a set item event. 128 // It's a set item event.
129 // We turn off quota checking here to accomodate the over budget 129 // We turn off quota checking here to accomodate the over budget
130 // allowance that's provided in the browser process. 130 // allowance that's provided in the browser process.
131 NullableString16 unused; 131 NullableString16 unused;
132 map_->set_quota(kint32max); 132 map_->set_quota(kint32max);
133 map_->SetItem(key.string(), new_value.string(), &unused); 133 map_->SetItem(key.string(), new_value.string(), &unused);
134 map_->set_quota(dom_storage::kPerAreaQuota); 134 map_->set_quota(dom_storage::kPerAreaQuota);
135 } 135 }
136 136
137 size_t DomStorageCachedArea::MemoryBytesUsedByCache() const { 137 size_t DomStorageCachedArea::MemoryBytesUsedByCache() const {
138 return map_ ? map_->bytes_used() : 0; 138 return map_.get() ? map_->bytes_used() : 0;
139 } 139 }
140 140
141 void DomStorageCachedArea::Prime(int connection_id) { 141 void DomStorageCachedArea::Prime(int connection_id) {
142 DCHECK(!map_); 142 DCHECK(!map_.get());
143 143
144 // The LoadArea method is actually synchronous, but we have to 144 // The LoadArea method is actually synchronous, but we have to
145 // wait for an asyncly delivered message to know when incoming 145 // wait for an asyncly delivered message to know when incoming
146 // mutation events should be applied. Our valuemap is plucked 146 // mutation events should be applied. Our valuemap is plucked
147 // from ipc stream out of order, mutations in front if it need 147 // from ipc stream out of order, mutations in front if it need
148 // to be ignored. 148 // to be ignored.
149 149
150 // Ignore all mutations until OnLoadComplete time. 150 // Ignore all mutations until OnLoadComplete time.
151 ignore_all_mutations_ = true; 151 ignore_all_mutations_ = true;
152 ValuesMap values; 152 ValuesMap values;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 ignore_key_mutations_.erase(found); 221 ignore_key_mutations_.erase(found);
222 } 222 }
223 223
224 void DomStorageCachedArea::OnClearComplete(bool success) { 224 void DomStorageCachedArea::OnClearComplete(bool success) {
225 DCHECK(success); 225 DCHECK(success);
226 DCHECK(ignore_all_mutations_); 226 DCHECK(ignore_all_mutations_);
227 ignore_all_mutations_ = false; 227 ignore_all_mutations_ = false;
228 } 228 }
229 229
230 } // namespace dom_storage 230 } // namespace dom_storage
OLDNEW
« no previous file with comments | « webkit/dom_storage/dom_storage_cached_area.h ('k') | webkit/dom_storage/dom_storage_cached_area_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698