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

Side by Side Diff: content/renderer/dom_storage/dom_storage_dispatcher.cc

Issue 16294003: Update content/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased 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 "content/renderer/dom_storage/dom_storage_dispatcher.h" 5 #include "content/renderer/dom_storage/dom_storage_dispatcher.h"
6 6
7 #include <list> 7 #include <list>
8 #include <map> 8 #include <map>
9 9
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 RenderThreadImpl* sender_; 169 RenderThreadImpl* sender_;
170 CachedAreaMap cached_areas_; 170 CachedAreaMap cached_areas_;
171 CallbackList pending_callbacks_; 171 CallbackList pending_callbacks_;
172 scoped_refptr<MessageThrottlingFilter> throttling_filter_; 172 scoped_refptr<MessageThrottlingFilter> throttling_filter_;
173 }; 173 };
174 174
175 DomStorageDispatcher::ProxyImpl::ProxyImpl(RenderThreadImpl* sender) 175 DomStorageDispatcher::ProxyImpl::ProxyImpl(RenderThreadImpl* sender)
176 : sender_(sender), 176 : sender_(sender),
177 throttling_filter_(new MessageThrottlingFilter(sender)) { 177 throttling_filter_(new MessageThrottlingFilter(sender)) {
178 sender_->AddFilter(throttling_filter_); 178 sender_->AddFilter(throttling_filter_.get());
179 } 179 }
180 180
181 DomStorageCachedArea* DomStorageDispatcher::ProxyImpl::OpenCachedArea( 181 DomStorageCachedArea* DomStorageDispatcher::ProxyImpl::OpenCachedArea(
182 int64 namespace_id, const GURL& origin) { 182 int64 namespace_id, const GURL& origin) {
183 std::string key = GetCachedAreaKey(namespace_id, origin); 183 std::string key = GetCachedAreaKey(namespace_id, origin);
184 if (CachedAreaHolder* holder = GetAreaHolder(key)) { 184 if (CachedAreaHolder* holder = GetAreaHolder(key)) {
185 ++(holder->open_count_); 185 ++(holder->open_count_);
186 return holder->area_; 186 return holder->area_.get();
187 } 187 }
188 scoped_refptr<DomStorageCachedArea> area = 188 scoped_refptr<DomStorageCachedArea> area =
189 new DomStorageCachedArea(namespace_id, origin, this); 189 new DomStorageCachedArea(namespace_id, origin, this);
190 cached_areas_[key] = CachedAreaHolder(area, 1); 190 cached_areas_[key] = CachedAreaHolder(area.get(), 1);
191 return area.get(); 191 return area.get();
192 } 192 }
193 193
194 void DomStorageDispatcher::ProxyImpl::CloseCachedArea( 194 void DomStorageDispatcher::ProxyImpl::CloseCachedArea(
195 DomStorageCachedArea* area) { 195 DomStorageCachedArea* area) {
196 std::string key = GetCachedAreaKey(area->namespace_id(), area->origin()); 196 std::string key = GetCachedAreaKey(area->namespace_id(), area->origin());
197 CachedAreaHolder* holder = GetAreaHolder(key); 197 CachedAreaHolder* holder = GetAreaHolder(key);
198 DCHECK(holder); 198 DCHECK(holder);
199 DCHECK_EQ(holder->area_.get(), area); 199 DCHECK_EQ(holder->area_.get(), area);
200 DCHECK_GT(holder->open_count_, 0); 200 DCHECK_GT(holder->open_count_, 0);
(...skipping 10 matching lines...) Expand all
211 return NULL; 211 return NULL;
212 return holder->area_.get(); 212 return holder->area_.get();
213 } 213 }
214 214
215 void DomStorageDispatcher::ProxyImpl::CompleteOnePendingCallback(bool success) { 215 void DomStorageDispatcher::ProxyImpl::CompleteOnePendingCallback(bool success) {
216 PopPendingCallback().Run(success); 216 PopPendingCallback().Run(success);
217 } 217 }
218 218
219 void DomStorageDispatcher::ProxyImpl::Shutdown() { 219 void DomStorageDispatcher::ProxyImpl::Shutdown() {
220 throttling_filter_->Shutdown(); 220 throttling_filter_->Shutdown();
221 sender_->RemoveFilter(throttling_filter_); 221 sender_->RemoveFilter(throttling_filter_.get());
222 sender_ = NULL; 222 sender_ = NULL;
223 cached_areas_.clear(); 223 cached_areas_.clear();
224 pending_callbacks_.clear(); 224 pending_callbacks_.clear();
225 } 225 }
226 226
227 void DomStorageDispatcher::ProxyImpl::LoadArea( 227 void DomStorageDispatcher::ProxyImpl::LoadArea(
228 int connection_id, ValuesMap* values, 228 int connection_id, ValuesMap* values,
229 const CompletionCallback& callback) { 229 const CompletionCallback& callback) {
230 PushPendingCallback(callback); 230 PushPendingCallback(callback);
231 throttling_filter_->SendThrottled(new DOMStorageHostMsg_LoadStorageArea( 231 throttling_filter_->SendThrottled(new DOMStorageHostMsg_LoadStorageArea(
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 originating_area, 331 originating_area,
332 originated_in_process); 332 originated_in_process);
333 } 333 }
334 } 334 }
335 335
336 void DomStorageDispatcher::OnAsyncOperationComplete(bool success) { 336 void DomStorageDispatcher::OnAsyncOperationComplete(bool success) {
337 proxy_->CompleteOnePendingCallback(success); 337 proxy_->CompleteOnePendingCallback(success);
338 } 338 }
339 339
340 } // namespace content 340 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698