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

Unified Diff: components/tracing/child_trace_message_filter.cc

Issue 23556003: Implement about:tracing UI for the sampling profiler (Chromium part) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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_trace_message_filter.h ('k') | components/tracing/tracing_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/tracing/child_trace_message_filter.cc
diff --git a/components/tracing/child_trace_message_filter.cc b/components/tracing/child_trace_message_filter.cc
index 154903a15d0725d6c72aa594165076d4cb5bea72..b875c05416a395581ae0d587efcc503c2c965803 100644
--- a/components/tracing/child_trace_message_filter.cc
+++ b/components/tracing/child_trace_message_filter.cc
@@ -34,6 +34,12 @@ bool ChildTraceMessageFilter::OnMessageReceived(const IPC::Message& message) {
IPC_BEGIN_MESSAGE_MAP(ChildTraceMessageFilter, message)
IPC_MESSAGE_HANDLER(TracingMsg_BeginTracing, OnBeginTracing)
IPC_MESSAGE_HANDLER(TracingMsg_EndTracing, OnEndTracing)
+ IPC_MESSAGE_HANDLER(TracingMsg_BeginContinuousSamplingTracing,
+ OnBeginContinuousSamplingTracing)
+ IPC_MESSAGE_HANDLER(TracingMsg_EndContinuousSamplingTracing,
+ OnEndContinuousSamplingTracing)
+ IPC_MESSAGE_HANDLER(TracingMsg_ShowContinuousSamplingTracing,
+ OnShowContinuousSamplingTracing)
IPC_MESSAGE_HANDLER(TracingMsg_GetTraceBufferPercentFull,
OnGetTraceBufferPercentFull)
IPC_MESSAGE_HANDLER(TracingMsg_SetWatchEvent, OnSetWatchEvent)
@@ -77,6 +83,29 @@ void ChildTraceMessageFilter::OnEndTracing() {
channel_->Send(new TracingHostMsg_EndTracingAck(category_groups));
}
+void ChildTraceMessageFilter::OnBeginContinuousSamplingTracing(
+ base::TimeTicks browser_time) {
+ TraceLog::GetInstance()->SetContinuousSamplingEnabled();
+}
+
+void ChildTraceMessageFilter::OnEndContinuousSamplingTracing() {
+ TraceLog::GetInstance()->SetContinuousSamplingDisabled();
+}
+
+void ChildTraceMessageFilter::OnShowContinuousSamplingTracing() {
+ // Flush will generate one or more callbacks to
+ // OnContinuousSamplingTraceDataCollected. It's important that the last
+ // OnContinuousSamplingTraceDataCollected gets called before
+ // ShowContinuousSamplingTracingAck below. We are already on the IO thread,
+ // so the OnContinuousSamplingTraceDataCollected calls will not be deferred.
+ TraceLog::GetInstance()->FlushContinuousSamplingTracing(
+ base::Bind(&ChildTraceMessageFilter::
+ OnContinuousSamplingTraceDataCollected,
+ this));
+
+ channel_->Send(new TracingHostMsg_ShowContinuousSamplingTracingAck());
+}
+
void ChildTraceMessageFilter::OnGetTraceBufferPercentFull() {
float bpf = TraceLog::GetInstance()->GetBufferPercentFull();
@@ -105,6 +134,20 @@ void ChildTraceMessageFilter::OnTraceDataCollected(
events_str_ptr->data()));
}
+void ChildTraceMessageFilter::OnContinuousSamplingTraceDataCollected(
+ const scoped_refptr<base::RefCountedString>& events_str_ptr) {
+ if (!ipc_message_loop_->BelongsToCurrentThread()) {
+ ipc_message_loop_->PostTask(FROM_HERE,
+ base::Bind(&ChildTraceMessageFilter::
+ OnContinuousSamplingTraceDataCollected,
+ this,
+ events_str_ptr));
+ return;
+ }
+ channel_->Send(new TracingHostMsg_ContinuousSamplingTraceDataCollected(
+ events_str_ptr->data()));
+}
+
void ChildTraceMessageFilter::OnTraceNotification(int notification) {
if (!ipc_message_loop_->BelongsToCurrentThread()) {
ipc_message_loop_->PostTask(FROM_HERE,
« no previous file with comments | « components/tracing/child_trace_message_filter.h ('k') | components/tracing/tracing_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698