| 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 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 const OfflinePageItem& offline_page, | 564 const OfflinePageItem& offline_page, |
| 565 bool success) { | 565 bool success) { |
| 566 SavePageResult result; | 566 SavePageResult result; |
| 567 if (success) { | 567 if (success) { |
| 568 offline_pages_[offline_page.offline_id] = offline_page; | 568 offline_pages_[offline_page.offline_id] = offline_page; |
| 569 result = SavePageResult::SUCCESS; | 569 result = SavePageResult::SUCCESS; |
| 570 UMA_HISTOGRAM_TIMES( | 570 UMA_HISTOGRAM_TIMES( |
| 571 AddHistogramSuffix( | 571 AddHistogramSuffix( |
| 572 offline_page.client_id, "OfflinePages.SavePageTime").c_str(), | 572 offline_page.client_id, "OfflinePages.SavePageTime").c_str(), |
| 573 base::Time::Now() - offline_page.creation_time); | 573 base::Time::Now() - offline_page.creation_time); |
| 574 UMA_HISTOGRAM_MEMORY_KB( | 574 // 50 buckets capped between 1Kb and 10Mb. |
| 575 AddHistogramSuffix( | 575 UMA_HISTOGRAM_COUNTS_10000(AddHistogramSuffix( |
| 576 offline_page.client_id, "OfflinePages.PageSize").c_str(), | 576 offline_page.client_id, "OfflinePages.PageSize").c_str(), |
| 577 offline_page.file_size / 1024); | 577 offline_page.file_size / 1024); |
| 578 } else { | 578 } else { |
| 579 result = SavePageResult::STORE_FAILURE; | 579 result = SavePageResult::STORE_FAILURE; |
| 580 } | 580 } |
| 581 InformSavePageDone(callback, result, offline_page.client_id, | 581 InformSavePageDone(callback, result, offline_page.client_id, |
| 582 offline_page.offline_id); | 582 offline_page.offline_id); |
| 583 DeletePendingArchiver(archiver); | 583 DeletePendingArchiver(archiver); |
| 584 | 584 |
| 585 FOR_EACH_OBSERVER(Observer, observers_, OfflinePageModelChanged(this)); | 585 FOR_EACH_OBSERVER(Observer, observers_, OfflinePageModelChanged(this)); |
| 586 } | 586 } |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 void OfflinePageModel::RunWhenLoaded(const base::Closure& task) { | 826 void OfflinePageModel::RunWhenLoaded(const base::Closure& task) { |
| 827 if (!is_loaded_) { | 827 if (!is_loaded_) { |
| 828 delayed_tasks_.push_back(task); | 828 delayed_tasks_.push_back(task); |
| 829 return; | 829 return; |
| 830 } | 830 } |
| 831 | 831 |
| 832 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task); | 832 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task); |
| 833 } | 833 } |
| 834 | 834 |
| 835 } // namespace offline_pages | 835 } // namespace offline_pages |
| OLD | NEW |