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

Side by Side Diff: webkit/appcache/appcache_service.cc

Issue 7210006: AppCaches which belong to hosted apps are not protected from deletion (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Minor. Created 9 years, 5 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/appcache/appcache_service.h" 5 #include "webkit/appcache/appcache_service.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/stl_util-inl.h" 9 #include "base/stl_util-inl.h"
10 #include "webkit/appcache/appcache_backend_impl.h" 10 #include "webkit/appcache/appcache_backend_impl.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 119 }
120 120
121 private: 121 private:
122 // AppCacheStorage::Delegate methods 122 // AppCacheStorage::Delegate methods
123 virtual void OnGroupLoaded( 123 virtual void OnGroupLoaded(
124 appcache::AppCacheGroup* group, const GURL& manifest_url); 124 appcache::AppCacheGroup* group, const GURL& manifest_url);
125 virtual void OnGroupMadeObsolete( 125 virtual void OnGroupMadeObsolete(
126 appcache::AppCacheGroup* group, bool success); 126 appcache::AppCacheGroup* group, bool success);
127 127
128 GURL manifest_url_; 128 GURL manifest_url_;
129
129 DISALLOW_COPY_AND_ASSIGN(DeleteHelper); 130 DISALLOW_COPY_AND_ASSIGN(DeleteHelper);
130 }; 131 };
131 132
132 void AppCacheService::DeleteHelper::OnGroupLoaded( 133 void AppCacheService::DeleteHelper::OnGroupLoaded(
133 appcache::AppCacheGroup* group, const GURL& manifest_url) { 134 appcache::AppCacheGroup* group, const GURL& manifest_url) {
134 if (group) { 135 if (group) {
135 group->set_being_deleted(true); 136 group->set_being_deleted(true);
136 group->CancelUpdate(); 137 group->CancelUpdate();
137 service_->storage()->MakeGroupObsolete(group, this); 138 service_->storage()->MakeGroupObsolete(group, this);
138 } else { 139 } else {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 250
250 virtual void Start() { 251 virtual void Start() {
251 service_->storage()->GetAllInfo(this); 252 service_->storage()->GetAllInfo(this);
252 } 253 }
253 254
254 private: 255 private:
255 // AppCacheStorage::Delegate override 256 // AppCacheStorage::Delegate override
256 virtual void OnAllInfo(AppCacheInfoCollection* collection); 257 virtual void OnAllInfo(AppCacheInfoCollection* collection);
257 258
258 scoped_refptr<AppCacheInfoCollection> collection_; 259 scoped_refptr<AppCacheInfoCollection> collection_;
260
259 DISALLOW_COPY_AND_ASSIGN(GetInfoHelper); 261 DISALLOW_COPY_AND_ASSIGN(GetInfoHelper);
260 }; 262 };
261 263
262 void AppCacheService::GetInfoHelper::OnAllInfo( 264 void AppCacheService::GetInfoHelper::OnAllInfo(
263 AppCacheInfoCollection* collection) { 265 AppCacheInfoCollection* collection) {
264 if (collection) 266 if (collection)
265 collection->infos_by_origin.swap(collection_->infos_by_origin); 267 collection->infos_by_origin.swap(collection_->infos_by_origin);
266 CallCallback(collection ? net::OK : net::ERR_FAILED); 268 CallCallback(collection ? net::OK : net::ERR_FAILED);
267 delete this; 269 delete this;
268 } 270 }
269 271
270 272
271 // AppCacheService ------- 273 // AppCacheService -------
272 274
273 AppCacheService::AppCacheService(quota::QuotaManagerProxy* quota_manager_proxy) 275 AppCacheService::AppCacheService(quota::QuotaManagerProxy* quota_manager_proxy)
274 : appcache_policy_(NULL), quota_client_(NULL), 276 : appcache_policy_(NULL), quota_client_(NULL),
275 quota_manager_proxy_(quota_manager_proxy), 277 quota_manager_proxy_(quota_manager_proxy),
276 request_context_(NULL) { 278 request_context_(NULL), clear_local_state_on_exit_(false) {
277 if (quota_manager_proxy_) { 279 if (quota_manager_proxy_) {
278 quota_client_ = new AppCacheQuotaClient(this); 280 quota_client_ = new AppCacheQuotaClient(this);
279 quota_manager_proxy_->RegisterClient(quota_client_); 281 quota_manager_proxy_->RegisterClient(quota_client_);
280 } 282 }
281 } 283 }
282 284
283 AppCacheService::~AppCacheService() { 285 AppCacheService::~AppCacheService() {
284 DCHECK(backends_.empty()); 286 DCHECK(backends_.empty());
285 std::for_each(pending_helpers_.begin(), 287 std::for_each(pending_helpers_.begin(),
286 pending_helpers_.end(), 288 pending_helpers_.end(),
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 backends_.insert( 338 backends_.insert(
337 BackendMap::value_type(backend_impl->process_id(), backend_impl)); 339 BackendMap::value_type(backend_impl->process_id(), backend_impl));
338 } 340 }
339 341
340 void AppCacheService::UnregisterBackend( 342 void AppCacheService::UnregisterBackend(
341 AppCacheBackendImpl* backend_impl) { 343 AppCacheBackendImpl* backend_impl) {
342 backends_.erase(backend_impl->process_id()); 344 backends_.erase(backend_impl->process_id());
343 } 345 }
344 346
345 } // namespace appcache 347 } // namespace appcache
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698