| 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 "components/tracing/child_trace_message_filter.h" | 5 #include "components/tracing/child_trace_message_filter.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/message_loop_proxy.h" | 8 #include "base/message_loop_proxy.h" |
| 9 #include "components/tracing/tracing_messages.h" | 9 #include "components/tracing/tracing_messages.h" |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 IPC_MESSAGE_UNHANDLED(handled = false) | 41 IPC_MESSAGE_UNHANDLED(handled = false) |
| 42 IPC_END_MESSAGE_MAP() | 42 IPC_END_MESSAGE_MAP() |
| 43 return handled; | 43 return handled; |
| 44 } | 44 } |
| 45 | 45 |
| 46 ChildTraceMessageFilter::~ChildTraceMessageFilter() {} | 46 ChildTraceMessageFilter::~ChildTraceMessageFilter() {} |
| 47 | 47 |
| 48 void ChildTraceMessageFilter::OnBeginTracing( | 48 void ChildTraceMessageFilter::OnBeginTracing( |
| 49 const std::vector<std::string>& included_categories, | 49 const std::vector<std::string>& included_categories, |
| 50 const std::vector<std::string>& excluded_categories, | 50 const std::vector<std::string>& excluded_categories, |
| 51 base::TimeTicks browser_time) { | 51 base::TimeTicks browser_time, |
| 52 int options) { |
| 52 #if defined(__native_client__) | 53 #if defined(__native_client__) |
| 53 // NaCl and system times are offset by a bit, so subtract some time from | 54 // NaCl and system times are offset by a bit, so subtract some time from |
| 54 // the captured timestamps. The value might be off by a bit due to messaging | 55 // the captured timestamps. The value might be off by a bit due to messaging |
| 55 // latency. | 56 // latency. |
| 56 base::TimeDelta time_offset = base::TimeTicks::NowFromSystemTraceTime() - | 57 base::TimeDelta time_offset = base::TimeTicks::NowFromSystemTraceTime() - |
| 57 browser_time; | 58 browser_time; |
| 58 TraceLog::GetInstance()->SetTimeOffset(time_offset); | 59 TraceLog::GetInstance()->SetTimeOffset(time_offset); |
| 59 #endif | 60 #endif |
| 60 TraceLog::GetInstance()->SetEnabled(included_categories, | 61 TraceLog::GetInstance()->SetEnabled( |
| 61 excluded_categories); | 62 included_categories, |
| 63 excluded_categories, |
| 64 static_cast<base::debug::TraceLog::Options>(options)); |
| 62 } | 65 } |
| 63 | 66 |
| 64 void ChildTraceMessageFilter::OnEndTracing() { | 67 void ChildTraceMessageFilter::OnEndTracing() { |
| 65 TraceLog::GetInstance()->SetDisabled(); | 68 TraceLog::GetInstance()->SetDisabled(); |
| 66 | 69 |
| 67 // Flush will generate one or more callbacks to OnTraceDataCollected. It's | 70 // Flush will generate one or more callbacks to OnTraceDataCollected. It's |
| 68 // important that the last OnTraceDataCollected gets called before | 71 // important that the last OnTraceDataCollected gets called before |
| 69 // EndTracingAck below. We are already on the IO thread, so the | 72 // EndTracingAck below. We are already on the IO thread, so the |
| 70 // OnTraceDataCollected calls will not be deferred. | 73 // OnTraceDataCollected calls will not be deferred. |
| 71 TraceLog::GetInstance()->Flush( | 74 TraceLog::GetInstance()->Flush( |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 if (!ipc_message_loop_->BelongsToCurrentThread()) { | 111 if (!ipc_message_loop_->BelongsToCurrentThread()) { |
| 109 ipc_message_loop_->PostTask(FROM_HERE, | 112 ipc_message_loop_->PostTask(FROM_HERE, |
| 110 base::Bind(&ChildTraceMessageFilter::OnTraceNotification, this, | 113 base::Bind(&ChildTraceMessageFilter::OnTraceNotification, this, |
| 111 notification)); | 114 notification)); |
| 112 return; | 115 return; |
| 113 } | 116 } |
| 114 channel_->Send(new TracingHostMsg_TraceNotification(notification)); | 117 channel_->Send(new TracingHostMsg_TraceNotification(notification)); |
| 115 } | 118 } |
| 116 | 119 |
| 117 } // namespace components | 120 } // namespace components |
| OLD | NEW |