Chromium Code Reviews| Index: content/common/child_thread.cc |
| =================================================================== |
| --- content/common/child_thread.cc (revision 111617) |
| +++ content/common/child_thread.cc (working copy) |
| @@ -4,9 +4,14 @@ |
| #include "content/common/child_thread.h" |
| +#include "base/bind.h" |
|
jam
2011/11/28 15:17:34
nit: not needed?
ramant (doing other things)
2011/11/29 01:32:20
Done.
|
| +#include "base/command_line.h" |
| +#include "base/json/json_writer.h" |
|
jam
2011/11/28 15:17:34
nit: not needed
ramant (doing other things)
2011/11/29 01:32:20
Done.
|
| #include "base/message_loop.h" |
| +#include "base/process.h" |
| +#include "base/process_util.h" |
| #include "base/string_util.h" |
| -#include "base/command_line.h" |
| +#include "base/tracked_objects.h" |
| #include "content/common/child_process.h" |
| #include "content/common/child_process_messages.h" |
| #include "content/common/child_trace_message_filter.h" |
| @@ -183,6 +188,10 @@ |
| IPC_MESSAGE_HANDLER(ChildProcessMsg_SetIPCLoggingEnabled, |
| OnSetIPCLoggingEnabled) |
| #endif |
| + IPC_MESSAGE_HANDLER(ChildProcessMsg_SetProfilerStatus, |
| + OnSetProfilerStatus) |
| + IPC_MESSAGE_HANDLER(ChildProcessMsg_GetChildProfilerData, |
| + OnGetChildProfilerData) |
| IPC_MESSAGE_HANDLER(ChildProcessMsg_DumpHandles, OnDumpHandles) |
| IPC_MESSAGE_UNHANDLED(handled = false) |
| IPC_END_MESSAGE_MAP() |
| @@ -217,6 +226,20 @@ |
| } |
| #endif // IPC_MESSAGE_LOG_ENABLED |
| +void ChildThread::OnSetProfilerStatus(bool enable) { |
| + tracked_objects::ThreadData::InitializeAndSetTrackingStatus(enable); |
| +} |
| + |
| +void ChildThread::OnGetChildProfilerData( |
| + int sequence_number, |
| + const std::string& process_type) { |
| + base::DictionaryValue* value = tracked_objects::ThreadData::ToValue(); |
|
jam
2011/11/28 15:17:34
memory leak of value here
ramant (doing other things)
2011/11/29 01:32:20
many many thanks for catching this (made the mista
|
| + value->SetString("process_type", process_type); |
| + value->SetInteger("process_id", base::GetCurrentProcId()); |
| + |
| + Send(new ChildProcessHostMsg_ChildProfilerData(sequence_number, *value)); |
| +} |
| + |
| void ChildThread::OnDumpHandles() { |
| #if defined(OS_WIN) |
| scoped_refptr<content::HandleEnumerator> handle_enum( |