| 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 | 9 |
| 9 #include "base/bind.h" | 10 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 11 #include "base/location.h" | 12 #include "base/location.h" |
| 12 #include "base/logging.h" | 13 #include "base/logging.h" |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
| 15 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
| 16 #include "base/thread_task_runner_handle.h" | 17 #include "base/thread_task_runner_handle.h" |
| 17 #include "content/browser/appcache/appcache.h" | 18 #include "content/browser/appcache/appcache.h" |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 | 383 |
| 383 if (check_result != AppCacheHistograms::RESPONSE_OK) | 384 if (check_result != AppCacheHistograms::RESPONSE_OK) |
| 384 service_->DeleteAppCacheGroup(manifest_url_, net::CompletionCallback()); | 385 service_->DeleteAppCacheGroup(manifest_url_, net::CompletionCallback()); |
| 385 delete this; | 386 delete this; |
| 386 } | 387 } |
| 387 | 388 |
| 388 // AppCacheStorageReference ------ | 389 // AppCacheStorageReference ------ |
| 389 | 390 |
| 390 AppCacheStorageReference::AppCacheStorageReference( | 391 AppCacheStorageReference::AppCacheStorageReference( |
| 391 scoped_ptr<AppCacheStorage> storage) | 392 scoped_ptr<AppCacheStorage> storage) |
| 392 : storage_(storage.Pass()) {} | 393 : storage_(std::move(storage)) {} |
| 393 AppCacheStorageReference::~AppCacheStorageReference() {} | 394 AppCacheStorageReference::~AppCacheStorageReference() {} |
| 394 | 395 |
| 395 // AppCacheServiceImpl ------- | 396 // AppCacheServiceImpl ------- |
| 396 | 397 |
| 397 AppCacheServiceImpl::AppCacheServiceImpl( | 398 AppCacheServiceImpl::AppCacheServiceImpl( |
| 398 storage::QuotaManagerProxy* quota_manager_proxy) | 399 storage::QuotaManagerProxy* quota_manager_proxy) |
| 399 : appcache_policy_(NULL), | 400 : appcache_policy_(NULL), |
| 400 quota_client_(NULL), | 401 quota_client_(NULL), |
| 401 handler_factory_(NULL), | 402 handler_factory_(NULL), |
| 402 quota_manager_proxy_(quota_manager_proxy), | 403 quota_manager_proxy_(quota_manager_proxy), |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 base::TimeDelta increment = std::max(k30Seconds, next_reinit_delay_); | 463 base::TimeDelta increment = std::max(k30Seconds, next_reinit_delay_); |
| 463 next_reinit_delay_ = std::min(next_reinit_delay_ + increment, kOneHour); | 464 next_reinit_delay_ = std::min(next_reinit_delay_ + increment, kOneHour); |
| 464 } | 465 } |
| 465 | 466 |
| 466 void AppCacheServiceImpl::Reinitialize() { | 467 void AppCacheServiceImpl::Reinitialize() { |
| 467 AppCacheHistograms::CountReinitAttempt(!last_reinit_time_.is_null()); | 468 AppCacheHistograms::CountReinitAttempt(!last_reinit_time_.is_null()); |
| 468 last_reinit_time_ = base::Time::Now(); | 469 last_reinit_time_ = base::Time::Now(); |
| 469 | 470 |
| 470 // Inform observers of about this and give them a chance to | 471 // Inform observers of about this and give them a chance to |
| 471 // defer deletion of the old storage object. | 472 // defer deletion of the old storage object. |
| 472 scoped_refptr<AppCacheStorageReference> | 473 scoped_refptr<AppCacheStorageReference> old_storage_ref( |
| 473 old_storage_ref(new AppCacheStorageReference(storage_.Pass())); | 474 new AppCacheStorageReference(std::move(storage_))); |
| 474 FOR_EACH_OBSERVER(Observer, observers_, | 475 FOR_EACH_OBSERVER(Observer, observers_, |
| 475 OnServiceReinitialized(old_storage_ref.get())); | 476 OnServiceReinitialized(old_storage_ref.get())); |
| 476 | 477 |
| 477 Initialize(cache_directory_, db_thread_, cache_thread_); | 478 Initialize(cache_directory_, db_thread_, cache_thread_); |
| 478 } | 479 } |
| 479 | 480 |
| 480 void AppCacheServiceImpl::GetAllAppCacheInfo( | 481 void AppCacheServiceImpl::GetAllAppCacheInfo( |
| 481 AppCacheInfoCollection* collection, | 482 AppCacheInfoCollection* collection, |
| 482 const net::CompletionCallback& callback) { | 483 const net::CompletionCallback& callback) { |
| 483 DCHECK(collection); | 484 DCHECK(collection); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 backends_.insert( | 518 backends_.insert( |
| 518 BackendMap::value_type(backend_impl->process_id(), backend_impl)); | 519 BackendMap::value_type(backend_impl->process_id(), backend_impl)); |
| 519 } | 520 } |
| 520 | 521 |
| 521 void AppCacheServiceImpl::UnregisterBackend( | 522 void AppCacheServiceImpl::UnregisterBackend( |
| 522 AppCacheBackendImpl* backend_impl) { | 523 AppCacheBackendImpl* backend_impl) { |
| 523 backends_.erase(backend_impl->process_id()); | 524 backends_.erase(backend_impl->process_id()); |
| 524 } | 525 } |
| 525 | 526 |
| 526 } // namespace content | 527 } // namespace content |
| OLD | NEW |