1*635a8641SAndroid Build Coastguard Workerdiff --git a/mojo/core/handle_table.cc b/mojo/core/handle_table.cc 2*635a8641SAndroid Build Coastguard Workerindex 62419a9..e039c71 100644 3*635a8641SAndroid Build Coastguard Worker--- a/mojo/core/handle_table.cc 4*635a8641SAndroid Build Coastguard Worker+++ b/mojo/core/handle_table.cc 5*635a8641SAndroid Build Coastguard Worker@@ -8,35 +8,35 @@ 6*635a8641SAndroid Build Coastguard Worker 7*635a8641SAndroid Build Coastguard Worker #include <limits> 8*635a8641SAndroid Build Coastguard Worker 9*635a8641SAndroid Build Coastguard Worker-#include "base/trace_event/memory_dump_manager.h" 10*635a8641SAndroid Build Coastguard Worker+// #include "base/trace_event/memory_dump_manager.h" 11*635a8641SAndroid Build Coastguard Worker 12*635a8641SAndroid Build Coastguard Worker namespace mojo { 13*635a8641SAndroid Build Coastguard Worker namespace core { 14*635a8641SAndroid Build Coastguard Worker 15*635a8641SAndroid Build Coastguard Worker namespace { 16*635a8641SAndroid Build Coastguard Worker 17*635a8641SAndroid Build Coastguard Worker-const char* GetNameForDispatcherType(Dispatcher::Type type) { 18*635a8641SAndroid Build Coastguard Worker- switch (type) { 19*635a8641SAndroid Build Coastguard Worker- case Dispatcher::Type::UNKNOWN: 20*635a8641SAndroid Build Coastguard Worker- return "unknown"; 21*635a8641SAndroid Build Coastguard Worker- case Dispatcher::Type::MESSAGE_PIPE: 22*635a8641SAndroid Build Coastguard Worker- return "message_pipe"; 23*635a8641SAndroid Build Coastguard Worker- case Dispatcher::Type::DATA_PIPE_PRODUCER: 24*635a8641SAndroid Build Coastguard Worker- return "data_pipe_producer"; 25*635a8641SAndroid Build Coastguard Worker- case Dispatcher::Type::DATA_PIPE_CONSUMER: 26*635a8641SAndroid Build Coastguard Worker- return "data_pipe_consumer"; 27*635a8641SAndroid Build Coastguard Worker- case Dispatcher::Type::SHARED_BUFFER: 28*635a8641SAndroid Build Coastguard Worker- return "shared_buffer"; 29*635a8641SAndroid Build Coastguard Worker- case Dispatcher::Type::WATCHER: 30*635a8641SAndroid Build Coastguard Worker- return "watcher"; 31*635a8641SAndroid Build Coastguard Worker- case Dispatcher::Type::PLATFORM_HANDLE: 32*635a8641SAndroid Build Coastguard Worker- return "platform_handle"; 33*635a8641SAndroid Build Coastguard Worker- case Dispatcher::Type::INVITATION: 34*635a8641SAndroid Build Coastguard Worker- return "invitation"; 35*635a8641SAndroid Build Coastguard Worker- } 36*635a8641SAndroid Build Coastguard Worker- NOTREACHED(); 37*635a8641SAndroid Build Coastguard Worker- return "unknown"; 38*635a8641SAndroid Build Coastguard Worker-} 39*635a8641SAndroid Build Coastguard Worker+// const char* GetNameForDispatcherType(Dispatcher::Type type) { 40*635a8641SAndroid Build Coastguard Worker+// switch (type) { 41*635a8641SAndroid Build Coastguard Worker+// case Dispatcher::Type::UNKNOWN: 42*635a8641SAndroid Build Coastguard Worker+// return "unknown"; 43*635a8641SAndroid Build Coastguard Worker+// case Dispatcher::Type::MESSAGE_PIPE: 44*635a8641SAndroid Build Coastguard Worker+// return "message_pipe"; 45*635a8641SAndroid Build Coastguard Worker+// case Dispatcher::Type::DATA_PIPE_PRODUCER: 46*635a8641SAndroid Build Coastguard Worker+// return "data_pipe_producer"; 47*635a8641SAndroid Build Coastguard Worker+// case Dispatcher::Type::DATA_PIPE_CONSUMER: 48*635a8641SAndroid Build Coastguard Worker+// return "data_pipe_consumer"; 49*635a8641SAndroid Build Coastguard Worker+// case Dispatcher::Type::SHARED_BUFFER: 50*635a8641SAndroid Build Coastguard Worker+// return "shared_buffer"; 51*635a8641SAndroid Build Coastguard Worker+// case Dispatcher::Type::WATCHER: 52*635a8641SAndroid Build Coastguard Worker+// return "watcher"; 53*635a8641SAndroid Build Coastguard Worker+// case Dispatcher::Type::PLATFORM_HANDLE: 54*635a8641SAndroid Build Coastguard Worker+// return "platform_handle"; 55*635a8641SAndroid Build Coastguard Worker+// case Dispatcher::Type::INVITATION: 56*635a8641SAndroid Build Coastguard Worker+// return "invitation"; 57*635a8641SAndroid Build Coastguard Worker+// } 58*635a8641SAndroid Build Coastguard Worker+// NOTREACHED(); 59*635a8641SAndroid Build Coastguard Worker+// return "unknown"; 60*635a8641SAndroid Build Coastguard Worker+// } 61*635a8641SAndroid Build Coastguard Worker 62*635a8641SAndroid Build Coastguard Worker } // namespace 63*635a8641SAndroid Build Coastguard Worker 64*635a8641SAndroid Build Coastguard Worker@@ -158,38 +158,38 @@ void HandleTable::GetActiveHandlesForTest(std::vector<MojoHandle>* handles) { 65*635a8641SAndroid Build Coastguard Worker } 66*635a8641SAndroid Build Coastguard Worker 67*635a8641SAndroid Build Coastguard Worker // MemoryDumpProvider implementation. 68*635a8641SAndroid Build Coastguard Worker-bool HandleTable::OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, 69*635a8641SAndroid Build Coastguard Worker- base::trace_event::ProcessMemoryDump* pmd) { 70*635a8641SAndroid Build Coastguard Worker- // Create entries for all relevant dispatcher types to ensure they are present 71*635a8641SAndroid Build Coastguard Worker- // in the final dump. 72*635a8641SAndroid Build Coastguard Worker- std::map<Dispatcher::Type, int> handle_count; 73*635a8641SAndroid Build Coastguard Worker- handle_count[Dispatcher::Type::MESSAGE_PIPE]; 74*635a8641SAndroid Build Coastguard Worker- handle_count[Dispatcher::Type::DATA_PIPE_PRODUCER]; 75*635a8641SAndroid Build Coastguard Worker- handle_count[Dispatcher::Type::DATA_PIPE_CONSUMER]; 76*635a8641SAndroid Build Coastguard Worker- handle_count[Dispatcher::Type::SHARED_BUFFER]; 77*635a8641SAndroid Build Coastguard Worker- handle_count[Dispatcher::Type::WATCHER]; 78*635a8641SAndroid Build Coastguard Worker- handle_count[Dispatcher::Type::PLATFORM_HANDLE]; 79*635a8641SAndroid Build Coastguard Worker- handle_count[Dispatcher::Type::INVITATION]; 80*635a8641SAndroid Build Coastguard Worker- 81*635a8641SAndroid Build Coastguard Worker- // Count the number of each dispatcher type. 82*635a8641SAndroid Build Coastguard Worker- { 83*635a8641SAndroid Build Coastguard Worker- base::AutoLock lock(GetLock()); 84*635a8641SAndroid Build Coastguard Worker- for (const auto& entry : handles_) { 85*635a8641SAndroid Build Coastguard Worker- ++handle_count[entry.second.dispatcher->GetType()]; 86*635a8641SAndroid Build Coastguard Worker- } 87*635a8641SAndroid Build Coastguard Worker- } 88*635a8641SAndroid Build Coastguard Worker- 89*635a8641SAndroid Build Coastguard Worker- for (const auto& entry : handle_count) { 90*635a8641SAndroid Build Coastguard Worker- base::trace_event::MemoryAllocatorDump* inner_dump = 91*635a8641SAndroid Build Coastguard Worker- pmd->CreateAllocatorDump(std::string("mojo/") + 92*635a8641SAndroid Build Coastguard Worker- GetNameForDispatcherType(entry.first)); 93*635a8641SAndroid Build Coastguard Worker- inner_dump->AddScalar( 94*635a8641SAndroid Build Coastguard Worker- base::trace_event::MemoryAllocatorDump::kNameObjectCount, 95*635a8641SAndroid Build Coastguard Worker- base::trace_event::MemoryAllocatorDump::kUnitsObjects, entry.second); 96*635a8641SAndroid Build Coastguard Worker- } 97*635a8641SAndroid Build Coastguard Worker- 98*635a8641SAndroid Build Coastguard Worker- return true; 99*635a8641SAndroid Build Coastguard Worker-} 100*635a8641SAndroid Build Coastguard Worker+// bool HandleTable::OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, 101*635a8641SAndroid Build Coastguard Worker+// base::trace_event::ProcessMemoryDump* pmd) { 102*635a8641SAndroid Build Coastguard Worker+// // Create entries for all relevant dispatcher types to ensure they are present 103*635a8641SAndroid Build Coastguard Worker+// // in the final dump. 104*635a8641SAndroid Build Coastguard Worker+// std::map<Dispatcher::Type, int> handle_count; 105*635a8641SAndroid Build Coastguard Worker+// handle_count[Dispatcher::Type::MESSAGE_PIPE]; 106*635a8641SAndroid Build Coastguard Worker+// handle_count[Dispatcher::Type::DATA_PIPE_PRODUCER]; 107*635a8641SAndroid Build Coastguard Worker+// handle_count[Dispatcher::Type::DATA_PIPE_CONSUMER]; 108*635a8641SAndroid Build Coastguard Worker+// handle_count[Dispatcher::Type::SHARED_BUFFER]; 109*635a8641SAndroid Build Coastguard Worker+// handle_count[Dispatcher::Type::WATCHER]; 110*635a8641SAndroid Build Coastguard Worker+// handle_count[Dispatcher::Type::PLATFORM_HANDLE]; 111*635a8641SAndroid Build Coastguard Worker+// handle_count[Dispatcher::Type::INVITATION]; 112*635a8641SAndroid Build Coastguard Worker+ 113*635a8641SAndroid Build Coastguard Worker+// // Count the number of each dispatcher type. 114*635a8641SAndroid Build Coastguard Worker+// { 115*635a8641SAndroid Build Coastguard Worker+// base::AutoLock lock(GetLock()); 116*635a8641SAndroid Build Coastguard Worker+// for (const auto& entry : handles_) { 117*635a8641SAndroid Build Coastguard Worker+// ++handle_count[entry.second.dispatcher->GetType()]; 118*635a8641SAndroid Build Coastguard Worker+// } 119*635a8641SAndroid Build Coastguard Worker+// } 120*635a8641SAndroid Build Coastguard Worker+ 121*635a8641SAndroid Build Coastguard Worker+// for (const auto& entry : handle_count) { 122*635a8641SAndroid Build Coastguard Worker+// base::trace_event::MemoryAllocatorDump* inner_dump = 123*635a8641SAndroid Build Coastguard Worker+// pmd->CreateAllocatorDump(std::string("mojo/") + 124*635a8641SAndroid Build Coastguard Worker+// GetNameForDispatcherType(entry.first)); 125*635a8641SAndroid Build Coastguard Worker+// inner_dump->AddScalar( 126*635a8641SAndroid Build Coastguard Worker+// base::trace_event::MemoryAllocatorDump::kNameObjectCount, 127*635a8641SAndroid Build Coastguard Worker+// base::trace_event::MemoryAllocatorDump::kUnitsObjects, entry.second); 128*635a8641SAndroid Build Coastguard Worker+// } 129*635a8641SAndroid Build Coastguard Worker+ 130*635a8641SAndroid Build Coastguard Worker+// return true; 131*635a8641SAndroid Build Coastguard Worker+// } 132*635a8641SAndroid Build Coastguard Worker 133*635a8641SAndroid Build Coastguard Worker HandleTable::Entry::Entry() {} 134*635a8641SAndroid Build Coastguard Worker 135*635a8641SAndroid Build Coastguard Workerdiff --git a/mojo/core/handle_table.h b/mojo/core/handle_table.h 136*635a8641SAndroid Build Coastguard Workerindex 234bdac..2e0edf7 100644 137*635a8641SAndroid Build Coastguard Worker--- a/mojo/core/handle_table.h 138*635a8641SAndroid Build Coastguard Worker+++ b/mojo/core/handle_table.h 139*635a8641SAndroid Build Coastguard Worker@@ -13,7 +13,7 @@ 140*635a8641SAndroid Build Coastguard Worker #include "base/gtest_prod_util.h" 141*635a8641SAndroid Build Coastguard Worker #include "base/macros.h" 142*635a8641SAndroid Build Coastguard Worker #include "base/synchronization/lock.h" 143*635a8641SAndroid Build Coastguard Worker-#include "base/trace_event/memory_dump_provider.h" 144*635a8641SAndroid Build Coastguard Worker+// #include "base/trace_event/memory_dump_provider.h" 145*635a8641SAndroid Build Coastguard Worker #include "mojo/core/dispatcher.h" 146*635a8641SAndroid Build Coastguard Worker #include "mojo/core/system_impl_export.h" 147*635a8641SAndroid Build Coastguard Worker #include "mojo/public/c/system/types.h" 148*635a8641SAndroid Build Coastguard Worker@@ -21,11 +21,10 @@ 149*635a8641SAndroid Build Coastguard Worker namespace mojo { 150*635a8641SAndroid Build Coastguard Worker namespace core { 151*635a8641SAndroid Build Coastguard Worker 152*635a8641SAndroid Build Coastguard Worker-class MOJO_SYSTEM_IMPL_EXPORT HandleTable 153*635a8641SAndroid Build Coastguard Worker- : public base::trace_event::MemoryDumpProvider { 154*635a8641SAndroid Build Coastguard Worker+class MOJO_SYSTEM_IMPL_EXPORT HandleTable { 155*635a8641SAndroid Build Coastguard Worker public: 156*635a8641SAndroid Build Coastguard Worker HandleTable(); 157*635a8641SAndroid Build Coastguard Worker- ~HandleTable() override; 158*635a8641SAndroid Build Coastguard Worker+ ~HandleTable(); 159*635a8641SAndroid Build Coastguard Worker 160*635a8641SAndroid Build Coastguard Worker // HandleTable is thread-hostile. All access should be gated by GetLock(). 161*635a8641SAndroid Build Coastguard Worker base::Lock& GetLock(); 162*635a8641SAndroid Build Coastguard Worker@@ -58,11 +57,11 @@ class MOJO_SYSTEM_IMPL_EXPORT HandleTable 163*635a8641SAndroid Build Coastguard Worker void GetActiveHandlesForTest(std::vector<MojoHandle>* handles); 164*635a8641SAndroid Build Coastguard Worker 165*635a8641SAndroid Build Coastguard Worker private: 166*635a8641SAndroid Build Coastguard Worker- FRIEND_TEST_ALL_PREFIXES(HandleTableTest, OnMemoryDump); 167*635a8641SAndroid Build Coastguard Worker+ // FRIEND_TEST_ALL_PREFIXES(HandleTableTest, OnMemoryDump); 168*635a8641SAndroid Build Coastguard Worker 169*635a8641SAndroid Build Coastguard Worker // MemoryDumpProvider implementation. 170*635a8641SAndroid Build Coastguard Worker- bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, 171*635a8641SAndroid Build Coastguard Worker- base::trace_event::ProcessMemoryDump* pmd) override; 172*635a8641SAndroid Build Coastguard Worker+ // bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, 173*635a8641SAndroid Build Coastguard Worker+ // base::trace_event::ProcessMemoryDump* pmd) override; 174*635a8641SAndroid Build Coastguard Worker 175*635a8641SAndroid Build Coastguard Worker struct Entry { 176*635a8641SAndroid Build Coastguard Worker Entry(); 177