Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: base/trace_event/memory_dump_manager.cc

Issue 2865243003: memory-infra: Rename Enable/Disable in MemoryDumpManager. (Closed)
Patch Set: rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <inttypes.h> 7 #include <inttypes.h>
8 #include <stdio.h> 8 #include <stdio.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 754
755 if (!pmd_async_state->callback.is_null()) { 755 if (!pmd_async_state->callback.is_null()) {
756 pmd_async_state->callback.Run(dump_guid, dump_successful, result); 756 pmd_async_state->callback.Run(dump_guid, dump_successful, result);
757 pmd_async_state->callback.Reset(); 757 pmd_async_state->callback.Reset();
758 } 758 }
759 759
760 TRACE_EVENT_NESTABLE_ASYNC_END0(kTraceCategory, "ProcessMemoryDump", 760 TRACE_EVENT_NESTABLE_ASYNC_END0(kTraceCategory, "ProcessMemoryDump",
761 TRACE_ID_LOCAL(dump_guid)); 761 TRACE_ID_LOCAL(dump_guid));
762 } 762 }
763 763
764 void MemoryDumpManager::Enable( 764 void MemoryDumpManager::SetupForTracing(
765 const TraceConfig::MemoryDumpConfig& memory_dump_config) { 765 const TraceConfig::MemoryDumpConfig& memory_dump_config) {
766 scoped_refptr<HeapProfilerSerializationState> 766 scoped_refptr<HeapProfilerSerializationState>
767 heap_profiler_serialization_state = new HeapProfilerSerializationState; 767 heap_profiler_serialization_state = new HeapProfilerSerializationState;
768 heap_profiler_serialization_state 768 heap_profiler_serialization_state
769 ->set_heap_profiler_breakdown_threshold_bytes( 769 ->set_heap_profiler_breakdown_threshold_bytes(
770 memory_dump_config.heap_profiler_options.breakdown_threshold_bytes); 770 memory_dump_config.heap_profiler_options.breakdown_threshold_bytes);
771 if (heap_profiling_enabled_) { 771 if (heap_profiling_enabled_) {
772 // If heap profiling is enabled, the stack frame deduplicator and type name 772 // If heap profiling is enabled, the stack frame deduplicator and type name
773 // deduplicator will be in use. Add a metadata events to write the frames 773 // deduplicator will be in use. Add a metadata events to write the frames
774 // and type IDs. 774 // and type IDs.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 } 834 }
835 } 835 }
836 836
837 // Only coordinator process triggers periodic global memory dumps. 837 // Only coordinator process triggers periodic global memory dumps.
838 if (is_coordinator_ && !periodic_config.triggers.empty()) { 838 if (is_coordinator_ && !periodic_config.triggers.empty()) {
839 MemoryDumpScheduler::GetInstance()->Start(periodic_config, 839 MemoryDumpScheduler::GetInstance()->Start(periodic_config,
840 GetOrCreateBgTaskRunnerLocked()); 840 GetOrCreateBgTaskRunnerLocked());
841 } 841 }
842 } 842 }
843 843
844 void MemoryDumpManager::Disable() { 844 void MemoryDumpManager::TeardownForTracing() {
845 // There might be a memory dump in progress while this happens. Therefore, 845 // There might be a memory dump in progress while this happens. Therefore,
846 // ensure that the MDM state which depends on the tracing enabled / disabled 846 // ensure that the MDM state which depends on the tracing enabled / disabled
847 // state is always accessed by the dumping methods holding the |lock_|. 847 // state is always accessed by the dumping methods holding the |lock_|.
848 AutoLock lock(lock_); 848 AutoLock lock(lock_);
849 849
850 MemoryDumpScheduler::GetInstance()->Stop(); 850 MemoryDumpScheduler::GetInstance()->Stop();
851 MemoryPeakDetector::GetInstance()->TearDown(); 851 MemoryPeakDetector::GetInstance()->TearDown();
852 heap_profiler_serialization_state_ = nullptr; 852 heap_profiler_serialization_state_ = nullptr;
853 } 853 }
854 854
(...skipping 25 matching lines...) Expand all
880 if (iter == process_dumps.end()) { 880 if (iter == process_dumps.end()) {
881 std::unique_ptr<ProcessMemoryDump> new_pmd( 881 std::unique_ptr<ProcessMemoryDump> new_pmd(
882 new ProcessMemoryDump(heap_profiler_serialization_state, dump_args)); 882 new ProcessMemoryDump(heap_profiler_serialization_state, dump_args));
883 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first; 883 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first;
884 } 884 }
885 return iter->second.get(); 885 return iter->second.get();
886 } 886 }
887 887
888 } // namespace trace_event 888 } // namespace trace_event
889 } // namespace base 889 } // namespace base
OLDNEW
« no previous file with comments | « base/trace_event/memory_dump_manager.h ('k') | base/trace_event/memory_dump_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698