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

Unified Diff: base/trace_event/process_memory_dump.cc

Issue 1852433005: Convert //base to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after r384946 Created 4 years, 8 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
« no previous file with comments | « base/trace_event/process_memory_dump.h ('k') | base/trace_event/process_memory_dump_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/process_memory_dump.cc
diff --git a/base/trace_event/process_memory_dump.cc b/base/trace_event/process_memory_dump.cc
index 1642e5a341bef3bb717500b2ead1698cc45380d8..56fda8088b8b56a09015dadbea06872ac791326c 100644
--- a/base/trace_event/process_memory_dump.cc
+++ b/base/trace_event/process_memory_dump.cc
@@ -5,8 +5,10 @@
#include "base/trace_event/process_memory_dump.h"
#include <errno.h>
+
#include <vector>
+#include "base/memory/ptr_util.h"
#include "base/process/process_metrics.h"
#include "base/trace_event/process_memory_totals.h"
#include "base/trace_event/trace_event_argument.h"
@@ -82,12 +84,12 @@ size_t ProcessMemoryDump::CountResidentBytes(void* start_address,
size_t max_vec_size =
GetSystemPageCount(std::min(mapped_size, kMaxChunkSize), page_size);
#if defined(OS_MACOSX) || defined(OS_IOS)
- scoped_ptr<char[]> vec(new char[max_vec_size]);
+ std::unique_ptr<char[]> vec(new char[max_vec_size]);
#elif defined(OS_WIN)
- scoped_ptr<PSAPI_WORKING_SET_EX_INFORMATION[]> vec(
+ std::unique_ptr<PSAPI_WORKING_SET_EX_INFORMATION[]> vec(
new PSAPI_WORKING_SET_EX_INFORMATION[max_vec_size]);
#elif defined(OS_POSIX)
- scoped_ptr<unsigned char[]> vec(new unsigned char[max_vec_size]);
+ std::unique_ptr<unsigned char[]> vec(new unsigned char[max_vec_size]);
#endif
while (offset < mapped_size) {
@@ -154,18 +156,18 @@ ProcessMemoryDump::~ProcessMemoryDump() {}
MemoryAllocatorDump* ProcessMemoryDump::CreateAllocatorDump(
const std::string& absolute_name) {
return AddAllocatorDumpInternal(
- make_scoped_ptr(new MemoryAllocatorDump(absolute_name, this)));
+ WrapUnique(new MemoryAllocatorDump(absolute_name, this)));
}
MemoryAllocatorDump* ProcessMemoryDump::CreateAllocatorDump(
const std::string& absolute_name,
const MemoryAllocatorDumpGuid& guid) {
return AddAllocatorDumpInternal(
- make_scoped_ptr(new MemoryAllocatorDump(absolute_name, this, guid)));
+ WrapUnique(new MemoryAllocatorDump(absolute_name, this, guid)));
}
MemoryAllocatorDump* ProcessMemoryDump::AddAllocatorDumpInternal(
- scoped_ptr<MemoryAllocatorDump> mad) {
+ std::unique_ptr<MemoryAllocatorDump> mad) {
auto insertion_result = allocator_dumps_.insert(
std::make_pair(mad->absolute_name(), std::move(mad)));
DCHECK(insertion_result.second) << "Duplicate name: " << mad->absolute_name();
@@ -214,7 +216,7 @@ MemoryAllocatorDump* ProcessMemoryDump::GetSharedGlobalAllocatorDump(
}
void ProcessMemoryDump::AddHeapDump(const std::string& absolute_name,
- scoped_ptr<TracedValue> heap_dump) {
+ std::unique_ptr<TracedValue> heap_dump) {
DCHECK_EQ(0ul, heap_dumps_.count(absolute_name));
heap_dumps_[absolute_name] = std::move(heap_dump);
}
« no previous file with comments | « base/trace_event/process_memory_dump.h ('k') | base/trace_event/process_memory_dump_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698