| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/offline_pages/offline_page_model_impl.h" | 5 #include "components/offline_pages/offline_page_model_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 void OfflinePageModelImpl::OnExpirePageDone(int64_t offline_id, | 647 void OfflinePageModelImpl::OnExpirePageDone(int64_t offline_id, |
| 648 const base::Time& expiration_time, | 648 const base::Time& expiration_time, |
| 649 bool success) { | 649 bool success) { |
| 650 UMA_HISTOGRAM_BOOLEAN("OfflinePages.ExpirePage.StoreUpdateResult", success); | 650 UMA_HISTOGRAM_BOOLEAN("OfflinePages.ExpirePage.StoreUpdateResult", success); |
| 651 if (!success) | 651 if (!success) |
| 652 return; | 652 return; |
| 653 const auto& iter = offline_pages_.find(offline_id); | 653 const auto& iter = offline_pages_.find(offline_id); |
| 654 if (iter != offline_pages_.end()) { | 654 if (iter != offline_pages_.end()) { |
| 655 iter->second.expiration_time = expiration_time; | 655 iter->second.expiration_time = expiration_time; |
| 656 ClientId client_id = iter->second.client_id; | 656 ClientId client_id = iter->second.client_id; |
| 657 UMA_HISTOGRAM_CUSTOM_COUNTS( | 657 base::HistogramBase* histogram = base::Histogram::FactoryGet( |
| 658 AddHistogramSuffix(client_id, "OfflinePages.ExpirePage.PageLifetime") | 658 AddHistogramSuffix(client_id, "OfflinePages.ExpirePage.PageLifetime"), |
| 659 .c_str(), | 659 1, base::TimeDelta::FromDays(30).InMinutes(), 50, |
| 660 (expiration_time - iter->second.creation_time).InMinutes(), 1, | 660 base::HistogramBase::kUmaTargetedHistogramFlag); |
| 661 base::TimeDelta::FromDays(30).InMinutes(), 50); | 661 histogram->Add((expiration_time - iter->second.creation_time).InMinutes()); |
| 662 UMA_HISTOGRAM_CUSTOM_COUNTS( | 662 histogram = base::Histogram::FactoryGet( |
| 663 AddHistogramSuffix(client_id, | 663 AddHistogramSuffix(client_id, |
| 664 "OfflinePages.ExpirePage.TimeSinceLastAccess") | 664 "OfflinePages.ExpirePage.TimeSinceLastAccess"), |
| 665 .c_str(), | 665 1, base::TimeDelta::FromDays(30).InMinutes(), 50, |
| 666 (expiration_time - iter->second.last_access_time).InMinutes(), 1, | 666 base::HistogramBase::kUmaTargetedHistogramFlag); |
| 667 base::TimeDelta::FromDays(30).InMinutes(), 50); | 667 histogram->Add( |
| 668 (expiration_time - iter->second.last_access_time).InMinutes()); |
| 668 } | 669 } |
| 669 } | 670 } |
| 670 | 671 |
| 671 ClientPolicyController* OfflinePageModelImpl::GetPolicyController() { | 672 ClientPolicyController* OfflinePageModelImpl::GetPolicyController() { |
| 672 return policy_controller_.get(); | 673 return policy_controller_.get(); |
| 673 } | 674 } |
| 674 | 675 |
| 675 OfflinePageMetadataStore* OfflinePageModelImpl::GetStoreForTesting() { | 676 OfflinePageMetadataStore* OfflinePageModelImpl::GetStoreForTesting() { |
| 676 return store_.get(); | 677 return store_.get(); |
| 677 } | 678 } |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1059 void OfflinePageModelImpl::RunWhenLoaded(const base::Closure& task) { | 1060 void OfflinePageModelImpl::RunWhenLoaded(const base::Closure& task) { |
| 1060 if (!is_loaded_) { | 1061 if (!is_loaded_) { |
| 1061 delayed_tasks_.push_back(task); | 1062 delayed_tasks_.push_back(task); |
| 1062 return; | 1063 return; |
| 1063 } | 1064 } |
| 1064 | 1065 |
| 1065 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task); | 1066 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task); |
| 1066 } | 1067 } |
| 1067 | 1068 |
| 1068 } // namespace offline_pages | 1069 } // namespace offline_pages |
| OLD | NEW |