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