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/core/background/request_coordinator.h" | 5 #include "components/offline_pages/core/background/request_coordinator.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1070 } | 1070 } |
1071 | 1071 |
1072 const Scheduler::TriggerConditions RequestCoordinator::GetTriggerConditions( | 1072 const Scheduler::TriggerConditions RequestCoordinator::GetTriggerConditions( |
1073 const bool user_requested) { | 1073 const bool user_requested) { |
1074 return Scheduler::TriggerConditions( | 1074 return Scheduler::TriggerConditions( |
1075 policy_->PowerRequired(user_requested), | 1075 policy_->PowerRequired(user_requested), |
1076 policy_->BatteryPercentageRequired(user_requested), | 1076 policy_->BatteryPercentageRequired(user_requested), |
1077 policy_->UnmeteredNetworkRequired(user_requested)); | 1077 policy_->UnmeteredNetworkRequired(user_requested)); |
1078 } | 1078 } |
1079 | 1079 |
| 1080 void RequestCoordinator::ObserveResourceTracking(const ResourceDataType type, |
| 1081 int64_t started_count, |
| 1082 int64_t completed_count) { |
| 1083 if (state_ != RequestCoordinatorState::OFFLINING) |
| 1084 return; |
| 1085 offliner_->ObserveResourceTracking(type, started_count, completed_count); |
| 1086 } |
| 1087 |
1080 void RequestCoordinator::AddObserver(Observer* observer) { | 1088 void RequestCoordinator::AddObserver(Observer* observer) { |
1081 DCHECK(observer); | 1089 DCHECK(observer); |
1082 observers_.AddObserver(observer); | 1090 observers_.AddObserver(observer); |
1083 } | 1091 } |
1084 | 1092 |
1085 void RequestCoordinator::RemoveObserver(Observer* observer) { | 1093 void RequestCoordinator::RemoveObserver(Observer* observer) { |
1086 observers_.RemoveObserver(observer); | 1094 observers_.RemoveObserver(observer); |
1087 } | 1095 } |
1088 | 1096 |
1089 void RequestCoordinator::NotifyAdded(const SavePageRequest& request) { | 1097 void RequestCoordinator::NotifyAdded(const SavePageRequest& request) { |
(...skipping 29 matching lines...) Expand all Loading... |
1119 event_logger_.RecordOfflinerResult(request.client_id().name_space, status, | 1127 event_logger_.RecordOfflinerResult(request.client_id().name_space, status, |
1120 request.request_id()); | 1128 request.request_id()); |
1121 RecordOfflinerResultUMA(request.client_id(), request.creation_time(), status); | 1129 RecordOfflinerResultUMA(request.client_id(), request.creation_time(), status); |
1122 } | 1130 } |
1123 | 1131 |
1124 void RequestCoordinator::Shutdown() { | 1132 void RequestCoordinator::Shutdown() { |
1125 network_quality_estimator_ = nullptr; | 1133 network_quality_estimator_ = nullptr; |
1126 } | 1134 } |
1127 | 1135 |
1128 } // namespace offline_pages | 1136 } // namespace offline_pages |
OLD | NEW |