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

Side by Side Diff: components/offline_pages/offline_page_model_impl.cc

Issue 2420543004: Improve the page download: (Closed)
Patch Set: Created 4 years, 2 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 | « components/offline_pages/offline_page_model_impl.h ('k') | 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/offline_page_model_impl.h" 5 #include "components/offline_pages/offline_page_model_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 } 350 }
351 351
352 // The web contents is not available if archiver is not created and passed. 352 // The web contents is not available if archiver is not created and passed.
353 if (!archiver.get()) { 353 if (!archiver.get()) {
354 InformSavePageDone(callback, SavePageResult::CONTENT_UNAVAILABLE, client_id, 354 InformSavePageDone(callback, SavePageResult::CONTENT_UNAVAILABLE, client_id,
355 kInvalidOfflineId); 355 kInvalidOfflineId);
356 return; 356 return;
357 } 357 }
358 358
359 // If we already have an offline id, use it. If not, generate one. 359 // If we already have an offline id, use it. If not, generate one.
360 if (proposed_offline_id == 0l) 360 if (proposed_offline_id == kInvalidOfflineId)
361 proposed_offline_id = GenerateOfflineId(); 361 proposed_offline_id = GenerateOfflineId();
362 362
363 archiver->CreateArchive( 363 archiver->CreateArchive(
364 archives_dir_, proposed_offline_id, 364 archives_dir_, proposed_offline_id,
365 base::Bind(&OfflinePageModelImpl::OnCreateArchiveDone, 365 base::Bind(&OfflinePageModelImpl::OnCreateArchiveDone,
366 weak_ptr_factory_.GetWeakPtr(), url, proposed_offline_id, 366 weak_ptr_factory_.GetWeakPtr(), url, proposed_offline_id,
367 client_id, GetCurrentTime(), callback)); 367 client_id, GetCurrentTime(), callback));
368 pending_archivers_.push_back(std::move(archiver)); 368 pending_archivers_.push_back(std::move(archiver));
369 } 369 }
370 370
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 } 1048 }
1049 1049
1050 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task); 1050 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task);
1051 } 1051 }
1052 1052
1053 base::Time OfflinePageModelImpl::GetCurrentTime() const { 1053 base::Time OfflinePageModelImpl::GetCurrentTime() const {
1054 return testing_clock_ ? testing_clock_->Now() : base::Time::Now(); 1054 return testing_clock_ ? testing_clock_->Now() : base::Time::Now();
1055 } 1055 }
1056 1056
1057 } // namespace offline_pages 1057 } // namespace offline_pages
OLDNEW
« no previous file with comments | « components/offline_pages/offline_page_model_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698