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/browser/tracing/trace_controller_impl.h" | 5 #include "content/browser/tracing/trace_controller_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
11 #include "content/browser/tracing/trace_message_filter.h" | 11 #include "content/browser/tracing/trace_message_filter.h" |
12 #include "content/browser/tracing/trace_subscriber_stdio.h" | 12 #include "content/browser/tracing/trace_subscriber_stdio.h" |
13 #include "content/common/child_process_messages.h" | 13 #include "content/common/child_process_messages.h" |
14 #include "content/public/browser/browser_message_filter.h" | 14 #include "content/public/browser/browser_message_filter.h" |
15 #include "content/public/common/content_switches.h" | 15 #include "content/public/common/content_switches.h" |
16 | 16 |
17 #if defined(OS_CHROMEOS) | |
18 #include "chromeos/dbus/dbus_thread_manager.h" | |
19 #include "chromeos/dbus/debug_daemon_client.h" | |
20 #endif | |
dsinclair
2013/08/20 14:05:26
Is this part of the future cl as well?
DaveMoore
2013/08/20 14:58:00
Done.
| |
21 | |
17 using base::debug::TraceLog; | 22 using base::debug::TraceLog; |
18 | 23 |
19 namespace content { | 24 namespace content { |
20 | 25 |
21 namespace { | 26 namespace { |
22 | 27 |
23 base::LazyInstance<TraceControllerImpl>::Leaky g_controller = | 28 base::LazyInstance<TraceControllerImpl>::Leaky g_controller = |
24 LAZY_INSTANCE_INITIALIZER; | 29 LAZY_INSTANCE_INITIALIZER; |
25 | 30 |
26 class AutoStopTraceSubscriberStdio : public TraceSubscriberStdio { | 31 class AutoStopTraceSubscriberStdio : public TraceSubscriberStdio { |
27 public: | 32 public: |
28 AutoStopTraceSubscriberStdio(const base::FilePath& file_path) | 33 AutoStopTraceSubscriberStdio(const base::FilePath& file_path) |
29 : TraceSubscriberStdio(file_path) {} | 34 : TraceSubscriberStdio(file_path, |
35 FILE_TYPE_PROPERTY_LIST, | |
36 false) {} | |
30 | 37 |
31 static void EndStartupTrace(TraceSubscriberStdio* subscriber) { | 38 static void EndStartupTrace(AutoStopTraceSubscriberStdio* subscriber) { |
32 if (!TraceControllerImpl::GetInstance()->EndTracingAsync(subscriber)) | 39 if (!TraceControllerImpl::GetInstance()->EndTracingAsync(subscriber)) |
33 delete subscriber; | 40 delete subscriber; |
34 // else, the tracing will end asynchronously in OnEndTracingComplete(). | 41 // else, the tracing will end asynchronously in OnEndTracingComplete(). |
35 } | 42 } |
36 | 43 |
37 virtual void OnEndTracingComplete() OVERRIDE { | 44 virtual void OnEndTracingComplete() OVERRIDE { |
38 TraceSubscriberStdio::OnEndTracingComplete(); | 45 TraceSubscriberStdio::OnEndTracingComplete(); |
39 delete this; | 46 delete this; |
40 // TODO(joth): this would be the time to automatically open up | 47 // TODO(joth): this would be the time to automatically open up |
41 // chrome://tracing/ and load up the trace data collected. | 48 // chrome://tracing/ and load up the trace data collected. |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
398 // The last ack represents local trace, so we need to ack it now. Note that | 405 // The last ack represents local trace, so we need to ack it now. Note that |
399 // this code only executes if there were child processes. | 406 // this code only executes if there were child processes. |
400 float bpf = TraceLog::GetInstance()->GetBufferPercentFull(); | 407 float bpf = TraceLog::GetInstance()->GetBufferPercentFull(); |
401 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 408 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
402 base::Bind(&TraceControllerImpl::OnTraceBufferPercentFullReply, | 409 base::Bind(&TraceControllerImpl::OnTraceBufferPercentFullReply, |
403 base::Unretained(this), bpf)); | 410 base::Unretained(this), bpf)); |
404 } | 411 } |
405 } | 412 } |
406 | 413 |
407 } // namespace content | 414 } // namespace content |
OLD | NEW |