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

Unified Diff: content/browser/indexed_db/indexed_db_context_impl.cc

Issue 2233153002: IndexedDB: WrapUnique(new T(args..)) -> MakeUnique<T>(args...) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review feedback Created 4 years, 4 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: content/browser/indexed_db/indexed_db_context_impl.cc
diff --git a/content/browser/indexed_db/indexed_db_context_impl.cc b/content/browser/indexed_db/indexed_db_context_impl.cc
index df01e56da2ec2bc985effc8401bb6f90316b07e7..bfa84ea27ba815222bd431a9d6181f18cc8c7137 100644
--- a/content/browser/indexed_db/indexed_db_context_impl.cc
+++ b/content/browser/indexed_db/indexed_db_context_impl.cc
@@ -166,14 +166,16 @@ base::ListValue* IndexedDBContextImpl::GetAllOriginsDetails() {
std::sort(origins.begin(), origins.end(), HostNameComparator);
- std::unique_ptr<base::ListValue> list(new base::ListValue());
+ std::unique_ptr<base::ListValue> list(base::MakeUnique<base::ListValue>());
for (const auto& origin : origins) {
- std::unique_ptr<base::DictionaryValue> info(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> info(
+ base::MakeUnique<base::DictionaryValue>());
info->SetString("url", origin.Serialize());
info->SetString("size", ui::FormatBytes(GetOriginDiskUsage(origin)));
info->SetDouble("last_modified", GetOriginLastModified(origin).ToJsTime());
if (!is_incognito()) {
- std::unique_ptr<base::ListValue> paths(new base::ListValue());
+ std::unique_ptr<base::ListValue> paths(
+ base::MakeUnique<base::ListValue>());
for (const base::FilePath& path : GetStoragePaths(origin))
paths->AppendString(path.value());
info->Set("paths", paths.release());
@@ -189,14 +191,15 @@ base::ListValue* IndexedDBContextImpl::GetAllOriginsDetails() {
IndexedDBFactory::OriginDBMapIterator>
range = factory_->GetOpenDatabasesForOrigin(origin);
// TODO(jsbell): Sort by name?
- std::unique_ptr<base::ListValue> database_list(new base::ListValue());
+ std::unique_ptr<base::ListValue> database_list(
+ base::MakeUnique<base::ListValue>());
for (IndexedDBFactory::OriginDBMapIterator it = range.first;
it != range.second;
++it) {
const IndexedDBDatabase* db = it->second;
std::unique_ptr<base::DictionaryValue> db_info(
- new base::DictionaryValue());
+ base::MakeUnique<base::DictionaryValue>());
db_info->SetString("name", db->name());
db_info->SetDouble("connection_count", db->ConnectionCount());
@@ -204,12 +207,12 @@ base::ListValue* IndexedDBContextImpl::GetAllOriginsDetails() {
db_info->SetDouble("pending_open_delete", db->PendingOpenDeleteCount());
std::unique_ptr<base::ListValue> transaction_list(
- new base::ListValue());
+ base::MakeUnique<base::ListValue>());
std::vector<const IndexedDBTransaction*> transactions =
db->transaction_coordinator().GetTransactions();
for (const auto* transaction : transactions) {
std::unique_ptr<base::DictionaryValue> transaction_info(
- new base::DictionaryValue());
+ base::MakeUnique<base::DictionaryValue>());
const char* const kModes[] =
{ "readonly", "readwrite", "versionchange" };
@@ -253,7 +256,8 @@ base::ListValue* IndexedDBContextImpl::GetAllOriginsDetails() {
transaction_info->SetDouble(
"tasks_completed", transaction->diagnostics().tasks_completed);
- std::unique_ptr<base::ListValue> scope(new base::ListValue());
+ std::unique_ptr<base::ListValue> scope(
+ base::MakeUnique<base::ListValue>());
for (const auto& id : transaction->scope()) {
const auto& it = db->metadata().object_stores.find(id);
if (it != db->metadata().object_stores.end())
@@ -556,7 +560,8 @@ std::set<Origin>* IndexedDBContextImpl::GetOriginSet() {
if (!origin_set_) {
std::vector<Origin> origins;
GetAllOriginsAndPaths(data_path_, &origins, NULL);
- origin_set_.reset(new std::set<Origin>(origins.begin(), origins.end()));
+ origin_set_ =
+ base::MakeUnique<std::set<Origin>>(origins.begin(), origins.end());
}
return origin_set_.get();
}
« no previous file with comments | « content/browser/indexed_db/indexed_db_cleanup_on_io_error_unittest.cc ('k') | content/browser/indexed_db/indexed_db_cursor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698