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

Unified Diff: base/trace_event/process_memory_dump.cc

Issue 1717283003: tracing: Make ConvertableToTraceFormat move-only scoped_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 10 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: 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 c68d53498b355bb9066c6f3abc3975484002e763..2fbe531d551ab64cd1035c7b0c3ab7aeb9351f98 100644
--- a/base/trace_event/process_memory_dump.cc
+++ b/base/trace_event/process_memory_dump.cc
@@ -191,9 +191,9 @@ MemoryAllocatorDump* ProcessMemoryDump::GetSharedGlobalAllocatorDump(
}
void ProcessMemoryDump::AddHeapDump(const std::string& absolute_name,
- scoped_refptr<TracedValue> heap_dump) {
+ scoped_ptr<TracedValue> heap_dump) {
DCHECK_EQ(0ul, heap_dumps_.count(absolute_name));
- heap_dumps_[absolute_name] = heap_dump;
+ heap_dumps_[absolute_name] = std::move(heap_dump);
}
void ProcessMemoryDump::Clear() {
@@ -227,7 +227,10 @@ void ProcessMemoryDump::TakeAllDumpsFrom(ProcessMemoryDump* other) {
other->allocator_dumps_edges_.end());
other->allocator_dumps_edges_.clear();
- heap_dumps_.insert(other->heap_dumps_.begin(), other->heap_dumps_.end());
+ for (auto& it : other->heap_dumps_) {
+ DCHECK_EQ(0ul, heap_dumps_.count(it.first));
+ heap_dumps_.insert(std::make_pair(it.first, std::move(it.second)));
+ }
other->heap_dumps_.clear();
}

Powered by Google App Engine
This is Rietveld 408576698