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/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/json/string_escape.h" | 8 #include "base/json/string_escape.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
11 #include "base/trace_event/trace_event.h" | 11 #include "base/trace_event/trace_event.h" |
12 #include "content/browser/tracing/trace_message_filter.h" | 12 #include "content/browser/tracing/trace_message_filter.h" |
13 #include "content/browser/tracing/tracing_ui.h" | 13 #include "content/browser/tracing/tracing_ui.h" |
14 #include "content/common/child_process_messages.h" | 14 #include "content/common/child_process_messages.h" |
15 #include "content/public/browser/browser_message_filter.h" | 15 #include "content/public/browser/browser_message_filter.h" |
16 #include "content/public/common/content_switches.h" | 16 #include "content/public/common/content_switches.h" |
| 17 #include "third_party/zlib/zlib.h" |
17 | 18 |
18 #if defined(OS_CHROMEOS) | 19 #if defined(OS_CHROMEOS) |
19 #include "chromeos/dbus/dbus_thread_manager.h" | 20 #include "chromeos/dbus/dbus_thread_manager.h" |
20 #include "chromeos/dbus/debug_daemon_client.h" | 21 #include "chromeos/dbus/debug_daemon_client.h" |
21 #endif | 22 #endif |
22 | 23 |
23 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
24 #include "content/browser/tracing/etw_system_event_consumer_win.h" | 25 #include "content/browser/tracing/etw_system_event_consumer_win.h" |
25 #endif | 26 #endif |
26 | 27 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 146 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
146 base::Bind(&TracingControllerImpl::SetEnabledOnFileThread, | 147 base::Bind(&TracingControllerImpl::SetEnabledOnFileThread, |
147 base::Unretained(this), | 148 base::Unretained(this), |
148 category_filter, | 149 category_filter, |
149 base::trace_event::TraceLog::RECORDING_MODE, | 150 base::trace_event::TraceLog::RECORDING_MODE, |
150 trace_options, | 151 trace_options, |
151 on_enable_recording_done_callback)); | 152 on_enable_recording_done_callback)); |
152 return true; | 153 return true; |
153 } | 154 } |
154 | 155 |
| 156 bool TracingControllerImpl::IsRecordingEnabled() const { |
| 157 return is_recording_; |
| 158 } |
| 159 |
155 void TracingControllerImpl::OnEnableRecordingDone( | 160 void TracingControllerImpl::OnEnableRecordingDone( |
156 const CategoryFilter& category_filter, | 161 const CategoryFilter& category_filter, |
157 const TraceOptions& trace_options, | 162 const TraceOptions& trace_options, |
158 const EnableRecordingDoneCallback& callback) { | 163 const EnableRecordingDoneCallback& callback) { |
159 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 164 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
160 | 165 |
161 // Notify all child processes. | 166 // Notify all child processes. |
162 for (TraceMessageFilterSet::iterator it = trace_message_filters_.begin(); | 167 for (TraceMessageFilterSet::iterator it = trace_message_filters_.begin(); |
163 it != trace_message_filters_.end(); ++it) { | 168 it != trace_message_filters_.end(); ++it) { |
164 it->get()->SendBeginTracing(category_filter, trace_options); | 169 it->get()->SendBeginTracing(category_filter, trace_options); |
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 is_monitoring_ = is_monitoring; | 875 is_monitoring_ = is_monitoring; |
871 #if !defined(OS_ANDROID) | 876 #if !defined(OS_ANDROID) |
872 for (std::set<TracingUI*>::iterator it = tracing_uis_.begin(); | 877 for (std::set<TracingUI*>::iterator it = tracing_uis_.begin(); |
873 it != tracing_uis_.end(); it++) { | 878 it != tracing_uis_.end(); it++) { |
874 (*it)->OnMonitoringStateChanged(is_monitoring); | 879 (*it)->OnMonitoringStateChanged(is_monitoring); |
875 } | 880 } |
876 #endif | 881 #endif |
877 } | 882 } |
878 | 883 |
879 } // namespace content | 884 } // namespace content |
OLD | NEW |