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

Unified Diff: components/tracing/child_memory_dump_manager_delegate_impl.cc

Issue 1329273002: [tracing] Send smaps file desciptor to child process for tracing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
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_;
}
« no previous file with comments | « components/tracing/child_memory_dump_manager_delegate_impl.h ('k') | components/tracing/child_trace_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698