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

Side by Side Diff: chrome/browser/android/offline_pages/prerendering_offliner.cc

Issue 2209813002: [Offline Pages] Moves Coordinator to using MarkAttemptStarted/MarkAttemptCompleted API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge 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
« no previous file with comments | « no previous file | components/offline_pages/background/offliner.h » ('j') | 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 "chrome/browser/android/offline_pages/prerendering_offliner.h" 5 #include "chrome/browser/android/offline_pages/prerendering_offliner.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/sys_info.h" 8 #include "base/sys_info.h"
9 #include "chrome/browser/android/offline_pages/offline_page_mhtml_archiver.h" 9 #include "chrome/browser/android/offline_pages/offline_page_mhtml_archiver.h"
10 #include "components/offline_pages/background/save_page_request.h" 10 #include "components/offline_pages/background/save_page_request.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 } else { 100 } else {
101 // TODO(dougarnett): Consider reflecting some recommendation to retry the 101 // TODO(dougarnett): Consider reflecting some recommendation to retry the
102 // request based on specific save error cases. 102 // request based on specific save error cases.
103 save_status = RequestStatus::SAVE_FAILED; 103 save_status = RequestStatus::SAVE_FAILED;
104 } 104 }
105 completion_callback_.Run(request, save_status); 105 completion_callback_.Run(request, save_status);
106 } 106 }
107 107
108 bool PrerenderingOffliner::LoadAndSave(const SavePageRequest& request, 108 bool PrerenderingOffliner::LoadAndSave(const SavePageRequest& request,
109 const CompletionCallback& callback) { 109 const CompletionCallback& callback) {
110 DCHECK(!pending_request_.get());
111
110 if (pending_request_) { 112 if (pending_request_) {
111 DVLOG(1) << "Already have pending request"; 113 DVLOG(1) << "Already have pending request";
112 return false; 114 return false;
113 } 115 }
114 116
115 if (!GetOrCreateLoader()->CanPrerender()) { 117 if (!GetOrCreateLoader()->CanPrerender()) {
116 DVLOG(1) << "Prerendering not allowed/configured"; 118 DVLOG(1) << "Prerendering not allowed/configured";
117 return false; 119 return false;
118 } 120 }
119 121
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 base::android::APPLICATION_STATE_HAS_RUNNING_ACTIVITIES) { 192 base::android::APPLICATION_STATE_HAS_RUNNING_ACTIVITIES) {
191 DVLOG(1) << "App became active, canceling current offlining request"; 193 DVLOG(1) << "App became active, canceling current offlining request";
192 SavePageRequest* request = pending_request_.get(); 194 SavePageRequest* request = pending_request_.get();
193 Cancel(); 195 Cancel();
194 completion_callback_.Run(*request, 196 completion_callback_.Run(*request,
195 Offliner::RequestStatus::FOREGROUND_CANCELED); 197 Offliner::RequestStatus::FOREGROUND_CANCELED);
196 } 198 }
197 } 199 }
198 200
199 } // namespace offline_pages 201 } // namespace offline_pages
OLDNEW
« no previous file with comments | « no previous file | components/offline_pages/background/offliner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698