You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
177 lines
6.1 KiB
177 lines
6.1 KiB
diff --git a/mojo/core/handle_table.cc b/mojo/core/handle_table.cc
|
|
index 62419a9..e039c71 100644
|
|
--- a/mojo/core/handle_table.cc
|
|
+++ b/mojo/core/handle_table.cc
|
|
@@ -8,35 +8,35 @@
|
|
|
|
#include <limits>
|
|
|
|
-#include "base/trace_event/memory_dump_manager.h"
|
|
+// #include "base/trace_event/memory_dump_manager.h"
|
|
|
|
namespace mojo {
|
|
namespace core {
|
|
|
|
namespace {
|
|
|
|
-const char* GetNameForDispatcherType(Dispatcher::Type type) {
|
|
- switch (type) {
|
|
- case Dispatcher::Type::UNKNOWN:
|
|
- return "unknown";
|
|
- case Dispatcher::Type::MESSAGE_PIPE:
|
|
- return "message_pipe";
|
|
- case Dispatcher::Type::DATA_PIPE_PRODUCER:
|
|
- return "data_pipe_producer";
|
|
- case Dispatcher::Type::DATA_PIPE_CONSUMER:
|
|
- return "data_pipe_consumer";
|
|
- case Dispatcher::Type::SHARED_BUFFER:
|
|
- return "shared_buffer";
|
|
- case Dispatcher::Type::WATCHER:
|
|
- return "watcher";
|
|
- case Dispatcher::Type::PLATFORM_HANDLE:
|
|
- return "platform_handle";
|
|
- case Dispatcher::Type::INVITATION:
|
|
- return "invitation";
|
|
- }
|
|
- NOTREACHED();
|
|
- return "unknown";
|
|
-}
|
|
+// const char* GetNameForDispatcherType(Dispatcher::Type type) {
|
|
+// switch (type) {
|
|
+// case Dispatcher::Type::UNKNOWN:
|
|
+// return "unknown";
|
|
+// case Dispatcher::Type::MESSAGE_PIPE:
|
|
+// return "message_pipe";
|
|
+// case Dispatcher::Type::DATA_PIPE_PRODUCER:
|
|
+// return "data_pipe_producer";
|
|
+// case Dispatcher::Type::DATA_PIPE_CONSUMER:
|
|
+// return "data_pipe_consumer";
|
|
+// case Dispatcher::Type::SHARED_BUFFER:
|
|
+// return "shared_buffer";
|
|
+// case Dispatcher::Type::WATCHER:
|
|
+// return "watcher";
|
|
+// case Dispatcher::Type::PLATFORM_HANDLE:
|
|
+// return "platform_handle";
|
|
+// case Dispatcher::Type::INVITATION:
|
|
+// return "invitation";
|
|
+// }
|
|
+// NOTREACHED();
|
|
+// return "unknown";
|
|
+// }
|
|
|
|
} // namespace
|
|
|
|
@@ -158,38 +158,38 @@ void HandleTable::GetActiveHandlesForTest(std::vector<MojoHandle>* handles) {
|
|
}
|
|
|
|
// MemoryDumpProvider implementation.
|
|
-bool HandleTable::OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
|
|
- base::trace_event::ProcessMemoryDump* pmd) {
|
|
- // Create entries for all relevant dispatcher types to ensure they are present
|
|
- // in the final dump.
|
|
- std::map<Dispatcher::Type, int> handle_count;
|
|
- handle_count[Dispatcher::Type::MESSAGE_PIPE];
|
|
- handle_count[Dispatcher::Type::DATA_PIPE_PRODUCER];
|
|
- handle_count[Dispatcher::Type::DATA_PIPE_CONSUMER];
|
|
- handle_count[Dispatcher::Type::SHARED_BUFFER];
|
|
- handle_count[Dispatcher::Type::WATCHER];
|
|
- handle_count[Dispatcher::Type::PLATFORM_HANDLE];
|
|
- handle_count[Dispatcher::Type::INVITATION];
|
|
-
|
|
- // Count the number of each dispatcher type.
|
|
- {
|
|
- base::AutoLock lock(GetLock());
|
|
- for (const auto& entry : handles_) {
|
|
- ++handle_count[entry.second.dispatcher->GetType()];
|
|
- }
|
|
- }
|
|
-
|
|
- for (const auto& entry : handle_count) {
|
|
- base::trace_event::MemoryAllocatorDump* inner_dump =
|
|
- pmd->CreateAllocatorDump(std::string("mojo/") +
|
|
- GetNameForDispatcherType(entry.first));
|
|
- inner_dump->AddScalar(
|
|
- base::trace_event::MemoryAllocatorDump::kNameObjectCount,
|
|
- base::trace_event::MemoryAllocatorDump::kUnitsObjects, entry.second);
|
|
- }
|
|
-
|
|
- return true;
|
|
-}
|
|
+// bool HandleTable::OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
|
|
+// base::trace_event::ProcessMemoryDump* pmd) {
|
|
+// // Create entries for all relevant dispatcher types to ensure they are present
|
|
+// // in the final dump.
|
|
+// std::map<Dispatcher::Type, int> handle_count;
|
|
+// handle_count[Dispatcher::Type::MESSAGE_PIPE];
|
|
+// handle_count[Dispatcher::Type::DATA_PIPE_PRODUCER];
|
|
+// handle_count[Dispatcher::Type::DATA_PIPE_CONSUMER];
|
|
+// handle_count[Dispatcher::Type::SHARED_BUFFER];
|
|
+// handle_count[Dispatcher::Type::WATCHER];
|
|
+// handle_count[Dispatcher::Type::PLATFORM_HANDLE];
|
|
+// handle_count[Dispatcher::Type::INVITATION];
|
|
+
|
|
+// // Count the number of each dispatcher type.
|
|
+// {
|
|
+// base::AutoLock lock(GetLock());
|
|
+// for (const auto& entry : handles_) {
|
|
+// ++handle_count[entry.second.dispatcher->GetType()];
|
|
+// }
|
|
+// }
|
|
+
|
|
+// for (const auto& entry : handle_count) {
|
|
+// base::trace_event::MemoryAllocatorDump* inner_dump =
|
|
+// pmd->CreateAllocatorDump(std::string("mojo/") +
|
|
+// GetNameForDispatcherType(entry.first));
|
|
+// inner_dump->AddScalar(
|
|
+// base::trace_event::MemoryAllocatorDump::kNameObjectCount,
|
|
+// base::trace_event::MemoryAllocatorDump::kUnitsObjects, entry.second);
|
|
+// }
|
|
+
|
|
+// return true;
|
|
+// }
|
|
|
|
HandleTable::Entry::Entry() {}
|
|
|
|
diff --git a/mojo/core/handle_table.h b/mojo/core/handle_table.h
|
|
index 234bdac..2e0edf7 100644
|
|
--- a/mojo/core/handle_table.h
|
|
+++ b/mojo/core/handle_table.h
|
|
@@ -13,7 +13,7 @@
|
|
#include "base/gtest_prod_util.h"
|
|
#include "base/macros.h"
|
|
#include "base/synchronization/lock.h"
|
|
-#include "base/trace_event/memory_dump_provider.h"
|
|
+// #include "base/trace_event/memory_dump_provider.h"
|
|
#include "mojo/core/dispatcher.h"
|
|
#include "mojo/core/system_impl_export.h"
|
|
#include "mojo/public/c/system/types.h"
|
|
@@ -21,11 +21,10 @@
|
|
namespace mojo {
|
|
namespace core {
|
|
|
|
-class MOJO_SYSTEM_IMPL_EXPORT HandleTable
|
|
- : public base::trace_event::MemoryDumpProvider {
|
|
+class MOJO_SYSTEM_IMPL_EXPORT HandleTable {
|
|
public:
|
|
HandleTable();
|
|
- ~HandleTable() override;
|
|
+ ~HandleTable();
|
|
|
|
// HandleTable is thread-hostile. All access should be gated by GetLock().
|
|
base::Lock& GetLock();
|
|
@@ -58,11 +57,11 @@ class MOJO_SYSTEM_IMPL_EXPORT HandleTable
|
|
void GetActiveHandlesForTest(std::vector<MojoHandle>* handles);
|
|
|
|
private:
|
|
- FRIEND_TEST_ALL_PREFIXES(HandleTableTest, OnMemoryDump);
|
|
+ // FRIEND_TEST_ALL_PREFIXES(HandleTableTest, OnMemoryDump);
|
|
|
|
// MemoryDumpProvider implementation.
|
|
- bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
|
|
- base::trace_event::ProcessMemoryDump* pmd) override;
|
|
+ // bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
|
|
+ // base::trace_event::ProcessMemoryDump* pmd) override;
|
|
|
|
struct Entry {
|
|
Entry();
|