Index: components/tracing/child_memory_dump_manager_delegate_impl.cc |
diff --git a/components/tracing/child_memory_dump_manager_delegate_impl.cc b/components/tracing/child_memory_dump_manager_delegate_impl.cc |
index fe5c952f6a9a91ecf83ce42e81e49b543eb42974..104c013108210067df846d3e6cb373f5c73eaee0 100644 |
--- a/components/tracing/child_memory_dump_manager_delegate_impl.cc |
+++ b/components/tracing/child_memory_dump_manager_delegate_impl.cc |
@@ -5,6 +5,8 @@ |
#include "components/tracing/child_memory_dump_manager_delegate_impl.h" |
#include "base/single_thread_task_runner.h" |
+#include "base/trace_event/process_memory_maps_dump_provider.h" |
+#include "base/trace_event/process_memory_totals_dump_provider.h" |
#include "components/tracing/child_trace_message_filter.h" |
namespace tracing { |
@@ -90,6 +92,37 @@ void ChildMemoryDumpManagerDelegateImpl::RequestGlobalMemoryDump( |
ctmf_->SendGlobalMemoryDumpRequest(args, callback); |
} |
+void ChildMemoryDumpManagerDelegateImpl::SetMemoryTracingInfo( |
+ const TracingMsg_MemoryTracingInfo& memory_tracing_info) { |
+ // Checks if id is not reset to different one. |
+ DCHECK_IMPLIES( |
+ tracing_process_id_ != |
+ base::trace_event::MemoryDumpManager::kInvalidTracingProcessId, |
+ memory_tracing_info.tracing_process_id == tracing_process_id_); |
+ tracing_process_id_ = memory_tracing_info.tracing_process_id; |
+ |
+#if defined(OS_LINUX) |
+ base::trace_event::ProcessMemoryMapsDumpProvider::GetInstance() |
+ ->set_smaps_file(fdopen(IPC::PlatformFileForTransitToPlatformFile( |
+ memory_tracing_info.smaps_fd), |
+ "r")); |
+ base::trace_event::ProcessMemoryTotalsDumpProvider::GetInstance() |
+ ->set_proc_status_fd(IPC::PlatformFileForTransitToPlatformFile( |
+ memory_tracing_info.status_fd)); |
+#endif |
+} |
+ |
+void ChildMemoryDumpManagerDelegateImpl::ResetMemoryTracingInfo() { |
+#if defined(OS_LINUX) |
+ tracing_process_id_ = |
+ base::trace_event::MemoryDumpManager::kInvalidTracingProcessId; |
+ base::trace_event::ProcessMemoryMapsDumpProvider::GetInstance() |
+ ->set_smaps_file(nullptr); |
+ base::trace_event::ProcessMemoryTotalsDumpProvider::GetInstance() |
+ ->reset_proc_status_fd(); |
+#endif |
+} |
+ |
uint64 ChildMemoryDumpManagerDelegateImpl::GetTracingProcessId() const { |
return tracing_process_id_; |
} |