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

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

Issue 2266323002: Cancel prerendering when a request is paused or removed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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/background/save_page_request.h" 5 #include "components/offline_pages/background/save_page_request.h"
6 6
7 namespace offline_pages { 7 namespace offline_pages {
8 8
9 SavePageRequest::SavePageRequest(int64_t request_id, 9 SavePageRequest::SavePageRequest(int64_t request_id,
10 const GURL& url, 10 const GURL& url,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 ++started_attempt_count_; 60 ++started_attempt_count_;
61 state_ = RequestState::PRERENDERING; 61 state_ = RequestState::PRERENDERING;
62 } 62 }
63 63
64 void SavePageRequest::MarkAttemptCompleted() { 64 void SavePageRequest::MarkAttemptCompleted() {
65 ++completed_attempt_count_; 65 ++completed_attempt_count_;
66 state_ = RequestState::AVAILABLE; 66 state_ = RequestState::AVAILABLE;
67 } 67 }
68 68
69 void SavePageRequest::MarkAttemptAborted() { 69 void SavePageRequest::MarkAttemptAborted() {
70 DCHECK_GT(started_attempt_count_, 0);
71 // We intentinally do not increment the completed_attempt_count_, since this 70 // We intentinally do not increment the completed_attempt_count_, since this
72 // was killed before it completed, so we could use the phone or browser for 71 // was killed before it completed, so we could use the phone or browser for
73 // other things. 72 // other things.
74 state_ = RequestState::AVAILABLE; 73 state_ = RequestState::AVAILABLE;
75 } 74 }
76 75
77 void SavePageRequest::MarkAttemptPaused() { 76 void SavePageRequest::MarkAttemptPaused() {
78 state_ = RequestState::PAUSED; 77 state_ = RequestState::PAUSED;
79 } 78 }
80 79
81 } // namespace offline_pages 80 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698