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

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

Issue 2835253002: Treat already existing saved pages as success. (Closed)
Patch Set: Fix build error Created 3 years, 7 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 | chrome/browser/android/offline_pages/background_loader_offliner_unittest.cc » ('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/background_loader_offliner.h" 5 #include "chrome/browser/android/offline_pages/background_loader_offliner.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/sys_info.h" 9 #include "base/sys_info.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 402
403 if (save_state_ == DELETE_AFTER_SAVE) { 403 if (save_state_ == DELETE_AFTER_SAVE) {
404 save_state_ = NONE; 404 save_state_ = NONE;
405 cancel_callback_.Run(request.request_id()); 405 cancel_callback_.Run(request.request_id());
406 return; 406 return;
407 } 407 }
408 408
409 save_state_ = NONE; 409 save_state_ = NONE;
410 410
411 Offliner::RequestStatus save_status; 411 Offliner::RequestStatus save_status;
412 if (save_result == SavePageResult::SUCCESS) { 412 if (save_result == SavePageResult::ALREADY_EXISTS) {
413 save_status = RequestStatus::SAVED;
414 } else if (save_result == SavePageResult::SUCCESS) {
413 if (did_snapshot_on_last_retry) 415 if (did_snapshot_on_last_retry)
414 save_status = RequestStatus::SAVED_ON_LAST_RETRY; 416 save_status = RequestStatus::SAVED_ON_LAST_RETRY;
415 else 417 else
416 save_status = RequestStatus::SAVED; 418 save_status = RequestStatus::SAVED;
417 } else { 419 } else {
418 save_status = RequestStatus::SAVE_FAILED; 420 save_status = RequestStatus::SAVE_FAILED;
419 } 421 }
420 422
421 completion_callback_.Run(request, save_status); 423 completion_callback_.Run(request, save_status);
422 } 424 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 // Given the choice between int and double, we choose to implicitly convert to 474 // Given the choice between int and double, we choose to implicitly convert to
473 // a double since it maintains more precision (we can get a longer time in 475 // a double since it maintains more precision (we can get a longer time in
474 // milliseconds than we can with a 2 bit int, 53 bits vs 32). 476 // milliseconds than we can with a 2 bit int, 53 bits vs 32).
475 double delay = delay_so_far.InMilliseconds(); 477 double delay = delay_so_far.InMilliseconds();
476 signal_data_.SetDouble(signal_name, delay); 478 signal_data_.SetDouble(signal_name, delay);
477 } 479 }
478 480
479 } // namespace offline_pages 481 } // namespace offline_pages
480 482
481 DEFINE_WEB_CONTENTS_USER_DATA_KEY(offline_pages::OfflinerData); 483 DEFINE_WEB_CONTENTS_USER_DATA_KEY(offline_pages::OfflinerData);
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/background_loader_offliner_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698