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

Unified Diff: components/password_manager/core/browser/statistics_table.cc

Issue 1852093002: components/password_manager: scoped_ptr -> unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and revert an accidental .proto change Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: components/password_manager/core/browser/statistics_table.cc
diff --git a/components/password_manager/core/browser/statistics_table.cc b/components/password_manager/core/browser/statistics_table.cc
index dd6ba35029f633e3ae303c7418d67feea6cdb57c..23522a9a8db766e2a801ec9634b63099251caeab 100644
--- a/components/password_manager/core/browser/statistics_table.cc
+++ b/components/password_manager/core/browser/statistics_table.cc
@@ -9,6 +9,7 @@
#include <algorithm>
#include <limits>
+#include "base/memory/ptr_util.h"
#include "sql/connection.h"
#include "sql/statement.h"
@@ -35,13 +36,13 @@ bool operator==(const InteractionsStats& lhs, const InteractionsStats& rhs) {
}
InteractionsStats* FindStatsByUsername(
- const std::vector<scoped_ptr<InteractionsStats>>& stats,
+ const std::vector<std::unique_ptr<InteractionsStats>>& stats,
const base::string16& username) {
- auto it =
- std::find_if(stats.begin(), stats.end(),
- [&username](const scoped_ptr<InteractionsStats>& element) {
- return username == element->username_value;
- });
+ auto it = std::find_if(
+ stats.begin(), stats.end(),
+ [&username](const std::unique_ptr<InteractionsStats>& element) {
+ return username == element->username_value;
+ });
return it == stats.end() ? nullptr : it->get();
}
@@ -105,18 +106,18 @@ bool StatisticsTable::RemoveRow(const GURL& domain) {
return s.Run();
}
-std::vector<scoped_ptr<InteractionsStats>> StatisticsTable::GetRows(
+std::vector<std::unique_ptr<InteractionsStats>> StatisticsTable::GetRows(
const GURL& domain) {
if (!domain.is_valid())
- return std::vector<scoped_ptr<InteractionsStats>>();
+ return std::vector<std::unique_ptr<InteractionsStats>>();
const char query[] =
"SELECT origin_domain, username_value, "
"dismissal_count, update_time FROM stats WHERE origin_domain == ?";
sql::Statement s(db_->GetCachedStatement(SQL_FROM_HERE, query));
s.BindString(0, domain.spec());
- std::vector<scoped_ptr<InteractionsStats>> result;
+ std::vector<std::unique_ptr<InteractionsStats>> result;
while (s.Step()) {
- result.push_back(make_scoped_ptr(new InteractionsStats));
+ result.push_back(base::WrapUnique(new InteractionsStats));
result.back()->origin_domain = GURL(s.ColumnString(COLUMN_ORIGIN_DOMAIN));
result.back()->username_value = s.ColumnString16(COLUMN_USERNAME);
result.back()->dismissal_count = s.ColumnInt(COLUMN_DISMISSALS);

Powered by Google App Engine
This is Rietveld 408576698