| 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_MEMORY_DUMP_MANAGER_H_ | 5 #ifndef BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_ |
| 6 #define BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_ | 6 #define BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <set> | 12 #include <set> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/atomicops.h" | 15 #include "base/atomicops.h" |
| 16 #include "base/containers/hash_tables.h" | 16 #include "base/containers/hash_tables.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
| 19 #include "base/memory/singleton.h" | 19 #include "base/memory/singleton.h" |
| 20 #include "base/synchronization/lock.h" | 20 #include "base/synchronization/lock.h" |
| 21 #include "base/trace_event/memory_allocator_dump.h" |
| 21 #include "base/trace_event/memory_dump_request_args.h" | 22 #include "base/trace_event/memory_dump_request_args.h" |
| 22 #include "base/trace_event/process_memory_dump.h" | 23 #include "base/trace_event/process_memory_dump.h" |
| 23 #include "base/trace_event/trace_event.h" | 24 #include "base/trace_event/trace_event.h" |
| 24 | 25 |
| 25 // Forward declare |MemoryDumpManagerDelegateImplTest| so that we can make it a | 26 // Forward declare |MemoryDumpManagerDelegateImplTest| so that we can make it a |
| 26 // friend of |MemoryDumpManager| and give it access to |SetInstanceForTesting|. | 27 // friend of |MemoryDumpManager| and give it access to |SetInstanceForTesting|. |
| 27 namespace memory_instrumentation { | 28 namespace memory_instrumentation { |
| 28 | 29 |
| 29 class MemoryDumpManagerDelegateImplTest; | 30 class MemoryDumpManagerDelegateImplTest; |
| 30 | 31 |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 DISALLOW_COPY_AND_ASSIGN(ProcessMemoryDumpAsyncState); | 291 DISALLOW_COPY_AND_ASSIGN(ProcessMemoryDumpAsyncState); |
| 291 }; | 292 }; |
| 292 | 293 |
| 293 static const int kMaxConsecutiveFailuresCount; | 294 static const int kMaxConsecutiveFailuresCount; |
| 294 static const char* const kSystemAllocatorPoolName; | 295 static const char* const kSystemAllocatorPoolName; |
| 295 | 296 |
| 296 MemoryDumpManager(); | 297 MemoryDumpManager(); |
| 297 ~MemoryDumpManager() override; | 298 ~MemoryDumpManager() override; |
| 298 | 299 |
| 299 static void SetInstanceForTesting(MemoryDumpManager* instance); | 300 static void SetInstanceForTesting(MemoryDumpManager* instance); |
| 301 static uint32_t GetDumpsSumKb(const std::string&, const ProcessMemoryDump*); |
| 300 static void FinalizeDumpAndAddToTrace( | 302 static void FinalizeDumpAndAddToTrace( |
| 301 std::unique_ptr<ProcessMemoryDumpAsyncState> pmd_async_state); | 303 std::unique_ptr<ProcessMemoryDumpAsyncState> pmd_async_state); |
| 302 | 304 |
| 303 // Internal, used only by MemoryDumpManagerDelegate. | 305 // Internal, used only by MemoryDumpManagerDelegate. |
| 304 // Creates a memory dump for the current process and appends it to the trace. | 306 // Creates a memory dump for the current process and appends it to the trace. |
| 305 // |callback| will be invoked asynchronously upon completion on the same | 307 // |callback| will be invoked asynchronously upon completion on the same |
| 306 // thread on which CreateProcessDump() was called. | 308 // thread on which CreateProcessDump() was called. |
| 307 void CreateProcessDump(const MemoryDumpRequestArgs& args, | 309 void CreateProcessDump(const MemoryDumpRequestArgs& args, |
| 308 const MemoryDumpCallback& callback); | 310 const MemoryDumpCallback& callback); |
| 309 | 311 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 } | 411 } |
| 410 | 412 |
| 411 private: | 413 private: |
| 412 DISALLOW_COPY_AND_ASSIGN(MemoryDumpManagerDelegate); | 414 DISALLOW_COPY_AND_ASSIGN(MemoryDumpManagerDelegate); |
| 413 }; | 415 }; |
| 414 | 416 |
| 415 } // namespace trace_event | 417 } // namespace trace_event |
| 416 } // namespace base | 418 } // namespace base |
| 417 | 419 |
| 418 #endif // BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_ | 420 #endif // BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_ |
| OLD | NEW |