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

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

Issue 1989733002: Change UMA OfflinePages.PageSize to have better resolution in a typical range of offline page sizes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merges! Created 4 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698