Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Unified Diff: components/tracing/child/child_trace_message_filter.cc

Issue 2833873003: WIP: The tracing service prototype
Patch Set: sync Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/tracing/child/child_trace_message_filter.h ('k') | content/browser/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/tracing/child/child_trace_message_filter.cc
diff --git a/components/tracing/child/child_trace_message_filter.cc b/components/tracing/child/child_trace_message_filter.cc
index ce9c86f75f6ad48325a7445dc0b63e20016488eb..d32f2833214d2bc6669d3f8f2b211994e7ac18e9 100644
--- a/components/tracing/child/child_trace_message_filter.cc
+++ b/components/tracing/child/child_trace_message_filter.cc
@@ -27,9 +27,7 @@ const int kMinTimeBetweenHistogramChangesInSeconds = 10;
ChildTraceMessageFilter::ChildTraceMessageFilter(
base::SingleThreadTaskRunner* ipc_task_runner)
- : enabled_tracing_modes_(0),
- sender_(NULL),
- ipc_task_runner_(ipc_task_runner) {}
+ : sender_(NULL), ipc_task_runner_(ipc_task_runner) {}
void ChildTraceMessageFilter::OnFilterAdded(IPC::Channel* channel) {
sender_ = channel;
@@ -54,10 +52,6 @@ void ChildTraceMessageFilter::OnFilterRemoved() {
bool ChildTraceMessageFilter::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(ChildTraceMessageFilter, message)
- IPC_MESSAGE_HANDLER(TracingMsg_BeginTracing, OnBeginTracing)
- IPC_MESSAGE_HANDLER(TracingMsg_EndTracing, OnEndTracing)
- IPC_MESSAGE_HANDLER(TracingMsg_CancelTracing, OnCancelTracing)
- IPC_MESSAGE_HANDLER(TracingMsg_GetTraceLogStatus, OnGetTraceLogStatus)
IPC_MESSAGE_HANDLER(TracingMsg_SetUMACallback, OnSetUMACallback)
IPC_MESSAGE_HANDLER(TracingMsg_ClearUMACallback, OnClearUMACallback)
IPC_MESSAGE_UNHANDLED(handled = false)
@@ -67,71 +61,6 @@ bool ChildTraceMessageFilter::OnMessageReceived(const IPC::Message& message) {
ChildTraceMessageFilter::~ChildTraceMessageFilter() {}
-void ChildTraceMessageFilter::OnBeginTracing(
- const std::string& trace_config_str,
- base::TimeTicks browser_time,
- uint64_t tracing_process_id) {
-#if defined(__native_client__)
- // NaCl and system times are offset by a bit, so subtract some time from
- // the captured timestamps. The value might be off by a bit due to messaging
- // latency.
- base::TimeDelta time_offset = base::TimeTicks::Now() - browser_time;
- TraceLog::GetInstance()->SetTimeOffset(time_offset);
-#endif
- MemoryDumpManager::GetInstance()->set_tracing_process_id(tracing_process_id);
- const base::trace_event::TraceConfig trace_config(trace_config_str);
- enabled_tracing_modes_ = base::trace_event::TraceLog::RECORDING_MODE;
- if (!trace_config.event_filters().empty())
- enabled_tracing_modes_ |= base::trace_event::TraceLog::FILTERING_MODE;
- TraceLog::GetInstance()->SetEnabled(trace_config, enabled_tracing_modes_);
-}
-
-void ChildTraceMessageFilter::OnEndTracing() {
- DCHECK(enabled_tracing_modes_);
- TraceLog::GetInstance()->SetDisabled(enabled_tracing_modes_);
- enabled_tracing_modes_ = 0;
-
- // Flush will generate one or more callbacks to OnTraceDataCollected
- // synchronously or asynchronously. EndTracingAck will be sent in the last
- // OnTraceDataCollected. We are already on the IO thread, so the
- // OnTraceDataCollected calls will not be deferred.
- TraceLog::GetInstance()->Flush(
- base::Bind(&ChildTraceMessageFilter::OnTraceDataCollected, this));
-
- MemoryDumpManager::GetInstance()->set_tracing_process_id(
- MemoryDumpManager::kInvalidTracingProcessId);
-}
-
-void ChildTraceMessageFilter::OnCancelTracing() {
- TraceLog::GetInstance()->CancelTracing(
- base::Bind(&ChildTraceMessageFilter::OnTraceDataCollected, this));
-}
-
-void ChildTraceMessageFilter::OnGetTraceLogStatus() {
- sender_->Send(new TracingHostMsg_TraceLogStatusReply(
- TraceLog::GetInstance()->GetStatus()));
-}
-
-void ChildTraceMessageFilter::OnTraceDataCollected(
- const scoped_refptr<base::RefCountedString>& events_str_ptr,
- bool has_more_events) {
- if (!ipc_task_runner_->BelongsToCurrentThread()) {
- ipc_task_runner_->PostTask(
- FROM_HERE, base::Bind(&ChildTraceMessageFilter::OnTraceDataCollected,
- this, events_str_ptr, has_more_events));
- return;
- }
- if (events_str_ptr->data().size()) {
- sender_->Send(new TracingHostMsg_TraceDataCollected(
- events_str_ptr->data()));
- }
- if (!has_more_events) {
- std::vector<std::string> category_groups;
- TraceLog::GetInstance()->GetKnownCategoryGroups(&category_groups);
- sender_->Send(new TracingHostMsg_EndTracingAck(category_groups));
- }
-}
-
void ChildTraceMessageFilter::OnHistogramChanged(
const std::string& histogram_name,
base::Histogram::Sample reference_lower_value,
« no previous file with comments | « components/tracing/child/child_trace_message_filter.h ('k') | content/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698