| 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 #ifndef BASE_TRACE_EVENT_MALLOC_DUMP_PROVIDER_H_ | 5 #ifndef BASE_TRACE_EVENT_MALLOC_DUMP_PROVIDER_H_ |
| 6 #define BASE_TRACE_EVENT_MALLOC_DUMP_PROVIDER_H_ | 6 #define BASE_TRACE_EVENT_MALLOC_DUMP_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <istream> | 8 #include <istream> |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 static MallocDumpProvider* GetInstance(); | 35 static MallocDumpProvider* GetInstance(); |
| 36 | 36 |
| 37 // MemoryDumpProvider implementation. | 37 // MemoryDumpProvider implementation. |
| 38 bool OnMemoryDump(const MemoryDumpArgs& args, | 38 bool OnMemoryDump(const MemoryDumpArgs& args, |
| 39 ProcessMemoryDump* pmd) override; | 39 ProcessMemoryDump* pmd) override; |
| 40 | 40 |
| 41 void OnHeapProfilingEnabled(bool enabled) override; | 41 void OnHeapProfilingEnabled(bool enabled) override; |
| 42 | 42 |
| 43 // For heap profiling. | 43 // For heap profiling. |
| 44 void InsertAllocation(void* address, size_t size); | 44 void InsertAllocation(void* address, size_t size, const char* tag = nullptr); |
| 45 void RemoveAllocation(void* address); | 45 void RemoveAllocation(void* address); |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 friend struct DefaultSingletonTraits<MallocDumpProvider>; | 48 friend struct DefaultSingletonTraits<MallocDumpProvider>; |
| 49 | 49 |
| 50 MallocDumpProvider(); | 50 MallocDumpProvider(); |
| 51 ~MallocDumpProvider() override; | 51 ~MallocDumpProvider() override; |
| 52 | 52 |
| 53 // For heap profiling. | 53 // For heap profiling. |
| 54 bool heap_profiler_enabled_; | 54 bool heap_profiler_enabled_; |
| 55 std::unique_ptr<AllocationRegister> allocation_register_; | 55 std::unique_ptr<AllocationRegister> allocation_register_; |
| 56 Lock allocation_register_lock_; | 56 Lock allocation_register_lock_; |
| 57 | 57 |
| 58 // When in OnMemoryDump(), this contains the current thread ID. | 58 // When in OnMemoryDump(), this contains the current thread ID. |
| 59 // This is to prevent re-entrancy in the heap profiler when the heap dump | 59 // This is to prevent re-entrancy in the heap profiler when the heap dump |
| 60 // generation is malloc/new-ing for its own bookeeping data structures. | 60 // generation is malloc/new-ing for its own bookeeping data structures. |
| 61 PlatformThreadId tid_dumping_heap_; | 61 PlatformThreadId tid_dumping_heap_; |
| 62 | 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(MallocDumpProvider); | 63 DISALLOW_COPY_AND_ASSIGN(MallocDumpProvider); |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 } // namespace trace_event | 66 } // namespace trace_event |
| 67 } // namespace base | 67 } // namespace base |
| 68 | 68 |
| 69 #endif // BASE_TRACE_EVENT_MALLOC_DUMP_PROVIDER_H_ | 69 #endif // BASE_TRACE_EVENT_MALLOC_DUMP_PROVIDER_H_ |
| OLD | NEW |