Chromium Code Reviews| 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 "components/tracing/child_memory_dump_manager_delegate_impl.h" | 5 #include "components/tracing/child_memory_dump_manager_delegate_impl.h" |
| 6 | 6 |
| 7 #include "base/single_thread_task_runner.h" | 7 #include "base/single_thread_task_runner.h" |
|
Primiano Tucci (use gerrit)
2015/11/17 10:44:12
include what you use: add explicit build_config.h
ssid
2015/11/17 13:55:06
Done.
| |
| 8 #include "components/tracing/child_trace_message_filter.h" | 8 #include "components/tracing/child_trace_message_filter.h" |
| 9 #include "components/tracing/process_metrics_memory_dump_manager.h" | |
| 9 | 10 |
| 10 namespace tracing { | 11 namespace tracing { |
| 11 | 12 |
| 12 namespace { | 13 namespace { |
| 13 void AbortDumpRequest(const base::trace_event::MemoryDumpRequestArgs& args, | 14 void AbortDumpRequest(const base::trace_event::MemoryDumpRequestArgs& args, |
| 14 const base::trace_event::MemoryDumpCallback& callback) { | 15 const base::trace_event::MemoryDumpCallback& callback) { |
| 15 if (!callback.is_null()) | 16 if (!callback.is_null()) |
| 16 callback.Run(args.dump_guid, false /* success */); | 17 callback.Run(args.dump_guid, false /* success */); |
| 17 } | 18 } |
| 18 } // namespace | 19 } // namespace |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 42 ctmf_ = ctmf; | 43 ctmf_ = ctmf; |
| 43 | 44 |
| 44 { | 45 { |
| 45 base::AutoLock lock(lock_); | 46 base::AutoLock lock(lock_); |
| 46 ctmf_task_runner_ = task_runner; | 47 ctmf_task_runner_ = task_runner; |
| 47 } | 48 } |
| 48 | 49 |
| 49 if (ctmf) { | 50 if (ctmf) { |
| 50 base::trace_event::MemoryDumpManager::GetInstance()->Initialize( | 51 base::trace_event::MemoryDumpManager::GetInstance()->Initialize( |
| 51 this /* delegate */, false /* is_coordinator */); | 52 this /* delegate */, false /* is_coordinator */); |
| 53 | |
| 54 #if !defined(OS_LINUX) | |
| 55 // Do not register in linux due to sandbox. | |
|
Primiano Tucci (use gerrit)
2015/11/17 10:44:12
Make this more explicit and say: on Linux the brow
ssid
2015/11/17 13:55:06
Done.
| |
| 56 tracing::ProcessMetricsMemoryDumpManager::GetInstance()->RegisterForProcess( | |
| 57 base::kNullProcessHandle); | |
| 58 #endif | |
| 52 } | 59 } |
| 53 } | 60 } |
| 54 | 61 |
| 55 // Invoked in child processes by the MemoryDumpManager. | 62 // Invoked in child processes by the MemoryDumpManager. |
| 56 void ChildMemoryDumpManagerDelegateImpl::RequestGlobalMemoryDump( | 63 void ChildMemoryDumpManagerDelegateImpl::RequestGlobalMemoryDump( |
| 57 const base::trace_event::MemoryDumpRequestArgs& args, | 64 const base::trace_event::MemoryDumpRequestArgs& args, |
| 58 const base::trace_event::MemoryDumpCallback& callback) { | 65 const base::trace_event::MemoryDumpCallback& callback) { |
| 59 // RequestGlobalMemoryDump can be called on any thread, cannot access | 66 // RequestGlobalMemoryDump can be called on any thread, cannot access |
| 60 // ctmf_task_runner_ as it could be racy. | 67 // ctmf_task_runner_ as it could be racy. |
| 61 scoped_refptr<base::SingleThreadTaskRunner> ctmf_task_runner; | 68 scoped_refptr<base::SingleThreadTaskRunner> ctmf_task_runner; |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 88 | 95 |
| 89 // Send the request up to the browser process' MessageDumpmanager. | 96 // Send the request up to the browser process' MessageDumpmanager. |
| 90 ctmf_->SendGlobalMemoryDumpRequest(args, callback); | 97 ctmf_->SendGlobalMemoryDumpRequest(args, callback); |
| 91 } | 98 } |
| 92 | 99 |
| 93 uint64 ChildMemoryDumpManagerDelegateImpl::GetTracingProcessId() const { | 100 uint64 ChildMemoryDumpManagerDelegateImpl::GetTracingProcessId() const { |
| 94 return tracing_process_id_; | 101 return tracing_process_id_; |
| 95 } | 102 } |
| 96 | 103 |
| 97 } // namespace tracing | 104 } // namespace tracing |
| OLD | NEW |