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

Side by Side Diff: components/offline_pages/core/background/request_coordinator.cc

Issue 2775223006: [Offline Pages] Improve RequestCoordinator state tracking. (Closed)
Patch Set: comments. Created 3 years, 8 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/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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 } 190 }
191 191
192 RequestCoordinator::RequestCoordinator( 192 RequestCoordinator::RequestCoordinator(
193 std::unique_ptr<OfflinerPolicy> policy, 193 std::unique_ptr<OfflinerPolicy> policy,
194 std::unique_ptr<Offliner> offliner, 194 std::unique_ptr<Offliner> offliner,
195 std::unique_ptr<RequestQueue> queue, 195 std::unique_ptr<RequestQueue> queue,
196 std::unique_ptr<Scheduler> scheduler, 196 std::unique_ptr<Scheduler> scheduler,
197 net::NetworkQualityEstimator::NetworkQualityProvider* 197 net::NetworkQualityEstimator::NetworkQualityProvider*
198 network_quality_estimator) 198 network_quality_estimator)
199 : is_low_end_device_(base::SysInfo::IsLowEndDevice()), 199 : is_low_end_device_(base::SysInfo::IsLowEndDevice()),
200 is_busy_(false), 200 state_(RequestCoordinatorState::IDLE),
201 is_starting_(false),
202 processing_state_(ProcessingWindowState::STOPPED), 201 processing_state_(ProcessingWindowState::STOPPED),
203 use_test_device_conditions_(false), 202 use_test_device_conditions_(false),
204 offliner_(std::move(offliner)), 203 offliner_(std::move(offliner)),
205 policy_(std::move(policy)), 204 policy_(std::move(policy)),
206 queue_(std::move(queue)), 205 queue_(std::move(queue)),
207 scheduler_(std::move(scheduler)), 206 scheduler_(std::move(scheduler)),
208 policy_controller_(new ClientPolicyController()), 207 policy_controller_(new ClientPolicyController()),
209 network_quality_estimator_(network_quality_estimator), 208 network_quality_estimator_(network_quality_estimator),
210 active_request_(nullptr), 209 active_request_(nullptr),
211 last_offlining_status_(Offliner::RequestStatus::UNKNOWN), 210 last_offlining_status_(Offliner::RequestStatus::UNKNOWN),
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 void RequestCoordinator::GetQueuedRequestsCallback( 279 void RequestCoordinator::GetQueuedRequestsCallback(
281 const GetRequestsCallback& callback, 280 const GetRequestsCallback& callback,
282 GetRequestsResult result, 281 GetRequestsResult result,
283 std::vector<std::unique_ptr<SavePageRequest>> requests) { 282 std::vector<std::unique_ptr<SavePageRequest>> requests) {
284 callback.Run(std::move(requests)); 283 callback.Run(std::move(requests));
285 } 284 }
286 285
287 void RequestCoordinator::StopPrerendering( 286 void RequestCoordinator::StopPrerendering(
288 const Offliner::CancelCallback& final_callback, 287 const Offliner::CancelCallback& final_callback,
289 Offliner::RequestStatus stop_status) { 288 Offliner::RequestStatus stop_status) {
290 if (offliner_ && is_busy_) { 289 if (offliner_ && state_ == RequestCoordinatorState::OFFLINING) {
291 DCHECK(active_request_.get()); 290 DCHECK(active_request_.get());
292 offliner_->Cancel(base::Bind( 291 offliner_->Cancel(base::Bind(
293 &RequestCoordinator::HandleCancelUpdateStatusCallback, 292 &RequestCoordinator::HandleCancelUpdateStatusCallback,
294 weak_ptr_factory_.GetWeakPtr(), final_callback, stop_status)); 293 weak_ptr_factory_.GetWeakPtr(), final_callback, stop_status));
295 return; 294 return;
296 } 295 }
297 296
298 UpdateStatusForCancel(stop_status); 297 UpdateStatusForCancel(stop_status);
299 int64_t request_id = 298 int64_t request_id =
300 active_request_.get() ? active_request_->request_id() : 0LL; 299 active_request_.get() ? active_request_->request_id() : 0LL;
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 // Stopping offliner means it will not call callback so set last status. 547 // Stopping offliner means it will not call callback so set last status.
549 last_offlining_status_ = stop_status; 548 last_offlining_status_ = stop_status;
550 549
551 if (active_request_) { 550 if (active_request_) {
552 event_logger_.RecordOfflinerResult(active_request_->client_id().name_space, 551 event_logger_.RecordOfflinerResult(active_request_->client_id().name_space,
553 last_offlining_status_, 552 last_offlining_status_,
554 active_request_->request_id()); 553 active_request_->request_id());
555 RecordOfflinerResultUMA(active_request_->client_id(), 554 RecordOfflinerResultUMA(active_request_->client_id(),
556 active_request_->creation_time(), 555 active_request_->creation_time(),
557 last_offlining_status_); 556 last_offlining_status_);
558 is_busy_ = false; 557 state_ = RequestCoordinatorState::IDLE;
559 active_request_.reset(); 558 active_request_.reset();
560 } 559 }
561 } 560 }
562 561
563 void RequestCoordinator::ResetActiveRequestCallback(int64_t offline_id) { 562 void RequestCoordinator::ResetActiveRequestCallback(int64_t offline_id) {
564 active_request_.reset(); 563 active_request_.reset();
565 } 564 }
566 565
567 void RequestCoordinator::StartSchedulerCallback(int64_t offline_id) { 566 void RequestCoordinator::StartSchedulerCallback(int64_t offline_id) {
568 scheduler_callback_.Run(true); 567 scheduler_callback_.Run(true);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 "OfflinePages.Background.ImmediateStartStatus", immediate_start_status, 616 "OfflinePages.Background.ImmediateStartStatus", immediate_start_status,
618 RequestCoordinator::OfflinerImmediateStartStatus::STATUS_COUNT); 617 RequestCoordinator::OfflinerImmediateStartStatus::STATUS_COUNT);
619 return immediate_start_status == OfflinerImmediateStartStatus::STARTED; 618 return immediate_start_status == OfflinerImmediateStartStatus::STARTED;
620 } 619 }
621 620
622 // The current_conditions_ must be set sometime before calling 621 // The current_conditions_ must be set sometime before calling
623 // StartProcessingInternal on all calling code paths. 622 // StartProcessingInternal on all calling code paths.
624 bool RequestCoordinator::StartProcessingInternal( 623 bool RequestCoordinator::StartProcessingInternal(
625 const ProcessingWindowState processing_state, 624 const ProcessingWindowState processing_state,
626 const base::Callback<void(bool)>& callback) { 625 const base::Callback<void(bool)>& callback) {
627 if (is_starting_ || is_busy_) 626 if (state_ != RequestCoordinatorState::IDLE)
628 return false; 627 return false;
629 processing_state_ = processing_state; 628 processing_state_ = processing_state;
630 scheduler_callback_ = callback; 629 scheduler_callback_ = callback;
631 630
632 // Mark the time at which we started processing so we can check our time 631 // Mark the time at which we started processing so we can check our time
633 // budget. 632 // budget.
634 operation_start_time_ = base::Time::Now(); 633 operation_start_time_ = base::Time::Now();
635 634
636 TryNextRequest(kStartOfProcessing); 635 TryNextRequest(kStartOfProcessing);
637 636
638 return true; 637 return true;
639 } 638 }
640 639
641 void RequestCoordinator::StartImmediatelyIfConnected() { 640 void RequestCoordinator::StartImmediatelyIfConnected() {
642 StartImmediateProcessing(internal_start_processing_callback_); 641 StartImmediateProcessing(internal_start_processing_callback_);
643 } 642 }
644 643
645 RequestCoordinator::OfflinerImmediateStartStatus 644 RequestCoordinator::OfflinerImmediateStartStatus
646 RequestCoordinator::TryImmediateStart( 645 RequestCoordinator::TryImmediateStart(
647 const base::Callback<void(bool)>& callback) { 646 const base::Callback<void(bool)>& callback) {
648 DVLOG(2) << "Immediate " << __func__; 647 DVLOG(2) << "Immediate " << __func__;
649 // Make sure not already busy processing. 648 // Make sure not already busy processing.
650 if (is_busy_) 649 if (state_ == RequestCoordinatorState::OFFLINING)
651 return OfflinerImmediateStartStatus::BUSY; 650 return OfflinerImmediateStartStatus::BUSY;
652 651
653 // Make sure we are not on svelte device to start immediately. 652 // Make sure we are not on svelte device to start immediately.
654 if (is_low_end_device_ && 653 if (is_low_end_device_ &&
655 !offline_pages::IsOfflinePagesSvelteConcurrentLoadingEnabled()) { 654 !offline_pages::IsOfflinePagesSvelteConcurrentLoadingEnabled()) {
656 DVLOG(2) << "low end device, returning"; 655 DVLOG(2) << "low end device, returning";
657 // Let the scheduler know we are done processing and failed due to svelte. 656 // Let the scheduler know we are done processing and failed due to svelte.
658 callback.Run(false); 657 callback.Run(false);
659 return OfflinerImmediateStartStatus::NOT_STARTED_ON_SVELTE; 658 return OfflinerImmediateStartStatus::NOT_STARTED_ON_SVELTE;
660 } 659 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 // If we have already set the connection type for testing, don't get it from 694 // If we have already set the connection type for testing, don't get it from
696 // android, but use what the test already set up. 695 // android, but use what the test already set up.
697 if (use_test_device_conditions_) 696 if (use_test_device_conditions_)
698 return; 697 return;
699 698
700 current_conditions_ = base::MakeUnique<DeviceConditions>( 699 current_conditions_ = base::MakeUnique<DeviceConditions>(
701 scheduler_->GetCurrentDeviceConditions()); 700 scheduler_->GetCurrentDeviceConditions());
702 } 701 }
703 702
704 void RequestCoordinator::TryNextRequest(bool is_start_of_processing) { 703 void RequestCoordinator::TryNextRequest(bool is_start_of_processing) {
705 is_starting_ = true; 704 state_ = RequestCoordinatorState::PICKING;
706 705
707 // If this is the first call, the device conditions are current, no need to 706 // If this is the first call, the device conditions are current, no need to
708 // update them. 707 // update them.
709 // TODO(petewil): Now that we can get conditions any time, consider getting 708 // TODO(petewil): Now that we can get conditions any time, consider getting
710 // them now instead of passing them in earlier when we start scheduled 709 // them now instead of passing them in earlier when we start scheduled
711 // processing. 710 // processing.
712 if (!is_start_of_processing) { 711 if (!is_start_of_processing) {
713 // Get current device conditions from the Java side across the bridge. 712 // Get current device conditions from the Java side across the bridge.
714 // NetworkChangeNotifier will not have the right conditions if chromium is 713 // NetworkChangeNotifier will not have the right conditions if chromium is
715 // in the background in android, so prefer to always get the conditions via 714 // in the background in android, so prefer to always get the conditions via
(...skipping 14 matching lines...) Expand all
730 net::NetworkChangeNotifier::ConnectionType connection_type = 729 net::NetworkChangeNotifier::ConnectionType connection_type =
731 current_conditions_->GetNetConnectionType(); 730 current_conditions_->GetNetConnectionType();
732 731
733 // If there is no network or no time left in the budget, return to the 732 // If there is no network or no time left in the budget, return to the
734 // scheduler. We do not remove the pending scheduler task that was set 733 // scheduler. We do not remove the pending scheduler task that was set
735 // up earlier in case we run out of time, so the background scheduler 734 // up earlier in case we run out of time, so the background scheduler
736 // will return to us at the next opportunity to run background tasks. 735 // will return to us at the next opportunity to run background tasks.
737 if (connection_type == 736 if (connection_type ==
738 net::NetworkChangeNotifier::ConnectionType::CONNECTION_NONE || 737 net::NetworkChangeNotifier::ConnectionType::CONNECTION_NONE ||
739 (base::Time::Now() - operation_start_time_) > processing_time_budget) { 738 (base::Time::Now() - operation_start_time_) > processing_time_budget) {
740 is_starting_ = false; 739 state_ = RequestCoordinatorState::IDLE;
741 740
742 // If we were doing immediate processing, try to start it again 741 // If we were doing immediate processing, try to start it again
743 // when we get connected. 742 // when we get connected.
744 if (processing_state_ == ProcessingWindowState::IMMEDIATE_WINDOW) 743 if (processing_state_ == ProcessingWindowState::IMMEDIATE_WINDOW)
745 RequestConnectedEventForStarting(); 744 RequestConnectedEventForStarting();
746 745
747 // Let the scheduler know we are done processing. 746 // Let the scheduler know we are done processing.
748 // TODO: Make sure the scheduler callback is valid before running it. 747 // TODO: Make sure the scheduler callback is valid before running it.
749 scheduler_callback_.Run(true); 748 scheduler_callback_.Run(true);
750 DVLOG(2) << " out of time, giving up. " << __func__; 749 DVLOG(2) << " out of time, giving up. " << __func__;
(...skipping 15 matching lines...) Expand all
766 // TODO(petewil): Verify current_conditions has a good value on all calling 765 // TODO(petewil): Verify current_conditions has a good value on all calling
767 // paths. It is really more of a "last known conditions" than "current 766 // paths. It is really more of a "last known conditions" than "current
768 // conditions". Consider having a call to Java to check the current 767 // conditions". Consider having a call to Java to check the current
769 // conditions. 768 // conditions.
770 } 769 }
771 770
772 // Called by the request picker when a request has been picked. 771 // Called by the request picker when a request has been picked.
773 void RequestCoordinator::RequestPicked(const SavePageRequest& request, 772 void RequestCoordinator::RequestPicked(const SavePageRequest& request,
774 bool cleanup_needed) { 773 bool cleanup_needed) {
775 DVLOG(2) << request.url() << " " << __func__; 774 DVLOG(2) << request.url() << " " << __func__;
776 is_starting_ = false; 775 state_ = RequestCoordinatorState::OFFLINING;
777 776
778 // Make sure we were not stopped while picking. 777 // If we were stopped while picking or offliner got killed then reset the
779 if (processing_state_ != ProcessingWindowState::STOPPED) { 778 // state of request coordinator, otherwise send the request to offliner.
780 // Send the request on to the offliner. 779 if (processing_state_ == ProcessingWindowState::STOPPED || !offliner_) {
780 if (!offliner_) {
Pete Williamson 2017/03/28 17:12:43 Let's remove this if !offliner check from both if
romax 2017/03/29 03:02:09 Done.
781 // TODO(chili,petewil): We should have UMA here to track frequency of
782 // this, if it happens at all.
783 DVLOG(0) << "Offliner crashed. Cannot background offline page.";
784 }
785 state_ = RequestCoordinatorState::IDLE;
786 } else {
781 SendRequestToOffliner(request); 787 SendRequestToOffliner(request);
Pete Williamson 2017/03/28 17:12:43 Since we aren't checking the return value anymore,
romax 2017/03/29 03:02:09 Done.
782 } 788 }
783 789
784 // Schedule a queue cleanup if needed. 790 // Schedule a queue cleanup if needed.
785 if (cleanup_needed) 791 if (cleanup_needed)
786 queue_->CleanupRequestQueue(); 792 queue_->CleanupRequestQueue();
787 } 793 }
788 794
789 void RequestCoordinator::RequestNotPicked( 795 void RequestCoordinator::RequestNotPicked(
790 bool non_user_requested_tasks_remaining, 796 bool non_user_requested_tasks_remaining,
791 bool cleanup_needed) { 797 bool cleanup_needed) {
792 DVLOG(2) << __func__; 798 DVLOG(2) << __func__;
793 is_starting_ = false; 799 state_ = RequestCoordinatorState::IDLE;
794 800
795 // Clear the outstanding "safety" task in the scheduler. 801 // Clear the outstanding "safety" task in the scheduler.
796 scheduler_->Unschedule(); 802 scheduler_->Unschedule();
797 803
798 // If disabled tasks remain, post a new safety task for 5 sec from now. 804 // If disabled tasks remain, post a new safety task for 5 sec from now.
799 if (disabled_requests_.size() > 0) { 805 if (disabled_requests_.size() > 0) {
800 scheduler_->BackupSchedule(GetTriggerConditions(kUserRequest), 806 scheduler_->BackupSchedule(GetTriggerConditions(kUserRequest),
801 kDisabledTaskRecheckSeconds); 807 kDisabledTaskRecheckSeconds);
802 } else if (non_user_requested_tasks_remaining) { 808 } else if (non_user_requested_tasks_remaining) {
803 // If we don't have any of those, check for non-user-requested tasks. 809 // If we don't have any of those, check for non-user-requested tasks.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 UMA_HISTOGRAM_COUNTS_1000( 858 UMA_HISTOGRAM_COUNTS_1000(
853 "OfflinePages.Background.ImmediateStart.AvailableRequestCount", 859 "OfflinePages.Background.ImmediateStart.AvailableRequestCount",
854 available_requests); 860 available_requests);
855 UMA_HISTOGRAM_COUNTS_1000( 861 UMA_HISTOGRAM_COUNTS_1000(
856 "OfflinePages.Background.ImmediateStart.UnavailableRequestCount", 862 "OfflinePages.Background.ImmediateStart.UnavailableRequestCount",
857 total_requests - available_requests); 863 total_requests - available_requests);
858 } 864 }
859 } 865 }
860 } 866 }
861 867
862 void RequestCoordinator::SendRequestToOffliner(const SavePageRequest& request) { 868 bool RequestCoordinator::SendRequestToOffliner(const SavePageRequest& request) {
863 // Check that offlining didn't get cancelled while performing some async 869 DCHECK(state_ == RequestCoordinatorState::OFFLINING);
864 // steps.
865 if (processing_state_ == ProcessingWindowState::STOPPED)
866 return;
867
868 if (!offliner_) {
869 // TODO(chili,petewil): We should have UMA here to track frequency of this,
870 // if it happens at all.
871 DVLOG(0) << "Offliner crashed. Cannot background offline page.";
872 return;
873 }
874
875 DCHECK(!is_busy_);
876 is_busy_ = true;
877
878 // Record start time if this is first attempt. 870 // Record start time if this is first attempt.
879 if (request.started_attempt_count() == 0) { 871 if (request.started_attempt_count() == 0) {
880 RecordStartTimeUMA(request); 872 RecordStartTimeUMA(request);
881 } 873 }
882 874
883 // Mark attempt started in the database and start offliner when completed. 875 // Mark attempt started in the database and start offliner when completed.
884 queue_->MarkAttemptStarted( 876 queue_->MarkAttemptStarted(
885 request.request_id(), 877 request.request_id(),
886 base::Bind(&RequestCoordinator::StartOffliner, 878 base::Bind(&RequestCoordinator::StartOffliner,
887 weak_ptr_factory_.GetWeakPtr(), request.request_id(), 879 weak_ptr_factory_.GetWeakPtr(), request.request_id(),
888 request.client_id().name_space)); 880 request.client_id().name_space));
881 return true;
889 } 882 }
890 883
891 void RequestCoordinator::StartOffliner( 884 void RequestCoordinator::StartOffliner(
892 int64_t request_id, 885 int64_t request_id,
893 const std::string& client_namespace, 886 const std::string& client_namespace,
894 std::unique_ptr<UpdateRequestsResult> update_result) { 887 std::unique_ptr<UpdateRequestsResult> update_result) {
895 if (update_result->store_state != StoreState::LOADED || 888 if (update_result->store_state != StoreState::LOADED ||
896 update_result->item_statuses.size() != 1 || 889 update_result->item_statuses.size() != 1 ||
897 update_result->item_statuses.at(0).first != request_id || 890 update_result->item_statuses.at(0).first != request_id ||
898 update_result->item_statuses.at(0).second != ItemActionStatus::SUCCESS) { 891 update_result->item_statuses.at(0).second != ItemActionStatus::SUCCESS) {
899 is_busy_ = false; 892 state_ = RequestCoordinatorState::IDLE;
900 StopProcessing(Offliner::QUEUE_UPDATE_FAILED); 893 StopProcessing(Offliner::QUEUE_UPDATE_FAILED);
901 DVLOG(1) << "Failed to mark attempt started: " << request_id; 894 DVLOG(1) << "Failed to mark attempt started: " << request_id;
902 UpdateRequestResult request_result = 895 UpdateRequestResult request_result =
903 update_result->store_state != StoreState::LOADED 896 update_result->store_state != StoreState::LOADED
904 ? UpdateRequestResult::STORE_FAILURE 897 ? UpdateRequestResult::STORE_FAILURE
905 : UpdateRequestResult::REQUEST_DOES_NOT_EXIST; 898 : UpdateRequestResult::REQUEST_DOES_NOT_EXIST;
906 event_logger_.RecordUpdateRequestFailed(client_namespace, request_result); 899 event_logger_.RecordUpdateRequestFailed(client_namespace, request_result);
907 return; 900 return;
908 } 901 }
909 902
(...skipping 19 matching lines...) Expand all
929 policy_->GetSinglePageTimeLimitForImmediateLoadInSeconds()); 922 policy_->GetSinglePageTimeLimitForImmediateLoadInSeconds());
930 } 923 }
931 924
932 // Inform observer of active request. 925 // Inform observer of active request.
933 NotifyChanged(*active_request_.get()); 926 NotifyChanged(*active_request_.get());
934 927
935 // Start a watchdog timer to catch pre-renders running too long 928 // Start a watchdog timer to catch pre-renders running too long
936 watchdog_timer_.Start(FROM_HERE, timeout, this, 929 watchdog_timer_.Start(FROM_HERE, timeout, this,
937 &RequestCoordinator::HandleWatchdogTimeout); 930 &RequestCoordinator::HandleWatchdogTimeout);
938 } else { 931 } else {
939 is_busy_ = false; 932 state_ = RequestCoordinatorState::IDLE;
940 DVLOG(0) << "Unable to start LoadAndSave"; 933 DVLOG(0) << "Unable to start LoadAndSave";
941 StopProcessing(Offliner::LOADING_NOT_ACCEPTED); 934 StopProcessing(Offliner::LOADING_NOT_ACCEPTED);
942 935
943 // We need to undo the MarkAttemptStarted that brought us to this 936 // We need to undo the MarkAttemptStarted that brought us to this
944 // method since we didn't success in starting after all. 937 // method since we didn't success in starting after all.
945 MarkAttemptAborted(request_id, client_namespace); 938 MarkAttemptAborted(request_id, client_namespace);
946 } 939 }
947 } 940 }
948 941
949 void RequestCoordinator::OfflinerDoneCallback(const SavePageRequest& request, 942 void RequestCoordinator::OfflinerDoneCallback(const SavePageRequest& request,
950 Offliner::RequestStatus status) { 943 Offliner::RequestStatus status) {
951 DVLOG(2) << "offliner finished, saved: " 944 DVLOG(2) << "offliner finished, saved: "
952 << (status == Offliner::RequestStatus::SAVED) 945 << (status == Offliner::RequestStatus::SAVED)
953 << ", status: " << static_cast<int>(status) << ", " << __func__; 946 << ", status: " << static_cast<int>(status) << ", " << __func__;
954 DCHECK_NE(status, Offliner::RequestStatus::UNKNOWN); 947 DCHECK_NE(status, Offliner::RequestStatus::UNKNOWN);
955 DCHECK_NE(status, Offliner::RequestStatus::LOADED); 948 DCHECK_NE(status, Offliner::RequestStatus::LOADED);
956 event_logger_.RecordOfflinerResult(request.client_id().name_space, status, 949 event_logger_.RecordOfflinerResult(request.client_id().name_space, status,
957 request.request_id()); 950 request.request_id());
958 last_offlining_status_ = status; 951 last_offlining_status_ = status;
959 RecordOfflinerResultUMA(request.client_id(), request.creation_time(), 952 RecordOfflinerResultUMA(request.client_id(), request.creation_time(),
960 last_offlining_status_); 953 last_offlining_status_);
961 watchdog_timer_.Stop(); 954 watchdog_timer_.Stop();
962 is_busy_ = false; 955 state_ = RequestCoordinatorState::IDLE;
963 active_request_.reset(nullptr); 956 active_request_.reset(nullptr);
964 957
965 UpdateRequestForCompletedAttempt(request, status); 958 UpdateRequestForCompletedAttempt(request, status);
966 if (ShouldTryNextRequest(status)) 959 if (ShouldTryNextRequest(status))
967 TryNextRequest(!kStartOfProcessing); 960 TryNextRequest(!kStartOfProcessing);
968 else 961 else
969 scheduler_callback_.Run(true); 962 scheduler_callback_.Run(true);
970 } 963 }
971 964
972 void RequestCoordinator::OfflinerProgressCallback( 965 void RequestCoordinator::OfflinerProgressCallback(
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 1111
1119 ClientPolicyController* RequestCoordinator::GetPolicyController() { 1112 ClientPolicyController* RequestCoordinator::GetPolicyController() {
1120 return policy_controller_.get(); 1113 return policy_controller_.get();
1121 } 1114 }
1122 1115
1123 void RequestCoordinator::Shutdown() { 1116 void RequestCoordinator::Shutdown() {
1124 network_quality_estimator_ = nullptr; 1117 network_quality_estimator_ = nullptr;
1125 } 1118 }
1126 1119
1127 } // namespace offline_pages 1120 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698