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

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

Issue 2564163002: [Offline Pages] Remove load state from public OfflinePageModel API. (Closed)
Patch Set: Fix broken tests. Created 4 years 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/core/offline_page_model_impl.h" 5 #include "components/offline_pages/core/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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 } 658 }
659 659
660 OfflinePageMetadataStore* OfflinePageModelImpl::GetStoreForTesting() { 660 OfflinePageMetadataStore* OfflinePageModelImpl::GetStoreForTesting() {
661 return store_.get(); 661 return store_.get();
662 } 662 }
663 663
664 OfflinePageStorageManager* OfflinePageModelImpl::GetStorageManager() { 664 OfflinePageStorageManager* OfflinePageModelImpl::GetStorageManager() {
665 return storage_manager_.get(); 665 return storage_manager_.get();
666 } 666 }
667 667
668 bool OfflinePageModelImpl::is_loaded() const {
669 return is_loaded_;
670 }
671
672 OfflineEventLogger* OfflinePageModelImpl::GetLogger() { 668 OfflineEventLogger* OfflinePageModelImpl::GetLogger() {
673 return &offline_event_logger_; 669 return &offline_event_logger_;
674 } 670 }
675 671
676 void OfflinePageModelImpl::OnCreateArchiveDone( 672 void OfflinePageModelImpl::OnCreateArchiveDone(
677 const SavePageParams& save_page_params, 673 const SavePageParams& save_page_params,
678 int64_t offline_id, 674 int64_t offline_id,
679 const base::Time& start_time, 675 const base::Time& start_time,
680 const SavePageCallback& callback, 676 const SavePageCallback& callback,
681 OfflinePageArchiver* archiver, 677 OfflinePageArchiver* archiver,
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 // Ensure necessary cleanup operations are started. 820 // Ensure necessary cleanup operations are started.
825 CheckMetadataConsistency(); 821 CheckMetadataConsistency();
826 } 822 }
827 823
828 void OfflinePageModelImpl::FinalizeModelLoad() { 824 void OfflinePageModelImpl::FinalizeModelLoad() {
829 is_loaded_ = true; 825 is_loaded_ = true;
830 826
831 // All actions below are meant to be taken regardless of successful load of 827 // All actions below are meant to be taken regardless of successful load of
832 // the store. 828 // the store.
833 829
834 // Inform observers the load is done.
835 for (Observer& observer : observers_)
836 observer.OfflinePageModelLoaded(this);
837
838 // Run all the delayed tasks. 830 // Run all the delayed tasks.
839 for (const auto& delayed_task : delayed_tasks_) 831 for (const auto& delayed_task : delayed_tasks_)
840 delayed_task.Run(); 832 delayed_task.Run();
841 delayed_tasks_.clear(); 833 delayed_tasks_.clear();
842 834
843 // Clear storage. 835 // Clear storage.
844 PostClearStorageIfNeededTask(true /* delayed */); 836 PostClearStorageIfNeededTask(true /* delayed */);
845 } 837 }
846 838
847 void OfflinePageModelImpl::InformSavePageDone(const SavePageCallback& callback, 839 void OfflinePageModelImpl::InformSavePageDone(const SavePageCallback& callback,
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
1085 } 1077 }
1086 1078
1087 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task); 1079 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task);
1088 } 1080 }
1089 1081
1090 base::Time OfflinePageModelImpl::GetCurrentTime() const { 1082 base::Time OfflinePageModelImpl::GetCurrentTime() const {
1091 return testing_clock_ ? testing_clock_->Now() : base::Time::Now(); 1083 return testing_clock_ ? testing_clock_->Now() : base::Time::Now();
1092 } 1084 }
1093 1085
1094 } // namespace offline_pages 1086 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698