| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/trace_event/process_memory_dump.h" | 5 #include "base/trace_event/process_memory_dump.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/memory/aligned_memory.h" | 9 #include "base/memory/aligned_memory.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 ASSERT_EQ(MemoryAllocatorDump::Flags::WEAK, shared_mad2->flags()); | 83 ASSERT_EQ(MemoryAllocatorDump::Flags::WEAK, shared_mad2->flags()); |
| 84 | 84 |
| 85 traced_value.reset(new TracedValue); | 85 traced_value.reset(new TracedValue); |
| 86 pmd1->AsValueInto(traced_value.get()); | 86 pmd1->AsValueInto(traced_value.get()); |
| 87 | 87 |
| 88 pmd1.reset(); | 88 pmd1.reset(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 TEST(ProcessMemoryDumpTest, TakeAllDumpsFrom) { | 91 TEST(ProcessMemoryDumpTest, TakeAllDumpsFrom) { |
| 92 std::unique_ptr<TracedValue> traced_value(new TracedValue); | 92 std::unique_ptr<TracedValue> traced_value(new TracedValue); |
| 93 hash_map<AllocationContext, AllocationMetrics> metrics_by_context; | 93 std::unordered_map<AllocationContext, AllocationMetrics> metrics_by_context; |
| 94 metrics_by_context[AllocationContext()] = { 1, 1 }; | 94 metrics_by_context[AllocationContext()] = { 1, 1 }; |
| 95 TraceEventMemoryOverhead overhead; | 95 TraceEventMemoryOverhead overhead; |
| 96 | 96 |
| 97 scoped_refptr<MemoryDumpSessionState> session_state = | 97 scoped_refptr<MemoryDumpSessionState> session_state = |
| 98 new MemoryDumpSessionState; | 98 new MemoryDumpSessionState; |
| 99 session_state->SetStackFrameDeduplicator( | 99 session_state->SetStackFrameDeduplicator( |
| 100 WrapUnique(new StackFrameDeduplicator)); | 100 WrapUnique(new StackFrameDeduplicator)); |
| 101 session_state->SetTypeNameDeduplicator( | 101 session_state->SetTypeNameDeduplicator( |
| 102 WrapUnique(new TypeNameDeduplicator)); | 102 WrapUnique(new TypeNameDeduplicator)); |
| 103 std::unique_ptr<ProcessMemoryDump> pmd1( | 103 std::unique_ptr<ProcessMemoryDump> pmd1( |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 static_cast<char*>(base::AlignedAlloc(kVeryLargeMemorySize, page_size))); | 297 static_cast<char*>(base::AlignedAlloc(kVeryLargeMemorySize, page_size))); |
| 298 memset(memory2.get(), 0, kVeryLargeMemorySize); | 298 memset(memory2.get(), 0, kVeryLargeMemorySize); |
| 299 size_t res2 = ProcessMemoryDump::CountResidentBytes(memory2.get(), | 299 size_t res2 = ProcessMemoryDump::CountResidentBytes(memory2.get(), |
| 300 kVeryLargeMemorySize); | 300 kVeryLargeMemorySize); |
| 301 ASSERT_EQ(res2, kVeryLargeMemorySize); | 301 ASSERT_EQ(res2, kVeryLargeMemorySize); |
| 302 } | 302 } |
| 303 #endif // defined(COUNT_RESIDENT_BYTES_SUPPORTED) | 303 #endif // defined(COUNT_RESIDENT_BYTES_SUPPORTED) |
| 304 | 304 |
| 305 } // namespace trace_event | 305 } // namespace trace_event |
| 306 } // namespace base | 306 } // namespace base |
| OLD | NEW |