| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.h" | 5 #include "components/offline_pages/offline_page_model.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 UMA_HISTOGRAM_COUNTS( | 708 UMA_HISTOGRAM_COUNTS( |
| 709 AddHistogramSuffix( | 709 AddHistogramSuffix( |
| 710 client_id, "OfflinePages.DeletePage.AccessCount").c_str(), | 710 client_id, "OfflinePages.DeletePage.AccessCount").c_str(), |
| 711 iter->second.access_count); | 711 iter->second.access_count); |
| 712 FOR_EACH_OBSERVER( | 712 FOR_EACH_OBSERVER( |
| 713 Observer, observers_, | 713 Observer, observers_, |
| 714 OfflinePageDeleted(iter->second.offline_id, iter->second.client_id)); | 714 OfflinePageDeleted(iter->second.offline_id, iter->second.client_id)); |
| 715 offline_pages_.erase(iter); | 715 offline_pages_.erase(iter); |
| 716 } | 716 } |
| 717 if (offline_ids.size() > 1) { | 717 if (offline_ids.size() > 1) { |
| 718 UMA_HISTOGRAM_COUNTS("OfflinePages.BatchDelete.Count", offline_ids.size()); | 718 UMA_HISTOGRAM_COUNTS("OfflinePages.BatchDelete.Count", |
| 719 static_cast<int32_t>(offline_ids.size())); |
| 719 UMA_HISTOGRAM_MEMORY_KB( | 720 UMA_HISTOGRAM_MEMORY_KB( |
| 720 "OfflinePages.BatchDelete.TotalPageSize", total_size / 1024); | 721 "OfflinePages.BatchDelete.TotalPageSize", total_size / 1024); |
| 721 } | 722 } |
| 722 // Deleting multiple pages always succeeds when it gets to this point. | 723 // Deleting multiple pages always succeeds when it gets to this point. |
| 723 InformDeletePageDone(callback, (success || offline_ids.size() > 1) | 724 InformDeletePageDone(callback, (success || offline_ids.size() > 1) |
| 724 ? DeletePageResult::SUCCESS | 725 ? DeletePageResult::SUCCESS |
| 725 : DeletePageResult::STORE_FAILURE); | 726 : DeletePageResult::STORE_FAILURE); |
| 726 } | 727 } |
| 727 | 728 |
| 728 void OfflinePageModel::InformDeletePageDone(const DeletePageCallback& callback, | 729 void OfflinePageModel::InformDeletePageDone(const DeletePageCallback& callback, |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 void OfflinePageModel::RunWhenLoaded(const base::Closure& task) { | 827 void OfflinePageModel::RunWhenLoaded(const base::Closure& task) { |
| 827 if (!is_loaded_) { | 828 if (!is_loaded_) { |
| 828 delayed_tasks_.push_back(task); | 829 delayed_tasks_.push_back(task); |
| 829 return; | 830 return; |
| 830 } | 831 } |
| 831 | 832 |
| 832 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task); | 833 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task); |
| 833 } | 834 } |
| 834 | 835 |
| 835 } // namespace offline_pages | 836 } // namespace offline_pages |
| OLD | NEW |