New issue
Advanced search Search tips

Issue 676785 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Nov 2017
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Replace raw |new| with |base::MakeUnique| where appropriate

Project Member Reported by jdoerrie@chromium.org, Dec 23 2016

Issue description

auto my_ptr = base::MakeUnique<T>() is preferable over std::unique_ptr<T> my_ptr(new T) because it provides exception safety and does not require to repeat the typename (base::MakeUnique is equivalent to std::make_unique which is part of C++14).

Even though this change is beneficial to all code, we limit the scope to a single file, to avoid polluting the git history.

References:
 - Scott Meyers - Effective Modern C++ - Item 21: Prefer std::make_unique [...] to direct use of new.
 - https://herbsutter.com/gotw/_102/
 - http://en.cppreference.com/w/cpp/memory/unique_ptr/make_unique
 
Summary: Replace raw |new| with |base::MakeUnique| where appropriate (was: Replace raw |new| with |base::MakeUnique|)
Project Member

Comment 2 by bugdroid1@chromium.org, Dec 23 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/3402daf429bf0513a80c06f082d5668b6ec43235

commit 3402daf429bf0513a80c06f082d5668b6ec43235
Author: jdoerrie <jdoerrie@chromium.org>
Date: Fri Dec 23 11:01:22 2016

Remove usages of raw new

This change introduces a cleanup mentioned in http://crrev.com/2598003002.
Raw usages of new are replaced by base::MakeUnique.

BUG= 676785 
R=vabr@chromium.org

Review-Url: https://codereview.chromium.org/2605483002
Cr-Commit-Position: refs/heads/master@{#440616}

[modify] https://crrev.com/3402daf429bf0513a80c06f082d5668b6ec43235/chrome/browser/password_manager/credential_manager_browsertest.cc

Status: Fixed (was: Untriaged)

Sign in to add a comment