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 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 IPC_BEGIN_MESSAGE_MAP(ChildThreadImpl, msg) | 602 IPC_BEGIN_MESSAGE_MAP(ChildThreadImpl, msg) |
603 IPC_MESSAGE_HANDLER(ChildProcessMsg_Shutdown, OnShutdown) | 603 IPC_MESSAGE_HANDLER(ChildProcessMsg_Shutdown, OnShutdown) |
604 #if defined(IPC_MESSAGE_LOG_ENABLED) | 604 #if defined(IPC_MESSAGE_LOG_ENABLED) |
605 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetIPCLoggingEnabled, | 605 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetIPCLoggingEnabled, |
606 OnSetIPCLoggingEnabled) | 606 OnSetIPCLoggingEnabled) |
607 #endif | 607 #endif |
608 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetProfilerStatus, | 608 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetProfilerStatus, |
609 OnSetProfilerStatus) | 609 OnSetProfilerStatus) |
610 IPC_MESSAGE_HANDLER(ChildProcessMsg_GetChildProfilerData, | 610 IPC_MESSAGE_HANDLER(ChildProcessMsg_GetChildProfilerData, |
611 OnGetChildProfilerData) | 611 OnGetChildProfilerData) |
| 612 IPC_MESSAGE_HANDLER(ChildProcessMsg_ProfilingPhaseCompleted, |
| 613 OnProfilingPhaseCompleted) |
612 IPC_MESSAGE_HANDLER(ChildProcessMsg_DumpHandles, OnDumpHandles) | 614 IPC_MESSAGE_HANDLER(ChildProcessMsg_DumpHandles, OnDumpHandles) |
613 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetProcessBackgrounded, | 615 IPC_MESSAGE_HANDLER(ChildProcessMsg_SetProcessBackgrounded, |
614 OnProcessBackgrounded) | 616 OnProcessBackgrounded) |
615 #if defined(USE_TCMALLOC) | 617 #if defined(USE_TCMALLOC) |
616 IPC_MESSAGE_HANDLER(ChildProcessMsg_GetTcmallocStats, OnGetTcmallocStats) | 618 IPC_MESSAGE_HANDLER(ChildProcessMsg_GetTcmallocStats, OnGetTcmallocStats) |
617 #endif | 619 #endif |
618 IPC_MESSAGE_UNHANDLED(handled = false) | 620 IPC_MESSAGE_UNHANDLED(handled = false) |
619 IPC_END_MESSAGE_MAP() | 621 IPC_END_MESSAGE_MAP() |
620 | 622 |
621 if (handled) | 623 if (handled) |
(...skipping 19 matching lines...) Expand all Loading... |
641 IPC::Logging::GetInstance()->Enable(); | 643 IPC::Logging::GetInstance()->Enable(); |
642 else | 644 else |
643 IPC::Logging::GetInstance()->Disable(); | 645 IPC::Logging::GetInstance()->Disable(); |
644 } | 646 } |
645 #endif // IPC_MESSAGE_LOG_ENABLED | 647 #endif // IPC_MESSAGE_LOG_ENABLED |
646 | 648 |
647 void ChildThreadImpl::OnSetProfilerStatus(ThreadData::Status status) { | 649 void ChildThreadImpl::OnSetProfilerStatus(ThreadData::Status status) { |
648 ThreadData::InitializeAndSetTrackingStatus(status); | 650 ThreadData::InitializeAndSetTrackingStatus(status); |
649 } | 651 } |
650 | 652 |
651 void ChildThreadImpl::OnGetChildProfilerData(int sequence_number) { | 653 void ChildThreadImpl::OnGetChildProfilerData(int sequence_number, |
| 654 int current_profiling_phase) { |
652 tracked_objects::ProcessDataSnapshot process_data; | 655 tracked_objects::ProcessDataSnapshot process_data; |
653 ThreadData::Snapshot(&process_data); | 656 ThreadData::Snapshot(current_profiling_phase, &process_data); |
654 | 657 |
655 Send( | 658 Send( |
656 new ChildProcessHostMsg_ChildProfilerData(sequence_number, process_data)); | 659 new ChildProcessHostMsg_ChildProfilerData(sequence_number, process_data)); |
657 } | 660 } |
658 | 661 |
| 662 void ChildThreadImpl::OnProfilingPhaseCompleted(int profiling_phase) { |
| 663 ThreadData::OnProfilingPhaseCompleted(profiling_phase); |
| 664 } |
| 665 |
659 void ChildThreadImpl::OnDumpHandles() { | 666 void ChildThreadImpl::OnDumpHandles() { |
660 #if defined(OS_WIN) | 667 #if defined(OS_WIN) |
661 scoped_refptr<HandleEnumerator> handle_enum( | 668 scoped_refptr<HandleEnumerator> handle_enum( |
662 new HandleEnumerator( | 669 new HandleEnumerator( |
663 base::CommandLine::ForCurrentProcess()->HasSwitch( | 670 base::CommandLine::ForCurrentProcess()->HasSwitch( |
664 switches::kAuditAllHandles))); | 671 switches::kAuditAllHandles))); |
665 handle_enum->EnumerateHandles(); | 672 handle_enum->EnumerateHandles(); |
666 Send(new ChildProcessHostMsg_DumpHandlesDone); | 673 Send(new ChildProcessHostMsg_DumpHandlesDone); |
667 #else | 674 #else |
668 NOTIMPLEMENTED(); | 675 NOTIMPLEMENTED(); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 // doesn't cause such issues. TODO(gab): Remove this once the experiment is | 756 // doesn't cause such issues. TODO(gab): Remove this once the experiment is |
750 // over (http://crbug.com/458594). | 757 // over (http://crbug.com/458594). |
751 base::FieldTrial* trial = | 758 base::FieldTrial* trial = |
752 base::FieldTrialList::Find("BackgroundRendererProcesses"); | 759 base::FieldTrialList::Find("BackgroundRendererProcesses"); |
753 if (trial && trial->group_name() == "AllowBackgroundModeFromRenderer") | 760 if (trial && trial->group_name() == "AllowBackgroundModeFromRenderer") |
754 base::Process::Current().SetProcessBackgrounded(background); | 761 base::Process::Current().SetProcessBackgrounded(background); |
755 #endif // OS_WIN | 762 #endif // OS_WIN |
756 } | 763 } |
757 | 764 |
758 } // namespace content | 765 } // namespace content |
OLD | NEW |