OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser/appcache/appcache_service_impl.h" | 5 #include "content/browser/appcache/appcache_service_impl.h" |
6 | 6 |
7 #include <functional> | 7 #include <functional> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 force_keep_session_state_(false), | 405 force_keep_session_state_(false), |
406 weak_factory_(this) { | 406 weak_factory_(this) { |
407 if (quota_manager_proxy_.get()) { | 407 if (quota_manager_proxy_.get()) { |
408 quota_client_ = new AppCacheQuotaClient(this); | 408 quota_client_ = new AppCacheQuotaClient(this); |
409 quota_manager_proxy_->RegisterClient(quota_client_); | 409 quota_manager_proxy_->RegisterClient(quota_client_); |
410 } | 410 } |
411 } | 411 } |
412 | 412 |
413 AppCacheServiceImpl::~AppCacheServiceImpl() { | 413 AppCacheServiceImpl::~AppCacheServiceImpl() { |
414 DCHECK(backends_.empty()); | 414 DCHECK(backends_.empty()); |
415 FOR_EACH_OBSERVER(Observer, observers_, OnServiceDestructionImminent(this)); | 415 for (auto& observer : observers_) |
| 416 observer.OnServiceDestructionImminent(this); |
416 for (auto* helper : pending_helpers_) | 417 for (auto* helper : pending_helpers_) |
417 helper->Cancel(); | 418 helper->Cancel(); |
418 base::STLDeleteElements(&pending_helpers_); | 419 base::STLDeleteElements(&pending_helpers_); |
419 if (quota_client_) | 420 if (quota_client_) |
420 quota_client_->NotifyAppCacheDestroyed(); | 421 quota_client_->NotifyAppCacheDestroyed(); |
421 | 422 |
422 // Destroy storage_ first; ~AppCacheStorageImpl accesses other data members | 423 // Destroy storage_ first; ~AppCacheStorageImpl accesses other data members |
423 // (special_storage_policy_). | 424 // (special_storage_policy_). |
424 storage_.reset(); | 425 storage_.reset(); |
425 } | 426 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 } | 466 } |
466 | 467 |
467 void AppCacheServiceImpl::Reinitialize() { | 468 void AppCacheServiceImpl::Reinitialize() { |
468 AppCacheHistograms::CountReinitAttempt(!last_reinit_time_.is_null()); | 469 AppCacheHistograms::CountReinitAttempt(!last_reinit_time_.is_null()); |
469 last_reinit_time_ = base::Time::Now(); | 470 last_reinit_time_ = base::Time::Now(); |
470 | 471 |
471 // Inform observers of about this and give them a chance to | 472 // Inform observers of about this and give them a chance to |
472 // defer deletion of the old storage object. | 473 // defer deletion of the old storage object. |
473 scoped_refptr<AppCacheStorageReference> old_storage_ref( | 474 scoped_refptr<AppCacheStorageReference> old_storage_ref( |
474 new AppCacheStorageReference(std::move(storage_))); | 475 new AppCacheStorageReference(std::move(storage_))); |
475 FOR_EACH_OBSERVER(Observer, observers_, | 476 for (auto& observer : observers_) |
476 OnServiceReinitialized(old_storage_ref.get())); | 477 observer.OnServiceReinitialized(old_storage_ref.get()); |
477 | 478 |
478 Initialize(cache_directory_, db_thread_, cache_thread_); | 479 Initialize(cache_directory_, db_thread_, cache_thread_); |
479 } | 480 } |
480 | 481 |
481 void AppCacheServiceImpl::GetAllAppCacheInfo( | 482 void AppCacheServiceImpl::GetAllAppCacheInfo( |
482 AppCacheInfoCollection* collection, | 483 AppCacheInfoCollection* collection, |
483 const net::CompletionCallback& callback) { | 484 const net::CompletionCallback& callback) { |
484 DCHECK(collection); | 485 DCHECK(collection); |
485 GetInfoHelper* helper = new GetInfoHelper(this, collection, callback); | 486 GetInfoHelper* helper = new GetInfoHelper(this, collection, callback); |
486 helper->Start(); | 487 helper->Start(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 backends_.insert( | 519 backends_.insert( |
519 BackendMap::value_type(backend_impl->process_id(), backend_impl)); | 520 BackendMap::value_type(backend_impl->process_id(), backend_impl)); |
520 } | 521 } |
521 | 522 |
522 void AppCacheServiceImpl::UnregisterBackend( | 523 void AppCacheServiceImpl::UnregisterBackend( |
523 AppCacheBackendImpl* backend_impl) { | 524 AppCacheBackendImpl* backend_impl) { |
524 backends_.erase(backend_impl->process_id()); | 525 backends_.erase(backend_impl->process_id()); |
525 } | 526 } |
526 | 527 |
527 } // namespace content | 528 } // namespace content |
OLD | NEW |