refactoring: use std::make_unique<T> (#13245)

This commit is contained in:
Milan Burda 2018-06-18 09:32:55 +02:00 committed by Cheng Zhao
parent 4dec5ec5f9
commit 28fd571d0c
29 changed files with 64 additions and 86 deletions

View file

@ -23,7 +23,7 @@ class Archive : public mate::Wrappable<Archive> {
public:
static v8::Local<v8::Value> Create(v8::Isolate* isolate,
const base::FilePath& path) {
std::unique_ptr<asar::Archive> archive(new asar::Archive(path));
auto archive = std::make_unique<asar::Archive>(path);
if (!archive->Init())
return v8::False(isolate);
return (new Archive(isolate, std::move(archive)))->GetWrapper();

View file

@ -85,7 +85,7 @@ bool AddImageSkiaRep(gfx::ImageSkia* image,
int width,
int height,
double scale_factor) {
std::unique_ptr<SkBitmap> decoded(new SkBitmap());
auto decoded = std::make_unique<SkBitmap>();
// Try PNG first.
if (!gfx::PNGCodec::Decode(data, size, decoded.get())) {

View file

@ -157,8 +157,7 @@ v8::Local<v8::Value> AtomBindings::GetHeapStatistics(v8::Isolate* isolate) {
// static
v8::Local<v8::Value> AtomBindings::GetProcessMemoryInfo(v8::Isolate* isolate) {
std::unique_ptr<base::ProcessMetrics> metrics(
base::ProcessMetrics::CreateCurrentProcessMetrics());
auto metrics = base::ProcessMetrics::CreateCurrentProcessMetrics();
mate::Dictionary dict = mate::Dictionary::CreateEmpty(isolate);
dict.Set("workingSetSize",
@ -224,8 +223,7 @@ v8::Local<v8::Value> AtomBindings::GetCPUUsage(v8::Isolate* isolate) {
// static
v8::Local<v8::Value> AtomBindings::GetIOCounters(v8::Isolate* isolate) {
std::unique_ptr<base::ProcessMetrics> metrics(
base::ProcessMetrics::CreateCurrentProcessMetrics());
auto metrics = base::ProcessMetrics::CreateCurrentProcessMetrics();
base::IoCounters io_counters;
mate::Dictionary dict = mate::Dictionary::CreateEmpty(isolate);