| Index: components/previews/core/previews_opt_out_store_sql.cc
|
| diff --git a/components/previews/core/previews_opt_out_store_sql.cc b/components/previews/core/previews_opt_out_store_sql.cc
|
| index d4e6a59eac658be2f87160b297f2300a116749e2..6feb4a16ffa5ed3a4f0d7d8b6cca03d52efae9ee 100644
|
| --- a/components/previews/core/previews_opt_out_store_sql.cc
|
| +++ b/components/previews/core/previews_opt_out_store_sql.cc
|
| @@ -3,20 +3,21 @@
|
| // found in the LICENSE file.
|
|
|
| #include "components/previews/core/previews_opt_out_store_sql.h"
|
|
|
| #include "base/bind.h"
|
| #include "base/bind_helpers.h"
|
| #include "base/files/file_util.h"
|
| #include "base/location.h"
|
| #include "base/logging.h"
|
| #include "base/memory/ptr_util.h"
|
| +#include "base/metrics/histogram_macros.h"
|
| #include "base/sequenced_task_runner.h"
|
| #include "base/threading/thread_task_runner_handle.h"
|
| #include "components/previews/core/previews_black_list.h"
|
| #include "components/previews/core/previews_black_list_item.h"
|
| #include "components/previews/core/previews_experiments.h"
|
| #include "sql/connection.h"
|
| #include "sql/recovery.h"
|
| #include "sql/statement.h"
|
| #include "sql/transaction.h"
|
|
|
| @@ -170,21 +171,22 @@ void LoadBlackListFromDataBase(
|
| DCHECK_LE(black_list_item_map->size(),
|
| params::MaxInMemoryHostsInBlackList());
|
| // Allows the internal logic of PreviewsBlackListItem to determine how to
|
| // evict entries when there are more than
|
| // |StoredHistoryLengthForBlackList()| for the host.
|
| black_list_item->AddPreviewNavigation(
|
| statement.ColumnBool(2),
|
| base::Time::FromInternalValue(statement.ColumnInt64(1)));
|
| }
|
|
|
| - // TODO(ryansturm): Add UMA to log |count|. crbug.com/656739
|
| + UMA_HISTOGRAM_COUNTS_10000("Previews.OptOut.DBRowCount", count);
|
| +
|
| if (count > kMaxRowsInDB) {
|
| // Delete the oldest entries if there are more than |kMaxEntriesInDB|.
|
| // DELETE ... LIMIT -1 OFFSET x means delete all but the first x entries.
|
| const char kSqlDeleteByDBSize[] = "DELETE FROM " PREVIEWS_TABLE_NAME
|
| " WHERE ROWID IN"
|
| " (SELECT ROWID from " PREVIEWS_TABLE_NAME
|
| " ORDER BY time DESC"
|
| " LIMIT -1 OFFSET ?)";
|
|
|
| sql::Statement statement_delete(
|
|
|