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

Side by Side Diff: chrome/browser/win/jumplist.cc

Issue 2956553002: Retire JumpList favicon loading related UMA histograms (Closed)
Patch Set: Created 3 years, 6 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 | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "chrome/browser/win/jumplist.h" 5 #include "chrome/browser/win/jumplist.h"
6 6
7 #include "base/base_paths.h" 7 #include "base/base_paths.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 // When FaviconService has one, it will call OnFaviconDataAvailable(). 493 // When FaviconService has one, it will call OnFaviconDataAvailable().
494 favicon::FaviconService* favicon_service = 494 favicon::FaviconService* favicon_service =
495 FaviconServiceFactory::GetForProfile(profile_, 495 FaviconServiceFactory::GetForProfile(profile_,
496 ServiceAccessType::EXPLICIT_ACCESS); 496 ServiceAccessType::EXPLICIT_ACCESS);
497 // base::Unretained is safe since |this| is guaranteed to outlive 497 // base::Unretained is safe since |this| is guaranteed to outlive
498 // cancelable_task_tracker_. 498 // cancelable_task_tracker_.
499 task_id_ = favicon_service->GetFaviconImageForPageURL( 499 task_id_ = favicon_service->GetFaviconImageForPageURL(
500 GURL(icon_urls_.front().first), 500 GURL(icon_urls_.front().first),
501 base::Bind(&JumpList::OnFaviconDataAvailable, base::Unretained(this)), 501 base::Bind(&JumpList::OnFaviconDataAvailable, base::Unretained(this)),
502 &cancelable_task_tracker_); 502 &cancelable_task_tracker_);
503
504 // TODO(chengx): Remove the UMA histogram after fixing http://crbug.com/717236
505 UMA_HISTOGRAM_TIMES("WinJumplist.StartLoadingFaviconDuration",
506 timer.Elapsed());
507 } 503 }
508 504
509 void JumpList::OnFaviconDataAvailable( 505 void JumpList::OnFaviconDataAvailable(
510 const favicon_base::FaviconImageResult& image_result) { 506 const favicon_base::FaviconImageResult& image_result) {
511 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); 507 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
512 508
513 base::ElapsedTimer timer; 509 base::ElapsedTimer timer;
514 510
515 // If there is currently a favicon request in progress, it is now outdated, 511 // If there is currently a favicon request in progress, it is now outdated,
516 // as we have received another, so nullify the handle from the old request. 512 // as we have received another, so nullify the handle from the old request.
517 task_id_ = base::CancelableTaskTracker::kBadTaskId; 513 task_id_ = base::CancelableTaskTracker::kBadTaskId;
518 514
519 // Attach the received data to the ShellLinkItem object. This data will be 515 // Attach the received data to the ShellLinkItem object. This data will be
520 // decoded by the RunUpdateJumpList method. 516 // decoded by the RunUpdateJumpList method.
521 if (!icon_urls_.empty()) { 517 if (!icon_urls_.empty()) {
522 if (!image_result.image.IsEmpty() && icon_urls_.front().second.get()) { 518 if (!image_result.image.IsEmpty() && icon_urls_.front().second.get()) {
523 gfx::ImageSkia image_skia = image_result.image.AsImageSkia(); 519 gfx::ImageSkia image_skia = image_result.image.AsImageSkia();
524 image_skia.EnsureRepsForSupportedScales(); 520 image_skia.EnsureRepsForSupportedScales();
525 std::unique_ptr<gfx::ImageSkia> deep_copy(image_skia.DeepCopy()); 521 std::unique_ptr<gfx::ImageSkia> deep_copy(image_skia.DeepCopy());
526 icon_urls_.front().second->set_icon_image(*deep_copy); 522 icon_urls_.front().second->set_icon_image(*deep_copy);
527 } 523 }
528 icon_urls_.pop_front(); 524 icon_urls_.pop_front();
529 } 525 }
530 526
531 // TODO(chengx): Remove the UMA histogram after fixing http://crbug.com/717236
532 UMA_HISTOGRAM_TIMES("WinJumplist.OnFaviconDataAvailableDuration",
533 timer.Elapsed());
534
535 // Check whether we need to load more favicons. 527 // Check whether we need to load more favicons.
536 StartLoadingFavicon(); 528 StartLoadingFavicon();
537 } 529 }
538 530
539 void JumpList::PostRunUpdate() { 531 void JumpList::PostRunUpdate() {
540 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); 532 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
541 533
542 TRACE_EVENT0("browser", "JumpList::PostRunUpdate"); 534 TRACE_EVENT0("browser", "JumpList::PostRunUpdate");
543 535
544 update_in_progress_ = true; 536 update_in_progress_ = true;
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 URLIconCache* icon_cache) { 814 URLIconCache* icon_cache) {
823 // Put all cached icon file paths into a set. 815 // Put all cached icon file paths into a set.
824 base::flat_set<base::FilePath> cached_files; 816 base::flat_set<base::FilePath> cached_files;
825 cached_files.reserve(icon_cache->size()); 817 cached_files.reserve(icon_cache->size());
826 818
827 for (const auto& url_path_pair : *icon_cache) 819 for (const auto& url_path_pair : *icon_cache)
828 cached_files.insert(url_path_pair.second); 820 cached_files.insert(url_path_pair.second);
829 821
830 DeleteNonCachedFiles(icon_dir, cached_files); 822 DeleteNonCachedFiles(icon_dir, cached_files);
831 } 823 }
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698