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

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: Moving test helpers to webkit/appcache. 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
« no previous file with comments | « webkit/appcache/appcache_service.h ('k') | webkit/appcache/appcache_storage_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 CallCallback(collection ? net::OK : net::ERR_FAILED); 266 CallCallback(collection ? net::OK : net::ERR_FAILED);
267 delete this; 267 delete this;
268 } 268 }
269 269
270 270
271 // AppCacheService ------- 271 // AppCacheService -------
272 272
273 AppCacheService::AppCacheService(quota::QuotaManagerProxy* quota_manager_proxy) 273 AppCacheService::AppCacheService(quota::QuotaManagerProxy* quota_manager_proxy)
274 : appcache_policy_(NULL), quota_client_(NULL), 274 : appcache_policy_(NULL), quota_client_(NULL),
275 quota_manager_proxy_(quota_manager_proxy), 275 quota_manager_proxy_(quota_manager_proxy),
276 request_context_(NULL) { 276 request_context_(NULL), clear_local_state_on_exit_(false) {
277 if (quota_manager_proxy_) { 277 if (quota_manager_proxy_) {
278 quota_client_ = new AppCacheQuotaClient(this); 278 quota_client_ = new AppCacheQuotaClient(this);
279 quota_manager_proxy_->RegisterClient(quota_client_); 279 quota_manager_proxy_->RegisterClient(quota_client_);
280 } 280 }
281 } 281 }
282 282
283 AppCacheService::~AppCacheService() { 283 AppCacheService::~AppCacheService() {
284 DCHECK(backends_.empty()); 284 DCHECK(backends_.empty());
285 std::for_each(pending_helpers_.begin(), 285 std::for_each(pending_helpers_.begin(),
286 pending_helpers_.end(), 286 pending_helpers_.end(),
287 std::mem_fun(&AsyncHelper::Cancel)); 287 std::mem_fun(&AsyncHelper::Cancel));
288 STLDeleteElements(&pending_helpers_); 288 STLDeleteElements(&pending_helpers_);
289 if (quota_client_) 289 if (quota_client_)
290 quota_client_->NotifyAppCacheDestroyed(); 290 quota_client_->NotifyAppCacheDestroyed();
291
292 // Destroy storage_ first; ~AppCacheStorageImpl accesses other data members
293 // (special_storage_policy_).
294 storage_.reset();
291 } 295 }
292 296
293 void AppCacheService::Initialize(const FilePath& cache_directory, 297 void AppCacheService::Initialize(const FilePath& cache_directory,
294 base::MessageLoopProxy* cache_thread) { 298 base::MessageLoopProxy* cache_thread) {
295 DCHECK(!storage_.get()); 299 DCHECK(!storage_.get());
296 AppCacheStorageImpl* storage = new AppCacheStorageImpl(this); 300 AppCacheStorageImpl* storage = new AppCacheStorageImpl(this);
297 storage->Initialize(cache_directory, cache_thread); 301 storage->Initialize(cache_directory, cache_thread);
298 storage_.reset(storage); 302 storage_.reset(storage);
299 } 303 }
300 304
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 backends_.insert( 340 backends_.insert(
337 BackendMap::value_type(backend_impl->process_id(), backend_impl)); 341 BackendMap::value_type(backend_impl->process_id(), backend_impl));
338 } 342 }
339 343
340 void AppCacheService::UnregisterBackend( 344 void AppCacheService::UnregisterBackend(
341 AppCacheBackendImpl* backend_impl) { 345 AppCacheBackendImpl* backend_impl) {
342 backends_.erase(backend_impl->process_id()); 346 backends_.erase(backend_impl->process_id());
343 } 347 }
344 348
345 } // namespace appcache 349 } // namespace appcache
OLDNEW
« no previous file with comments | « webkit/appcache/appcache_service.h ('k') | webkit/appcache/appcache_storage_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698