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

Side by Side Diff: components/offline_pages/offline_page_model_impl.cc

Issue 2111653002: [Offline Pages] Adding metadatas for namespace async_loading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Making async namespace persistent. Created 4 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
OLDNEW
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
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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 void OfflinePageModelImpl::RunWhenLoaded(const base::Closure& task) { 1054 void OfflinePageModelImpl::RunWhenLoaded(const base::Closure& task) {
1054 if (!is_loaded_) { 1055 if (!is_loaded_) {
1055 delayed_tasks_.push_back(task); 1056 delayed_tasks_.push_back(task);
1056 return; 1057 return;
1057 } 1058 }
1058 1059
1059 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task); 1060 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task);
1060 } 1061 }
1061 1062
1062 } // namespace offline_pages 1063 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698