| Index: content/browser/tracing/trace_message_filter.cc
|
| diff --git a/content/browser/tracing/trace_message_filter.cc b/content/browser/tracing/trace_message_filter.cc
|
| index a26c6542b39d379c2094191fd1e94731b608eab0..6d4c6d1e32b4024ea79da20b97107cfa6c983df2 100644
|
| --- a/content/browser/tracing/trace_message_filter.cc
|
| +++ b/content/browser/tracing/trace_message_filter.cc
|
| @@ -9,6 +9,33 @@
|
| #include "content/browser/tracing/tracing_controller_impl.h"
|
| #include "content/common/child_process_host_impl.h"
|
|
|
| +#if defined(OS_LINUX)
|
| +#include <fcntl.h>
|
| +#endif
|
| +
|
| +namespace {
|
| +
|
| +void OpenFilesForProcess(int pid,
|
| + TracingMsg_MemoryTracingInfo& memory_tracing_info) {
|
| +#if defined(OS_LINUX)
|
| + std::string proc_smaps_name = base::StringPrintf("/proc/%d/smaps", pid);
|
| + int smaps_fd = HANDLE_EINTR(open(proc_smaps_name.c_str(), O_RDONLY));
|
| + if (smaps_fd != -1) {
|
| + memory_tracing_info.smaps_fd = IPC::GetFileHandleForProcess(
|
| + smaps_fd, base::GetCurrentProcessHandle(), true);
|
| + }
|
| +
|
| + std::string proc_status_name = base::StringPrintf("/proc/%d/status", pid);
|
| + int status_fd = HANDLE_EINTR(open(proc_status_name.c_str(), O_RDONLY));
|
| + if (status_fd != -1) {
|
| + memory_tracing_info.status_fd = IPC::GetFileHandleForProcess(
|
| + status_fd, base::GetCurrentProcessHandle(), true);
|
| + }
|
| +#endif
|
| +}
|
| +
|
| +} // namespace
|
| +
|
| namespace content {
|
|
|
| TraceMessageFilter::TraceMessageFilter(int child_process_id)
|
| @@ -69,9 +96,15 @@ bool TraceMessageFilter::OnMessageReceived(const IPC::Message& message) {
|
|
|
| void TraceMessageFilter::SendBeginTracing(
|
| const base::trace_event::TraceConfig& trace_config) {
|
| - DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
| + TracingMsg_MemoryTracingInfo memory_tracing_info;
|
| + if (trace_config.IsDetailedMemoryDumpEnabled()) {
|
| + if (trace_config.IsDetailedMemoryDumpEnabled()) {
|
| + OpenFilesForProcess(this->peer_pid(), memory_tracing_info);
|
| + }
|
| + memory_tracing_info.tracing_process_id = tracing_process_id_;
|
| + }
|
| Send(new TracingMsg_BeginTracing(
|
| - trace_config.ToString(), base::TraceTicks::Now(), tracing_process_id_));
|
| + trace_config.ToString(), base::TraceTicks::Now(), memory_tracing_info));
|
| }
|
|
|
| void TraceMessageFilter::SendEndTracing() {
|
|
|