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

Side by Side Diff: components/history/core/browser/history_backend.h

Issue 1179953005: Add History.TopHostsVisitsByRank UMA metric. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@is_allowed
Patch Set: Edits per mpearson. Created 5 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
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 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ 5 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_
6 #define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ 6 #define COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/containers/hash_tables.h"
13 #include "base/containers/mru_cache.h" 14 #include "base/containers/mru_cache.h"
14 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
15 #include "base/gtest_prod_util.h" 16 #include "base/gtest_prod_util.h"
16 #include "base/memory/memory_pressure_listener.h" 17 #include "base/memory/memory_pressure_listener.h"
17 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
18 #include "base/observer_list.h" 19 #include "base/observer_list.h"
19 #include "base/single_thread_task_runner.h" 20 #include "base/single_thread_task_runner.h"
20 #include "base/supports_user_data.h" 21 #include "base/supports_user_data.h"
21 #include "base/task/cancelable_task_tracker.h" 22 #include "base/task/cancelable_task_tracker.h"
22 #include "components/favicon_base/favicon_usage_data.h" 23 #include "components/favicon_base/favicon_usage_data.h"
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 // Persists any in-flight state, without actually shutting down the history 195 // Persists any in-flight state, without actually shutting down the history
195 // system. This is intended for use when the application is backgrounded. 196 // system. This is intended for use when the application is backgrounded.
196 void PersistState(); 197 void PersistState();
197 #endif 198 #endif
198 199
199 void ClearCachedDataForContextID(ContextID context_id); 200 void ClearCachedDataForContextID(ContextID context_id);
200 201
201 // Computes the |num_hosts| most-visited hostnames in the past 30 days. See 202 // Computes the |num_hosts| most-visited hostnames in the past 30 days. See
202 // history_service.h for details. Returns an empty list if db_ is not 203 // history_service.h for details. Returns an empty list if db_ is not
203 // initialized. 204 // initialized.
205 //
206 // As a side effect, caches the list of top hosts for the purposes of
207 // generating internal metrics.
204 TopHostsList TopHosts(int num_hosts) const; 208 TopHostsList TopHosts(int num_hosts) const;
205 209
206 // Navigation ---------------------------------------------------------------- 210 // Navigation ----------------------------------------------------------------
207 211
208 // |request.time| must be unique with high probability. 212 // |request.time| must be unique with high probability.
209 void AddPage(const HistoryAddPageArgs& request); 213 void AddPage(const HistoryAddPageArgs& request);
210 virtual void SetPageTitle(const GURL& url, const base::string16& title); 214 virtual void SetPageTitle(const GURL& url, const base::string16& title);
211 void AddPageNoVisitForBookmark(const GURL& url, const base::string16& title); 215 void AddPageNoVisitForBookmark(const GURL& url, const base::string16& title);
212 void UpdateWithPageEndTime(ContextID context_id, 216 void UpdateWithPageEndTime(ContextID context_id,
213 int nav_entry_id, 217 int nav_entry_id,
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 void NotifyURLVisited(ui::PageTransition transition, 724 void NotifyURLVisited(ui::PageTransition transition,
721 const URLRow& row, 725 const URLRow& row,
722 const RedirectList& redirects, 726 const RedirectList& redirects,
723 base::Time visit_time) override; 727 base::Time visit_time) override;
724 void NotifyURLsModified(const URLRows& rows) override; 728 void NotifyURLsModified(const URLRows& rows) override;
725 void NotifyURLsDeleted(bool all_history, 729 void NotifyURLsDeleted(bool all_history,
726 bool expired, 730 bool expired,
727 const URLRows& rows, 731 const URLRows& rows,
728 const std::set<GURL>& favicon_urls) override; 732 const std::set<GURL>& favicon_urls) override;
729 733
734 void RecordTopHostsMetrics(const GURL& url);
735
730 // Deleting all history ------------------------------------------------------ 736 // Deleting all history ------------------------------------------------------
731 737
732 // Deletes all history. This is a special case of deleting that is separated 738 // Deletes all history. This is a special case of deleting that is separated
733 // from our normal dependency-following method for performance reasons. The 739 // from our normal dependency-following method for performance reasons. The
734 // logic lives here instead of ExpireHistoryBackend since it will cause 740 // logic lives here instead of ExpireHistoryBackend since it will cause
735 // re-initialization of some databases (e.g. Thumbnails) that could fail. 741 // re-initialization of some databases (e.g. Thumbnails) that could fail.
736 // When these databases are not valid, our pointers must be null, so we need 742 // When these databases are not valid, our pointers must be null, so we need
737 // to handle this type of operation to keep the pointers in sync. 743 // to handle this type of operation to keep the pointers in sync.
738 void DeleteAllHistory(); 744 void DeleteAllHistory();
739 745
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 // of inheritance from base::SupportsUserData). 831 // of inheritance from base::SupportsUserData).
826 scoped_ptr<HistoryBackendHelper> supports_user_data_helper_; 832 scoped_ptr<HistoryBackendHelper> supports_user_data_helper_;
827 833
828 // Used to manage syncing of the typed urls datatype. This will be null before 834 // Used to manage syncing of the typed urls datatype. This will be null before
829 // Init is called. 835 // Init is called.
830 scoped_ptr<TypedUrlSyncableService> typed_url_syncable_service_; 836 scoped_ptr<TypedUrlSyncableService> typed_url_syncable_service_;
831 837
832 // Listens for the system being under memory pressure. 838 // Listens for the system being under memory pressure.
833 scoped_ptr<base::MemoryPressureListener> memory_pressure_listener_; 839 scoped_ptr<base::MemoryPressureListener> memory_pressure_listener_;
834 840
841 // Map from host to 1-based index in the TopHosts list.
842 mutable base::hash_map<std::string, int> host_ranks_;
sky 2015/06/15 17:28:17 Why the 1s based value?
twifkak 2015/06/16 20:25:24 It seems more intuitive. The statement we want to
sky 2015/06/30 19:17:26 I think it would be better to have 0 based (like n
twifkak 2015/06/30 21:14:43 Done. When you say "increment there", where do you
843
835 // List of observers 844 // List of observers
836 base::ObserverList<HistoryBackendObserver> observers_; 845 base::ObserverList<HistoryBackendObserver> observers_;
837 846
838 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); 847 DISALLOW_COPY_AND_ASSIGN(HistoryBackend);
839 }; 848 };
840 849
841 } // namespace history 850 } // namespace history
842 851
843 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_ 852 #endif // COMPONENTS_HISTORY_CORE_BROWSER_HISTORY_BACKEND_H_
OLDNEW
« no previous file with comments | « no previous file | components/history/core/browser/history_backend.cc » ('j') | components/history/core/browser/history_backend.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698