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

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

Issue 2345133002: Offline Pages: Removes the metadata consistency check from the model API. (Closed)
Patch Set: Rebase Created 4 years, 3 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/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 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 if (id_page_pair.second.url == online_url && 648 if (id_page_pair.second.url == online_url &&
649 !id_page_pair.second.IsExpired()) { 649 !id_page_pair.second.IsExpired()) {
650 if (!result || id_page_pair.second.creation_time > result->creation_time) 650 if (!result || id_page_pair.second.creation_time > result->creation_time)
651 result = &(id_page_pair.second); 651 result = &(id_page_pair.second);
652 } 652 }
653 } 653 }
654 return result; 654 return result;
655 } 655 }
656 656
657 void OfflinePageModelImpl::CheckMetadataConsistency() { 657 void OfflinePageModelImpl::CheckMetadataConsistency() {
658 RunWhenLoaded( 658 DCHECK(is_loaded_);
659 base::Bind(&OfflinePageModelImpl::CheckMetadataConsistencyWhenLoadDone,
660 weak_ptr_factory_.GetWeakPtr()));
661 }
662
663 void OfflinePageModelImpl::CheckMetadataConsistencyWhenLoadDone() {
664 archive_manager_->GetAllArchives( 659 archive_manager_->GetAllArchives(
665 base::Bind(&OfflinePageModelImpl::CheckMetadataConsistencyForArchivePaths, 660 base::Bind(&OfflinePageModelImpl::CheckMetadataConsistencyForArchivePaths,
666 weak_ptr_factory_.GetWeakPtr())); 661 weak_ptr_factory_.GetWeakPtr()));
667 } 662 }
668 663
669 void OfflinePageModelImpl::ExpirePages( 664 void OfflinePageModelImpl::ExpirePages(
670 const std::vector<int64_t>& offline_ids, 665 const std::vector<int64_t>& offline_ids,
671 const base::Time& expiration_time, 666 const base::Time& expiration_time,
672 const base::Callback<void(bool)>& callback) { 667 const base::Callback<void(bool)>& callback) {
673 std::vector<base::FilePath> paths_to_delete; 668 std::vector<base::FilePath> paths_to_delete;
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
1144 } 1139 }
1145 1140
1146 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task); 1141 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task);
1147 } 1142 }
1148 1143
1149 base::Time OfflinePageModelImpl::GetCurrentTime() const { 1144 base::Time OfflinePageModelImpl::GetCurrentTime() const {
1150 return testing_clock_ ? testing_clock_->Now() : base::Time::Now(); 1145 return testing_clock_ ? testing_clock_->Now() : base::Time::Now();
1151 } 1146 }
1152 1147
1153 } // namespace offline_pages 1148 } // namespace offline_pages
OLDNEW
« no previous file with comments | « components/offline_pages/offline_page_model_impl.h ('k') | components/offline_pages/offline_page_model_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698