| 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..14332bded3cd5566cfb4f9f4938145948a8d793a 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 ----------------------------------------------------------------
|
| @@ -518,6 +522,7 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>,
|
| FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, TopHosts_OnlyLast30Days);
|
| FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, TopHosts_MaxNumHosts);
|
| FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, TopHosts_IgnoreUnusualURLs);
|
| + FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, RecordTopHostsMetrics);
|
| FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, UpdateVisitDuration);
|
| FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, ExpireHistoryForTimes);
|
| FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, DeleteFTSIndexDatabases);
|
| @@ -727,6 +732,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 +839,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_;
|
| +
|
| // List of observers
|
| base::ObserverList<HistoryBackendObserver> observers_;
|
|
|
|
|