| OLD | NEW |
| 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 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 for (const auto& item : pages_to_delete) | 897 for (const auto& item : pages_to_delete) |
| 898 page_ids_to_delete.push_back(item.offline_id); | 898 page_ids_to_delete.push_back(item.offline_id); |
| 899 DeletePagesByOfflineId( | 899 DeletePagesByOfflineId( |
| 900 page_ids_to_delete, | 900 page_ids_to_delete, |
| 901 base::Bind(&OfflinePageModelImpl::OnDeleteOldPagesWithSameURL, | 901 base::Bind(&OfflinePageModelImpl::OnDeleteOldPagesWithSameURL, |
| 902 weak_ptr_factory_.GetWeakPtr())); | 902 weak_ptr_factory_.GetWeakPtr())); |
| 903 } | 903 } |
| 904 | 904 |
| 905 void OfflinePageModelImpl::OnDeleteOldPagesWithSameURL( | 905 void OfflinePageModelImpl::OnDeleteOldPagesWithSameURL( |
| 906 DeletePageResult result) { | 906 DeletePageResult result) { |
| 907 // TODO(romax) Add UMAs for failure cases. | |
| 908 PostClearStorageIfNeededTask(false /* delayed */); | 907 PostClearStorageIfNeededTask(false /* delayed */); |
| 909 } | 908 } |
| 910 | 909 |
| 911 void OfflinePageModelImpl::DeletePendingArchiver( | 910 void OfflinePageModelImpl::DeletePendingArchiver( |
| 912 OfflinePageArchiver* archiver) { | 911 OfflinePageArchiver* archiver) { |
| 913 pending_archivers_.erase( | 912 pending_archivers_.erase( |
| 914 std::find_if(pending_archivers_.begin(), pending_archivers_.end(), | 913 std::find_if(pending_archivers_.begin(), pending_archivers_.end(), |
| 915 [archiver](const std::unique_ptr<OfflinePageArchiver>& a) { | 914 [archiver](const std::unique_ptr<OfflinePageArchiver>& a) { |
| 916 return a.get() == archiver; | 915 return a.get() == archiver; |
| 917 })); | 916 })); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1088 } | 1087 } |
| 1089 | 1088 |
| 1090 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task); | 1089 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task); |
| 1091 } | 1090 } |
| 1092 | 1091 |
| 1093 base::Time OfflinePageModelImpl::GetCurrentTime() const { | 1092 base::Time OfflinePageModelImpl::GetCurrentTime() const { |
| 1094 return testing_clock_ ? testing_clock_->Now() : base::Time::Now(); | 1093 return testing_clock_ ? testing_clock_->Now() : base::Time::Now(); |
| 1095 } | 1094 } |
| 1096 | 1095 |
| 1097 } // namespace offline_pages | 1096 } // namespace offline_pages |
| OLD | NEW |