| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/child/child_thread_impl.h" | 5 #include "content/child/child_thread_impl.h" |
| 6 | 6 |
| 7 #include <signal.h> | 7 #include <signal.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 IPC_BEGIN_MESSAGE_MAP(ChildThreadImpl, msg) | 592 IPC_BEGIN_MESSAGE_MAP(ChildThreadImpl, msg) |
| 593 IPC_MESSAGE_HANDLER(ChildProcessMsg_Shutdown, OnShutdown) | 593 IPC_MESSAGE_HANDLER(ChildProcessMsg_Shutdown, OnShutdown) |
| 594 #if defined(IPC_MESSAGE_LOG_ENABLED) | 594 #if defined(IPC_MESSAGE_LOG_ENABLED) |
| 595 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetIPCLoggingEnabled, | 595 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetIPCLoggingEnabled, |
| 596 OnSetIPCLoggingEnabled) | 596 OnSetIPCLoggingEnabled) |
| 597 #endif | 597 #endif |
| 598 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetProfilerStatus, | 598 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetProfilerStatus, |
| 599 OnSetProfilerStatus) | 599 OnSetProfilerStatus) |
| 600 IPC_MESSAGE_HANDLER(ChildProcessMsg_GetChildProfilerData, | 600 IPC_MESSAGE_HANDLER(ChildProcessMsg_GetChildProfilerData, |
| 601 OnGetChildProfilerData) | 601 OnGetChildProfilerData) |
| 602 IPC_MESSAGE_HANDLER(ChildProcessMsg_OnProfilingPhase, |
| 603 OnProfilingPhaseCompletion) |
| 602 IPC_MESSAGE_HANDLER(ChildProcessMsg_DumpHandles, OnDumpHandles) | 604 IPC_MESSAGE_HANDLER(ChildProcessMsg_DumpHandles, OnDumpHandles) |
| 603 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetProcessBackgrounded, | 605 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetProcessBackgrounded, |
| 604 OnProcessBackgrounded) | 606 OnProcessBackgrounded) |
| 605 #if defined(USE_TCMALLOC) | 607 #if defined(USE_TCMALLOC) |
| 606 IPC_MESSAGE_HANDLER(ChildProcessMsg_GetTcmallocStats, OnGetTcmallocStats) | 608 IPC_MESSAGE_HANDLER(ChildProcessMsg_GetTcmallocStats, OnGetTcmallocStats) |
| 607 #endif | 609 #endif |
| 608 IPC_MESSAGE_UNHANDLED(handled = false) | 610 IPC_MESSAGE_UNHANDLED(handled = false) |
| 609 IPC_END_MESSAGE_MAP() | 611 IPC_END_MESSAGE_MAP() |
| 610 | 612 |
| 611 if (handled) | 613 if (handled) |
| (...skipping 19 matching lines...) Expand all Loading... |
| 631 IPC::Logging::GetInstance()->Enable(); | 633 IPC::Logging::GetInstance()->Enable(); |
| 632 else | 634 else |
| 633 IPC::Logging::GetInstance()->Disable(); | 635 IPC::Logging::GetInstance()->Disable(); |
| 634 } | 636 } |
| 635 #endif // IPC_MESSAGE_LOG_ENABLED | 637 #endif // IPC_MESSAGE_LOG_ENABLED |
| 636 | 638 |
| 637 void ChildThreadImpl::OnSetProfilerStatus(ThreadData::Status status) { | 639 void ChildThreadImpl::OnSetProfilerStatus(ThreadData::Status status) { |
| 638 ThreadData::InitializeAndSetTrackingStatus(status); | 640 ThreadData::InitializeAndSetTrackingStatus(status); |
| 639 } | 641 } |
| 640 | 642 |
| 641 void ChildThreadImpl::OnGetChildProfilerData(int sequence_number) { | 643 void ChildThreadImpl::OnGetChildProfilerData(int sequence_number, |
| 644 int current_profiling_phase) { |
| 642 tracked_objects::ProcessDataSnapshot process_data; | 645 tracked_objects::ProcessDataSnapshot process_data; |
| 643 ThreadData::Snapshot(&process_data); | 646 ThreadData::Snapshot(current_profiling_phase, &process_data); |
| 644 | 647 |
| 645 Send( | 648 Send( |
| 646 new ChildProcessHostMsg_ChildProfilerData(sequence_number, process_data)); | 649 new ChildProcessHostMsg_ChildProfilerData(sequence_number, process_data)); |
| 647 } | 650 } |
| 648 | 651 |
| 652 void ChildThreadImpl::OnProfilingPhaseCompletion(int profiling_phase) { |
| 653 ThreadData::OnProfilingPhaseCompletion(profiling_phase); |
| 654 } |
| 655 |
| 649 void ChildThreadImpl::OnDumpHandles() { | 656 void ChildThreadImpl::OnDumpHandles() { |
| 650 #if defined(OS_WIN) | 657 #if defined(OS_WIN) |
| 651 scoped_refptr<HandleEnumerator> handle_enum( | 658 scoped_refptr<HandleEnumerator> handle_enum( |
| 652 new HandleEnumerator( | 659 new HandleEnumerator( |
| 653 base::CommandLine::ForCurrentProcess()->HasSwitch( | 660 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 654 switches::kAuditAllHandles))); | 661 switches::kAuditAllHandles))); |
| 655 handle_enum->EnumerateHandles(); | 662 handle_enum->EnumerateHandles(); |
| 656 Send(new ChildProcessHostMsg_DumpHandlesDone); | 663 Send(new ChildProcessHostMsg_DumpHandlesDone); |
| 657 #else | 664 #else |
| 658 NOTIMPLEMENTED(); | 665 NOTIMPLEMENTED(); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 // doesn't cause such issues. TODO(gab): Remove this once the experiment is | 742 // doesn't cause such issues. TODO(gab): Remove this once the experiment is |
| 736 // over (http://crbug.com/458594). | 743 // over (http://crbug.com/458594). |
| 737 base::FieldTrial* trial = | 744 base::FieldTrial* trial = |
| 738 base::FieldTrialList::Find("BackgroundRendererProcesses"); | 745 base::FieldTrialList::Find("BackgroundRendererProcesses"); |
| 739 if (trial && trial->group_name() == "AllowBackgroundModeFromRenderer") | 746 if (trial && trial->group_name() == "AllowBackgroundModeFromRenderer") |
| 740 base::Process::Current().SetProcessBackgrounded(background); | 747 base::Process::Current().SetProcessBackgrounded(background); |
| 741 #endif // OS_WIN | 748 #endif // OS_WIN |
| 742 } | 749 } |
| 743 | 750 |
| 744 } // namespace content | 751 } // namespace content |
| OLD | NEW |