| 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/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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 // check here to ensure we only start tasks in status pending, and bail out in | 71 // check here to ensure we only start tasks in status pending, and bail out in |
| 72 // other cases. | 72 // other cases. |
| 73 last_attempt_time_ = start_time; | 73 last_attempt_time_ = start_time; |
| 74 ++attempt_count_; | 74 ++attempt_count_; |
| 75 } | 75 } |
| 76 | 76 |
| 77 void SavePageRequest::MarkAttemptCompleted() { | 77 void SavePageRequest::MarkAttemptCompleted() { |
| 78 last_attempt_time_ = base::Time(); | 78 last_attempt_time_ = base::Time(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void SavePageRequest::MarkAttemptAborted() { |
| 82 DCHECK_GT(attempt_count_, 0); |
| 83 last_attempt_time_ = base::Time(); |
| 84 // TODO(dougarnett): Would be safer if we had two persisted counters |
| 85 // (attempts_started and attempts_completed) rather just one with decrement. |
| 86 --attempt_count_; |
| 87 } |
| 88 |
| 81 } // namespace offline_pages | 89 } // namespace offline_pages |
| OLD | NEW |