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

Side by Side Diff: content/browser/net/sqlite_persistent_cookie_store.cc

Issue 1131413004: Add histograms for deletion of session cookies on startup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "content/browser/net/sqlite_persistent_cookie_store.h" 5 #include "content/browser/net/sqlite_persistent_cookie_store.h"
6 6
7 #include <list> 7 #include <list>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 50); 694 50);
695 695
696 UMA_HISTOGRAM_CUSTOM_TIMES( 696 UMA_HISTOGRAM_CUSTOM_TIMES(
697 "Cookie.TimeInitializeDomainMap", 697 "Cookie.TimeInitializeDomainMap",
698 base::Time::Now() - start, 698 base::Time::Now() - start,
699 base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(1), 699 base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(1),
700 50); 700 50);
701 701
702 initialized_ = true; 702 initialized_ = true;
703 703
704 if (!restore_old_session_cookies_) 704 int deleted_cookies_count = 0;
erikwright (departed) 2015/05/12 14:30:43 Assuming you agree with my comment below, move cou
erikchen 2015/05/12 18:50:34 I removed the variables elapsed_time and deleted_c
705 base::TimeDelta elapsed_time;
706 if (!restore_old_session_cookies_) {
707 base::Time start_time = base::Time::Now();
705 DeleteSessionCookiesOnStartup(); 708 DeleteSessionCookiesOnStartup();
709
710 elapsed_time = base::Time::Now() - start_time;
711 UMA_HISTOGRAM_TIMES("Cookie.Startup.TimeSpentDeletingCookies",
712 elapsed_time);
713
714 deleted_cookies_count = db_->GetLastChangeCount();
715 UMA_HISTOGRAM_COUNTS("Cookie.Startup.NumberOfCookiesDeleted",
716 deleted_cookies_count);
717 }
718
719 if (deleted_cookies_count > 0) {
erikwright (departed) 2015/05/12 14:30:43 I'm not convinced that this is useful. In any case
erikchen 2015/05/12 18:50:34 I wasn't aware that this was easy to do with dreme
720 base::TimeDelta avg_deletion_time = elapsed_time / deleted_cookies_count;
721 UMA_HISTOGRAM_TIMES("Cookie.Startup.AverageTimeSpentDeletingOneCookie",
722 avg_deletion_time);
723 }
724
706 return true; 725 return true;
707 } 726 }
708 727
709 void SQLitePersistentCookieStore::Backend::ChainLoadCookies( 728 void SQLitePersistentCookieStore::Backend::ChainLoadCookies(
710 const LoadedCallback& loaded_callback) { 729 const LoadedCallback& loaded_callback) {
711 DCHECK(background_task_runner_->RunsTasksOnCurrentThread()); 730 DCHECK(background_task_runner_->RunsTasksOnCurrentThread());
712 IncrementTimeDelta increment(&cookie_load_duration_); 731 IncrementTimeDelta increment(&cookie_load_duration_);
713 732
714 bool load_success = true; 733 bool load_success = true;
715 734
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
1450 (config.session_cookie_mode == 1469 (config.session_cookie_mode ==
1451 CookieStoreConfig::RESTORED_SESSION_COOKIES)) { 1470 CookieStoreConfig::RESTORED_SESSION_COOKIES)) {
1452 cookie_monster->SetPersistSessionCookies(true); 1471 cookie_monster->SetPersistSessionCookies(true);
1453 } 1472 }
1454 } 1473 }
1455 1474
1456 return cookie_monster; 1475 return cookie_monster;
1457 } 1476 }
1458 1477
1459 } // namespace content 1478 } // namespace content
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