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 "platform/web_process_memory_dump_impl.h" | 5 #include "platform/web_process_memory_dump_impl.h" |
6 | 6 |
7 #include "base/memory/discardable_memory.h" | |
8 #include "base/test/test_discardable_memory_allocator.h" | |
7 #include "base/trace_event/memory_allocator_dump.h" | 9 #include "base/trace_event/memory_allocator_dump.h" |
8 #include "base/trace_event/process_memory_dump.h" | 10 #include "base/trace_event/process_memory_dump.h" |
9 #include "base/trace_event/trace_event_argument.h" | 11 #include "base/trace_event/trace_event_argument.h" |
10 #include "base/values.h" | 12 #include "base/values.h" |
11 #include "platform/web_memory_allocator_dump_impl.h" | 13 #include "platform/web_memory_allocator_dump_impl.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "wtf/OwnPtr.h" | 15 #include "wtf/OwnPtr.h" |
14 | 16 |
15 namespace blink { | 17 namespace blink { |
16 | 18 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
112 | 114 |
113 // Check that AddOwnershipEdge is propagated correctly. | 115 // Check that AddOwnershipEdge is propagated correctly. |
114 auto wmad4 = wpmd1->createMemoryAllocatorDump("1/4"); | 116 auto wmad4 = wpmd1->createMemoryAllocatorDump("1/4"); |
115 wpmd1->addOwnershipEdge(wmad4->guid(), guid); | 117 wpmd1->addOwnershipEdge(wmad4->guid(), guid); |
116 auto allocator_dumps_edges = | 118 auto allocator_dumps_edges = |
117 wpmd1->process_memory_dump()->allocator_dumps_edges(); | 119 wpmd1->process_memory_dump()->allocator_dumps_edges(); |
118 ASSERT_EQ(1u, allocator_dumps_edges.size()); | 120 ASSERT_EQ(1u, allocator_dumps_edges.size()); |
119 ASSERT_EQ(wmad4->guid(), allocator_dumps_edges[0].source.ToUint64()); | 121 ASSERT_EQ(wmad4->guid(), allocator_dumps_edges[0].source.ToUint64()); |
120 ASSERT_EQ(guid, allocator_dumps_edges[0].target.ToUint64()); | 122 ASSERT_EQ(guid, allocator_dumps_edges[0].target.ToUint64()); |
121 | 123 |
124 // Check that createDumpAdapterForSkia() works. | |
125 auto skia_trace_memory_dump = wpmd1->createDumpAdapterForSkia("1/skia"); | |
126 ASSERT_NE(nullptr, skia_trace_memory_dump); | |
Primiano Tucci (use gerrit)
2016/02/29 16:15:28
IIRC the ASSERT_NE incantation fails to expand pro
hajimehoshi
2016/03/01 10:06:23
Done. (Used ASSERT_TRUE)
| |
127 | |
128 // Check that createDiscardableMemoryAllocatorDump() works. | |
129 base::TestDiscardableMemoryAllocator discardable_memory_allocator; | |
130 auto discardable_memory = | |
131 discardable_memory_allocator.AllocateLockedDiscardableMemory(1024); | |
132 wpmd1->createDiscardableMemoryAllocatorDump("1/discardable", | |
133 discardable_memory.get()); | |
134 discardable_memory->Unlock(); | |
135 | |
122 wpmd1.reset(); | 136 wpmd1.reset(); |
123 } | 137 } |
124 | 138 |
125 } // namespace blink | 139 } // namespace blink |
OLD | NEW |