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

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

Issue 2326593002: [Offline Pages] Simple, mergable fix to no longer report a request completed when it is FOREGROUND_… (Closed)
Patch Set: Created 4 years, 3 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 | « no previous file | 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/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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 is_busy_ = false; 485 is_busy_ = false;
486 active_request_.reset(nullptr); 486 active_request_.reset(nullptr);
487 487
488 if (status == Offliner::RequestStatus::FOREGROUND_CANCELED || 488 if (status == Offliner::RequestStatus::FOREGROUND_CANCELED ||
489 status == Offliner::RequestStatus::PRERENDERING_CANCELED) { 489 status == Offliner::RequestStatus::PRERENDERING_CANCELED) {
490 // Update the request for the canceled attempt. 490 // Update the request for the canceled attempt.
491 // TODO(dougarnett): See if we can conclusively identify other attempt 491 // TODO(dougarnett): See if we can conclusively identify other attempt
492 // aborted cases to treat this way (eg, for Render Process Killed). 492 // aborted cases to treat this way (eg, for Render Process Killed).
493 SavePageRequest updated_request(request); 493 SavePageRequest updated_request(request);
494 AbortRequestAttempt(&updated_request); 494 AbortRequestAttempt(&updated_request);
495 BackgroundSavePageResult notify_status = 495 NotifyChanged(updated_request);
496 (status == Offliner::RequestStatus::FOREGROUND_CANCELED)
497 ? BackgroundSavePageResult::FOREGROUND_CANCELED
498 : BackgroundSavePageResult::PRERENDER_CANCELED;
499 NotifyCompleted(updated_request, notify_status);
500 } else if (status == Offliner::RequestStatus::SAVED) { 496 } else if (status == Offliner::RequestStatus::SAVED) {
501 // Remove the request from the queue if it succeeded. 497 // Remove the request from the queue if it succeeded.
502 RemoveAttemptedRequest(request, BackgroundSavePageResult::SUCCESS); 498 RemoveAttemptedRequest(request, BackgroundSavePageResult::SUCCESS);
503 } else if (request.completed_attempt_count() + 1 >= 499 } else if (request.completed_attempt_count() + 1 >=
504 policy_->GetMaxCompletedTries()) { 500 policy_->GetMaxCompletedTries()) {
505 // Remove from the request queue if we exceeded max retries. The +1 501 // Remove from the request queue if we exceeded max retries. The +1
506 // represents the request that just completed. Since we call 502 // represents the request that just completed. Since we call
507 // MarkAttemptCompleted within the if branches, the completed_attempt_count 503 // MarkAttemptCompleted within the if branches, the completed_attempt_count
508 // has not yet been updated when we are checking the if condition. 504 // has not yet been updated when we are checking the if condition.
509 RemoveAttemptedRequest(request, 505 RemoveAttemptedRequest(request,
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 FOR_EACH_OBSERVER(Observer, observers_, OnChanged(request)); 570 FOR_EACH_OBSERVER(Observer, observers_, OnChanged(request));
575 } 571 }
576 572
577 void RequestCoordinator::GetOffliner() { 573 void RequestCoordinator::GetOffliner() {
578 if (!offliner_) { 574 if (!offliner_) {
579 offliner_ = factory_->GetOffliner(policy_.get()); 575 offliner_ = factory_->GetOffliner(policy_.get());
580 } 576 }
581 } 577 }
582 578
583 } // namespace offline_pages 579 } // namespace offline_pages
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698