OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "content/browser/tracing/tracing_controller_impl.h" | 4 #include "content/browser/tracing/tracing_controller_impl.h" |
5 | 5 |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/cpu.h" | 7 #include "base/cpu.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/guid.h" | 9 #include "base/guid.h" |
10 #include "base/json/string_escape.h" | 10 #include "base/json/string_escape.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 #if defined(ENABLE_POWER_TRACING) | 39 #if defined(ENABLE_POWER_TRACING) |
40 #include "content/browser/tracing/power_tracing_agent.h" | 40 #include "content/browser/tracing/power_tracing_agent.h" |
41 #endif | 41 #endif |
42 | 42 |
43 #if defined(OS_CHROMEOS) | 43 #if defined(OS_CHROMEOS) |
44 #include "chromeos/dbus/dbus_thread_manager.h" | 44 #include "chromeos/dbus/dbus_thread_manager.h" |
45 #include "chromeos/dbus/debug_daemon_client.h" | 45 #include "chromeos/dbus/debug_daemon_client.h" |
46 #endif | 46 #endif |
47 | 47 |
48 #if defined(OS_WIN) | 48 #if defined(OS_WIN) |
49 #include "content/browser/tracing/etw_system_event_consumer_win.h" | 49 #include "content/browser/tracing/etw_tracing_agent_win.h" |
50 #endif | 50 #endif |
51 | 51 |
52 using base::trace_event::TraceLog; | 52 using base::trace_event::TraceLog; |
53 using base::trace_event::TraceConfig; | 53 using base::trace_event::TraceConfig; |
54 | 54 |
55 namespace content { | 55 namespace content { |
56 | 56 |
57 namespace { | 57 namespace { |
58 | 58 |
59 base::LazyInstance<TracingControllerImpl>::Leaky g_controller = | 59 base::LazyInstance<TracingControllerImpl>::Leaky g_controller = |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 chromeos::DebugDaemonClient* debug_daemon = | 272 chromeos::DebugDaemonClient* debug_daemon = |
273 chromeos::DBusThreadManager::Get()->GetDebugDaemonClient(); | 273 chromeos::DBusThreadManager::Get()->GetDebugDaemonClient(); |
274 if (debug_daemon) { | 274 if (debug_daemon) { |
275 debug_daemon->StartAgentTracing( | 275 debug_daemon->StartAgentTracing( |
276 trace_config, | 276 trace_config, |
277 base::Bind(&TracingControllerImpl::OnStartAgentTracingAcked, | 277 base::Bind(&TracingControllerImpl::OnStartAgentTracingAcked, |
278 base::Unretained(this))); | 278 base::Unretained(this))); |
279 ++pending_start_tracing_ack_count_; | 279 ++pending_start_tracing_ack_count_; |
280 } | 280 } |
281 #elif defined(OS_WIN) | 281 #elif defined(OS_WIN) |
282 EtwSystemEventConsumer::GetInstance()->StartAgentTracing( | 282 EtwTracingAgent::GetInstance()->StartAgentTracing( |
283 trace_config, | 283 trace_config, |
284 base::Bind(&TracingControllerImpl::OnStartAgentTracingAcked, | 284 base::Bind(&TracingControllerImpl::OnStartAgentTracingAcked, |
285 base::Unretained(this))); | 285 base::Unretained(this))); |
286 ++pending_start_tracing_ack_count_; | 286 ++pending_start_tracing_ack_count_; |
287 #endif | 287 #endif |
288 } | 288 } |
289 | 289 |
290 // TraceLog may have been enabled in startup tracing before threads are ready. | 290 // TraceLog may have been enabled in startup tracing before threads are ready. |
291 if (TraceLog::GetInstance()->IsEnabled()) | 291 if (TraceLog::GetInstance()->IsEnabled()) |
292 return true; | 292 return true; |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 #if defined(OS_CHROMEOS) | 579 #if defined(OS_CHROMEOS) |
580 auto debug_daemon = | 580 auto debug_daemon = |
581 chromeos::DBusThreadManager::Get()->GetDebugDaemonClient(); | 581 chromeos::DBusThreadManager::Get()->GetDebugDaemonClient(); |
582 if (agent_name == debug_daemon->GetTracingAgentName()) { | 582 if (agent_name == debug_daemon->GetTracingAgentName()) { |
583 additional_tracing_agents_.push_back(debug_daemon); | 583 additional_tracing_agents_.push_back(debug_daemon); |
584 debug_daemon->SetStopAgentTracingTaskRunner( | 584 debug_daemon->SetStopAgentTracingTaskRunner( |
585 BrowserThread::GetBlockingPool()); | 585 BrowserThread::GetBlockingPool()); |
586 return; | 586 return; |
587 } | 587 } |
588 #elif defined(OS_WIN) | 588 #elif defined(OS_WIN) |
589 auto etw_agent = EtwSystemEventConsumer::GetInstance(); | 589 auto etw_agent = EtwTracingAgent::GetInstance(); |
590 if (agent_name == etw_agent->GetTracingAgentName()) { | 590 if (agent_name == etw_agent->GetTracingAgentName()) { |
591 additional_tracing_agents_.push_back(etw_agent); | 591 additional_tracing_agents_.push_back(etw_agent); |
592 return; | 592 return; |
593 } | 593 } |
594 #endif | 594 #endif |
595 | 595 |
596 #if defined(ENABLE_POWER_TRACING) | 596 #if defined(ENABLE_POWER_TRACING) |
597 auto power_agent = PowerTracingAgent::GetInstance(); | 597 auto power_agent = PowerTracingAgent::GetInstance(); |
598 if (agent_name == power_agent->GetTracingAgentName()) { | 598 if (agent_name == power_agent->GetTracingAgentName()) { |
599 additional_tracing_agents_.push_back(power_agent); | 599 additional_tracing_agents_.push_back(power_agent); |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1026 const bool global_success = failed_memory_dump_count_ == 0; | 1026 const bool global_success = failed_memory_dump_count_ == 0; |
1027 if (!pending_memory_dump_callback_.is_null()) { | 1027 if (!pending_memory_dump_callback_.is_null()) { |
1028 pending_memory_dump_callback_.Run(pending_memory_dump_guid_, | 1028 pending_memory_dump_callback_.Run(pending_memory_dump_guid_, |
1029 global_success); | 1029 global_success); |
1030 pending_memory_dump_callback_.Reset(); | 1030 pending_memory_dump_callback_.Reset(); |
1031 } | 1031 } |
1032 pending_memory_dump_guid_ = 0; | 1032 pending_memory_dump_guid_ = 0; |
1033 } | 1033 } |
1034 | 1034 |
1035 } // namespace content | 1035 } // namespace content |
OLD | NEW |