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 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/base_switches.h" | 11 #include "base/base_switches.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/debug/alias.h" | 13 #include "base/debug/alias.h" |
14 #include "base/debug/leak_annotations.h" | 14 #include "base/debug/leak_annotations.h" |
15 #include "base/debug/profiler.h" | 15 #include "base/debug/profiler.h" |
| 16 #include "base/debug/scoped_thread_heap_usage.h" |
16 #include "base/lazy_instance.h" | 17 #include "base/lazy_instance.h" |
17 #include "base/location.h" | 18 #include "base/location.h" |
18 #include "base/logging.h" | 19 #include "base/logging.h" |
19 #include "base/macros.h" | 20 #include "base/macros.h" |
20 #include "base/message_loop/timer_slack.h" | 21 #include "base/message_loop/timer_slack.h" |
21 #include "base/metrics/field_trial.h" | 22 #include "base/metrics/field_trial.h" |
22 #include "base/metrics/histogram_macros.h" | 23 #include "base/metrics/histogram_macros.h" |
23 #include "base/process/process.h" | 24 #include "base/process/process.h" |
24 #include "base/process/process_handle.h" | 25 #include "base/process/process_handle.h" |
25 #include "base/single_thread_task_runner.h" | 26 #include "base/single_thread_task_runner.h" |
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 #if defined(IPC_MESSAGE_LOG_ENABLED) | 788 #if defined(IPC_MESSAGE_LOG_ENABLED) |
788 void ChildThreadImpl::OnSetIPCLoggingEnabled(bool enable) { | 789 void ChildThreadImpl::OnSetIPCLoggingEnabled(bool enable) { |
789 if (enable) | 790 if (enable) |
790 IPC::Logging::GetInstance()->Enable(); | 791 IPC::Logging::GetInstance()->Enable(); |
791 else | 792 else |
792 IPC::Logging::GetInstance()->Disable(); | 793 IPC::Logging::GetInstance()->Disable(); |
793 } | 794 } |
794 #endif // IPC_MESSAGE_LOG_ENABLED | 795 #endif // IPC_MESSAGE_LOG_ENABLED |
795 | 796 |
796 void ChildThreadImpl::OnSetProfilerStatus(ThreadData::Status status) { | 797 void ChildThreadImpl::OnSetProfilerStatus(ThreadData::Status status) { |
| 798 if (status == ThreadData::PROFILING_ACTIVE && |
| 799 !base::debug::HeapUsageTracker::IsHeapTrackingEnabled()) { |
| 800 base::debug::HeapUsageTracker::EnableHeapTracking(); |
| 801 } |
797 ThreadData::InitializeAndSetTrackingStatus(status); | 802 ThreadData::InitializeAndSetTrackingStatus(status); |
798 } | 803 } |
799 | 804 |
800 void ChildThreadImpl::OnGetChildProfilerData(int sequence_number, | 805 void ChildThreadImpl::OnGetChildProfilerData(int sequence_number, |
801 int current_profiling_phase) { | 806 int current_profiling_phase) { |
802 tracked_objects::ProcessDataSnapshot process_data; | 807 tracked_objects::ProcessDataSnapshot process_data; |
803 ThreadData::Snapshot(current_profiling_phase, &process_data); | 808 ThreadData::Snapshot(current_profiling_phase, &process_data); |
804 | 809 |
805 Send( | 810 Send( |
806 new ChildProcessHostMsg_ChildProfilerData(sequence_number, process_data)); | 811 new ChildProcessHostMsg_ChildProfilerData(sequence_number, process_data)); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 Listener* route = router_.GetRoute(routing_id); | 869 Listener* route = router_.GetRoute(routing_id); |
865 if (route) | 870 if (route) |
866 route->OnAssociatedInterfaceRequest(name, request.PassHandle()); | 871 route->OnAssociatedInterfaceRequest(name, request.PassHandle()); |
867 } | 872 } |
868 | 873 |
869 bool ChildThreadImpl::IsInBrowserProcess() const { | 874 bool ChildThreadImpl::IsInBrowserProcess() const { |
870 return static_cast<bool>(browser_process_io_runner_); | 875 return static_cast<bool>(browser_process_io_runner_); |
871 } | 876 } |
872 | 877 |
873 } // namespace content | 878 } // namespace content |
OLD | NEW |