Chromium Code Reviews| 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/background/request_coordinator.h" | 5 #include "components/offline_pages/background/request_coordinator.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 631 // No further processing in this service window. | 631 // No further processing in this service window. |
| 632 break; | 632 break; |
| 633 default: | 633 default: |
| 634 // Make explicit choice about new status codes that actually reach here. | 634 // Make explicit choice about new status codes that actually reach here. |
| 635 // Their default is no further processing in this service window. | 635 // Their default is no further processing in this service window. |
| 636 NOTREACHED(); | 636 NOTREACHED(); |
| 637 } | 637 } |
| 638 } | 638 } |
| 639 | 639 |
| 640 void RequestCoordinator::EnableForOffliner(int64_t request_id) { | 640 void RequestCoordinator::EnableForOffliner(int64_t request_id) { |
| 641 disabled_requests_.erase(request_id); | 641 if (disabled_requests_.find(request_id) == disabled_requests_.end()) |
|
dewittj
2016/10/12 03:27:27
this is a subtle difference and not covered by any
Pete Williamson
2016/10/12 17:33:36
Agree with DewittJ that a comment here would help.
Dmitry Titov
2016/10/12 23:11:14
Done. Added comment. Peter, could you consider add
Pete Williamson
2016/10/12 23:31:41
Sure. Open bug?
| |
| 642 // If we are not busy, start processing right away. | 642 return; |
| 643 StartProcessingIfConnected(); | 643 disabled_requests_.erase(request_id); |
| 644 // If we are not busy, start processing right away. | |
| 645 StartProcessingIfConnected(); | |
| 644 } | 646 } |
| 645 | 647 |
| 646 void RequestCoordinator::MarkRequestCompleted(int64_t request_id) { | 648 void RequestCoordinator::MarkRequestCompleted(int64_t request_id) { |
| 649 if (disabled_requests_.find(request_id) == disabled_requests_.end()) | |
| 650 return; | |
| 651 disabled_requests_.erase(request_id); | |
| 652 | |
| 647 // Remove the request, but send out SUCCEEDED instead of removed. | 653 // Remove the request, but send out SUCCEEDED instead of removed. |
| 648 std::vector<int64_t> request_ids { request_id }; | 654 std::vector<int64_t> request_ids { request_id }; |
| 649 queue_->RemoveRequests( | 655 queue_->RemoveRequests( |
| 650 request_ids, | 656 request_ids, |
| 651 base::Bind(&RequestCoordinator::HandleRemovedRequestsAndCallback, | 657 base::Bind(&RequestCoordinator::HandleRemovedRequestsAndCallback, |
| 652 weak_ptr_factory_.GetWeakPtr(), | 658 weak_ptr_factory_.GetWeakPtr(), |
| 653 base::Bind(&RequestCoordinator::CompletedRequestCallback, | 659 base::Bind(&RequestCoordinator::CompletedRequestCallback, |
| 654 weak_ptr_factory_.GetWeakPtr()), | 660 weak_ptr_factory_.GetWeakPtr()), |
| 655 BackgroundSavePageResult::SUCCESS)); | 661 BackgroundSavePageResult::SUCCESS)); |
| 656 } | 662 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 693 | 699 |
| 694 ClientPolicyController* RequestCoordinator::GetPolicyController() { | 700 ClientPolicyController* RequestCoordinator::GetPolicyController() { |
| 695 return policy_controller_.get(); | 701 return policy_controller_.get(); |
| 696 } | 702 } |
| 697 | 703 |
| 698 void RequestCoordinator::Shutdown() { | 704 void RequestCoordinator::Shutdown() { |
| 699 network_quality_estimator_ = nullptr; | 705 network_quality_estimator_ = nullptr; |
| 700 } | 706 } |
| 701 | 707 |
| 702 } // namespace offline_pages | 708 } // namespace offline_pages |
| OLD | NEW |