| OLD | NEW |
| 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/browser/appcache/appcache_storage_impl.h" | 5 #include "content/browser/appcache/appcache_storage_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
| 14 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
| 15 #include "base/location.h" | 15 #include "base/location.h" |
| 16 #include "base/logging.h" | 16 #include "base/logging.h" |
| 17 #include "base/profiler/scoped_tracker.h" | 17 #include "base/profiler/scoped_tracker.h" |
| 18 #include "base/single_thread_task_runner.h" | 18 #include "base/single_thread_task_runner.h" |
| 19 #include "base/stl_util.h" | 19 #include "base/stl_util.h" |
| 20 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
| 21 #include "base/thread_task_runner_handle.h" | 21 #include "base/thread_task_runner_handle.h" |
| 22 #include "base/trace_event/trace_event.h" |
| 22 #include "content/browser/appcache/appcache.h" | 23 #include "content/browser/appcache/appcache.h" |
| 23 #include "content/browser/appcache/appcache_database.h" | 24 #include "content/browser/appcache/appcache_database.h" |
| 24 #include "content/browser/appcache/appcache_entry.h" | 25 #include "content/browser/appcache/appcache_entry.h" |
| 25 #include "content/browser/appcache/appcache_group.h" | 26 #include "content/browser/appcache/appcache_group.h" |
| 26 #include "content/browser/appcache/appcache_histograms.h" | 27 #include "content/browser/appcache/appcache_histograms.h" |
| 27 #include "content/browser/appcache/appcache_quota_client.h" | 28 #include "content/browser/appcache/appcache_quota_client.h" |
| 28 #include "content/browser/appcache/appcache_response.h" | 29 #include "content/browser/appcache/appcache_response.h" |
| 29 #include "content/browser/appcache/appcache_service_impl.h" | 30 #include "content/browser/appcache/appcache_service_impl.h" |
| 30 #include "net/base/cache_type.h" | 31 #include "net/base/cache_type.h" |
| 31 #include "net/base/net_errors.h" | 32 #include "net/base/net_errors.h" |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 | 658 |
| 658 if (!quota_manager) { | 659 if (!quota_manager) { |
| 659 if (storage_->service()->special_storage_policy() && | 660 if (storage_->service()->special_storage_policy() && |
| 660 storage_->service()->special_storage_policy()->IsStorageUnlimited( | 661 storage_->service()->special_storage_policy()->IsStorageUnlimited( |
| 661 group_record_.origin)) | 662 group_record_.origin)) |
| 662 space_available_ = kint64max; | 663 space_available_ = kint64max; |
| 663 Schedule(); | 664 Schedule(); |
| 664 return; | 665 return; |
| 665 } | 666 } |
| 666 | 667 |
| 668 // crbug.com/349708 |
| 669 TRACE_EVENT0( |
| 670 "io", |
| 671 "AppCacheStorageImpl::StoreGroupAndCacheTask::GetQuotaThenSchedule"); |
| 672 |
| 667 // We have to ask the quota manager for the value. | 673 // We have to ask the quota manager for the value. |
| 668 storage_->pending_quota_queries_.insert(this); | 674 storage_->pending_quota_queries_.insert(this); |
| 669 quota_manager->GetUsageAndQuota( | 675 quota_manager->GetUsageAndQuota( |
| 670 group_record_.origin, | 676 group_record_.origin, |
| 671 storage::kStorageTypeTemporary, | 677 storage::kStorageTypeTemporary, |
| 672 base::Bind(&StoreGroupAndCacheTask::OnQuotaCallback, this)); | 678 base::Bind(&StoreGroupAndCacheTask::OnQuotaCallback, this)); |
| 673 } | 679 } |
| 674 | 680 |
| 675 void AppCacheStorageImpl::StoreGroupAndCacheTask::OnQuotaCallback( | 681 void AppCacheStorageImpl::StoreGroupAndCacheTask::OnQuotaCallback( |
| 676 storage::QuotaStatusCode status, | 682 storage::QuotaStatusCode status, |
| (...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1973 | 1979 |
| 1974 void AppCacheStorageImpl::OnLazyCommitTimer() { | 1980 void AppCacheStorageImpl::OnLazyCommitTimer() { |
| 1975 lazy_commit_timer_.Stop(); | 1981 lazy_commit_timer_.Stop(); |
| 1976 if (is_disabled()) | 1982 if (is_disabled()) |
| 1977 return; | 1983 return; |
| 1978 scoped_refptr<DatabaseTask> task(new CommitLastAccessTimesTask(this)); | 1984 scoped_refptr<DatabaseTask> task(new CommitLastAccessTimesTask(this)); |
| 1979 task->Schedule(); | 1985 task->Schedule(); |
| 1980 } | 1986 } |
| 1981 | 1987 |
| 1982 } // namespace content | 1988 } // namespace content |
| OLD | NEW |