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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 } | 405 } |
406 | 406 |
407 void RequestCoordinator::RemoveRequests( | 407 void RequestCoordinator::RemoveRequests( |
408 const std::vector<int64_t>& request_ids, | 408 const std::vector<int64_t>& request_ids, |
409 const RemoveRequestsCallback& callback) { | 409 const RemoveRequestsCallback& callback) { |
410 bool canceled = CancelActiveRequestIfItMatches(request_ids); | 410 bool canceled = CancelActiveRequestIfItMatches(request_ids); |
411 queue_->RemoveRequests( | 411 queue_->RemoveRequests( |
412 request_ids, | 412 request_ids, |
413 base::Bind(&RequestCoordinator::HandleRemovedRequestsAndCallback, | 413 base::Bind(&RequestCoordinator::HandleRemovedRequestsAndCallback, |
414 weak_ptr_factory_.GetWeakPtr(), callback, | 414 weak_ptr_factory_.GetWeakPtr(), callback, |
415 RequestNotifier::BackgroundSavePageResult::REMOVED)); | 415 RequestNotifier::BackgroundSavePageResult::USER_CANCELED)); |
416 | 416 |
417 // Record the network quality when this request is removed. | 417 // Record the network quality when this request is removed. |
418 if (network_quality_estimator_) { | 418 if (network_quality_estimator_) { |
419 UMA_HISTOGRAM_ENUMERATION( | 419 UMA_HISTOGRAM_ENUMERATION( |
420 "OfflinePages.Background.EffectiveConnectionType.RemoveRequests", | 420 "OfflinePages.Background.EffectiveConnectionType.RemoveRequests", |
421 network_quality_estimator_->GetEffectiveConnectionType(), | 421 network_quality_estimator_->GetEffectiveConnectionType(), |
422 net::EFFECTIVE_CONNECTION_TYPE_LAST); | 422 net::EFFECTIVE_CONNECTION_TYPE_LAST); |
423 } | 423 } |
424 | 424 |
425 if (canceled) | 425 if (canceled) |
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1119 event_logger_.RecordOfflinerResult(request.client_id().name_space, status, | 1119 event_logger_.RecordOfflinerResult(request.client_id().name_space, status, |
1120 request.request_id()); | 1120 request.request_id()); |
1121 RecordOfflinerResultUMA(request.client_id(), request.creation_time(), status); | 1121 RecordOfflinerResultUMA(request.client_id(), request.creation_time(), status); |
1122 } | 1122 } |
1123 | 1123 |
1124 void RequestCoordinator::Shutdown() { | 1124 void RequestCoordinator::Shutdown() { |
1125 network_quality_estimator_ = nullptr; | 1125 network_quality_estimator_ = nullptr; |
1126 } | 1126 } |
1127 | 1127 |
1128 } // namespace offline_pages | 1128 } // namespace offline_pages |
OLD | NEW |