Chromium Code Reviews| Index: components/history/core/browser/history_backend.h |
| diff --git a/components/history/core/browser/history_backend.h b/components/history/core/browser/history_backend.h |
| index 76d4b50b0b0c64248453f8b46bd3a76228dcc150..47985323c3c37ecb266ed71d0926abfdf3204d5e 100644 |
| --- a/components/history/core/browser/history_backend.h |
| +++ b/components/history/core/browser/history_backend.h |
| @@ -10,6 +10,7 @@ |
| #include <utility> |
| #include <vector> |
| +#include "base/containers/hash_tables.h" |
| #include "base/containers/mru_cache.h" |
| #include "base/files/file_path.h" |
| #include "base/gtest_prod_util.h" |
| @@ -201,6 +202,9 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>, |
| // Computes the |num_hosts| most-visited hostnames in the past 30 days. See |
| // history_service.h for details. Returns an empty list if db_ is not |
| // initialized. |
| + // |
| + // As a side effect, caches the list of top hosts for the purposes of |
| + // generating internal metrics. |
| TopHostsList TopHosts(int num_hosts) const; |
| // Navigation ---------------------------------------------------------------- |
| @@ -727,6 +731,8 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>, |
| const URLRows& rows, |
| const std::set<GURL>& favicon_urls) override; |
| + void RecordTopHostsMetrics(const GURL& url); |
| + |
| // Deleting all history ------------------------------------------------------ |
| // Deletes all history. This is a special case of deleting that is separated |
| @@ -832,6 +838,9 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>, |
| // Listens for the system being under memory pressure. |
| scoped_ptr<base::MemoryPressureListener> memory_pressure_listener_; |
| + // Map from host to 1-based index in the TopHosts list. |
| + 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
|
| + |
| // List of observers |
| base::ObserverList<HistoryBackendObserver> observers_; |