| 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 #include "base/trace_event/memory_dump_manager.h" | 5 #include "base/trace_event/memory_dump_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/atomic_sequence_num.h" | 10 #include "base/atomic_sequence_num.h" |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 scoped_refptr<StackFrameDeduplicator> stack_frame_deduplicator = nullptr; | 539 scoped_refptr<StackFrameDeduplicator> stack_frame_deduplicator = nullptr; |
| 540 scoped_refptr<TypeNameDeduplicator> type_name_deduplicator = nullptr; | 540 scoped_refptr<TypeNameDeduplicator> type_name_deduplicator = nullptr; |
| 541 | 541 |
| 542 if (heap_profiling_enabled_) { | 542 if (heap_profiling_enabled_) { |
| 543 // If heap profiling is enabled, the stack frame deduplicator and type name | 543 // If heap profiling is enabled, the stack frame deduplicator and type name |
| 544 // deduplicator will be in use. Add a metadata events to write the frames | 544 // deduplicator will be in use. Add a metadata events to write the frames |
| 545 // and type IDs. | 545 // and type IDs. |
| 546 stack_frame_deduplicator = new StackFrameDeduplicator; | 546 stack_frame_deduplicator = new StackFrameDeduplicator; |
| 547 type_name_deduplicator = new TypeNameDeduplicator; | 547 type_name_deduplicator = new TypeNameDeduplicator; |
| 548 TRACE_EVENT_API_ADD_METADATA_EVENT( | 548 TRACE_EVENT_API_ADD_METADATA_EVENT( |
| 549 "stackFrames", "stackFrames", | 549 TraceLog::GetCategoryGroupEnabled("__metadata"), "stackFrames", |
| 550 "stackFrames", |
| 550 scoped_refptr<ConvertableToTraceFormat>(stack_frame_deduplicator)); | 551 scoped_refptr<ConvertableToTraceFormat>(stack_frame_deduplicator)); |
| 551 TRACE_EVENT_API_ADD_METADATA_EVENT( | 552 TRACE_EVENT_API_ADD_METADATA_EVENT( |
| 552 "typeNames", "typeNames", | 553 TraceLog::GetCategoryGroupEnabled("__metadata"), "typeNames", |
| 554 "typeNames", |
| 553 scoped_refptr<ConvertableToTraceFormat>(type_name_deduplicator)); | 555 scoped_refptr<ConvertableToTraceFormat>(type_name_deduplicator)); |
| 554 } | 556 } |
| 555 | 557 |
| 556 DCHECK(!dump_thread_); | 558 DCHECK(!dump_thread_); |
| 557 dump_thread_ = std::move(dump_thread); | 559 dump_thread_ = std::move(dump_thread); |
| 558 session_state_ = new MemoryDumpSessionState(stack_frame_deduplicator, | 560 session_state_ = new MemoryDumpSessionState(stack_frame_deduplicator, |
| 559 type_name_deduplicator); | 561 type_name_deduplicator); |
| 560 | 562 |
| 561 subtle::NoBarrier_Store(&memory_tracing_enabled_, 1); | 563 subtle::NoBarrier_Store(&memory_tracing_enabled_, 1); |
| 562 | 564 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 auto iter = process_dumps.find(pid); | 674 auto iter = process_dumps.find(pid); |
| 673 if (iter == process_dumps.end()) { | 675 if (iter == process_dumps.end()) { |
| 674 scoped_ptr<ProcessMemoryDump> new_pmd(new ProcessMemoryDump(session_state)); | 676 scoped_ptr<ProcessMemoryDump> new_pmd(new ProcessMemoryDump(session_state)); |
| 675 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first; | 677 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first; |
| 676 } | 678 } |
| 677 return iter->second.get(); | 679 return iter->second.get(); |
| 678 } | 680 } |
| 679 | 681 |
| 680 } // namespace trace_event | 682 } // namespace trace_event |
| 681 } // namespace base | 683 } // namespace base |
| OLD | NEW |