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

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

Issue 2191183002: [Offline Pages] Add expiration in internal log. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test Created 4 years, 4 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
« no previous file with comments | « components/offline_pages/offline_page_model_event_logger_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 void OfflinePageModelImpl::OnExpirePageDone(int64_t offline_id, 657 void OfflinePageModelImpl::OnExpirePageDone(int64_t offline_id,
658 const base::Time& expiration_time, 658 const base::Time& expiration_time,
659 bool success) { 659 bool success) {
660 UMA_HISTOGRAM_BOOLEAN("OfflinePages.ExpirePage.StoreUpdateResult", success); 660 UMA_HISTOGRAM_BOOLEAN("OfflinePages.ExpirePage.StoreUpdateResult", success);
661 if (!success) 661 if (!success)
662 return; 662 return;
663 const auto& iter = offline_pages_.find(offline_id); 663 const auto& iter = offline_pages_.find(offline_id);
664 if (iter != offline_pages_.end()) { 664 if (iter != offline_pages_.end()) {
665 iter->second.expiration_time = expiration_time; 665 iter->second.expiration_time = expiration_time;
666 ClientId client_id = iter->second.client_id; 666 ClientId client_id = iter->second.client_id;
667 offline_event_logger_.RecordPageExpired(std::to_string(offline_id));
667 base::HistogramBase* histogram = base::Histogram::FactoryGet( 668 base::HistogramBase* histogram = base::Histogram::FactoryGet(
668 AddHistogramSuffix(client_id, "OfflinePages.ExpirePage.PageLifetime"), 669 AddHistogramSuffix(client_id, "OfflinePages.ExpirePage.PageLifetime"),
669 1, base::TimeDelta::FromDays(30).InMinutes(), 50, 670 1, base::TimeDelta::FromDays(30).InMinutes(), 50,
670 base::HistogramBase::kUmaTargetedHistogramFlag); 671 base::HistogramBase::kUmaTargetedHistogramFlag);
671 histogram->Add((expiration_time - iter->second.creation_time).InMinutes()); 672 histogram->Add((expiration_time - iter->second.creation_time).InMinutes());
672 histogram = base::Histogram::FactoryGet( 673 histogram = base::Histogram::FactoryGet(
673 AddHistogramSuffix(client_id, 674 AddHistogramSuffix(client_id,
674 "OfflinePages.ExpirePage.TimeSinceLastAccess"), 675 "OfflinePages.ExpirePage.TimeSinceLastAccess"),
675 1, base::TimeDelta::FromDays(30).InMinutes(), 50, 676 1, base::TimeDelta::FromDays(30).InMinutes(), 50,
676 base::HistogramBase::kUmaTargetedHistogramFlag); 677 base::HistogramBase::kUmaTargetedHistogramFlag);
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 void OfflinePageModelImpl::RunWhenLoaded(const base::Closure& task) { 1071 void OfflinePageModelImpl::RunWhenLoaded(const base::Closure& task) {
1071 if (!is_loaded_) { 1072 if (!is_loaded_) {
1072 delayed_tasks_.push_back(task); 1073 delayed_tasks_.push_back(task);
1073 return; 1074 return;
1074 } 1075 }
1075 1076
1076 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task); 1077 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task);
1077 } 1078 }
1078 1079
1079 } // namespace offline_pages 1080 } // namespace offline_pages
OLDNEW
« no previous file with comments | « components/offline_pages/offline_page_model_event_logger_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698