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

Unified Diff: content/browser/tracing/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 | « content/browser/tracing/trace_message_filter.h ('k') | content/browser/tracing/tracing_ui.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/tracing/trace_message_filter.cc
diff --git a/content/browser/tracing/trace_message_filter.cc b/content/browser/tracing/trace_message_filter.cc
index e75d786142d90307958bba370a3456efc0f52e66..e250ef16c12a744aff04d6449137f892e2487f68 100644
--- a/content/browser/tracing/trace_message_filter.cc
+++ b/content/browser/tracing/trace_message_filter.cc
@@ -12,6 +12,7 @@ namespace content {
TraceMessageFilter::TraceMessageFilter() :
has_child_(false),
is_awaiting_end_ack_(false),
+ is_awaiting_continuous_sampling_ack_(false),
is_awaiting_buffer_percent_full_ack_(false) {
}
@@ -28,6 +29,9 @@ void TraceMessageFilter::OnChannelClosing() {
if (is_awaiting_end_ack_)
OnEndTracingAck(std::vector<std::string>());
+ if (is_awaiting_continuous_sampling_ack_)
+ OnShowContinuousSamplingTracingAck();
+
if (is_awaiting_buffer_percent_full_ack_)
OnTraceBufferPercentFullReply(0.0f);
@@ -43,8 +47,12 @@ bool TraceMessageFilter::OnMessageReceived(const IPC::Message& message,
IPC_MESSAGE_HANDLER(TracingHostMsg_ChildSupportsTracing,
OnChildSupportsTracing)
IPC_MESSAGE_HANDLER(TracingHostMsg_EndTracingAck, OnEndTracingAck)
+ IPC_MESSAGE_HANDLER(TracingHostMsg_ShowContinuousSamplingTracingAck,
+ OnShowContinuousSamplingTracingAck)
IPC_MESSAGE_HANDLER(TracingHostMsg_TraceDataCollected,
OnTraceDataCollected)
+ IPC_MESSAGE_HANDLER(TracingHostMsg_ContinuousSamplingTraceDataCollected,
+ OnContinuousSamplingTraceDataCollected)
IPC_MESSAGE_HANDLER(TracingHostMsg_TraceNotification,
OnTraceNotification)
IPC_MESSAGE_HANDLER(TracingHostMsg_TraceBufferPercentFullReply,
@@ -70,6 +78,24 @@ void TraceMessageFilter::SendEndTracing() {
Send(new TracingMsg_EndTracing);
}
+void TraceMessageFilter::SendBeginContinuousSamplingTracing() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ Send(new TracingMsg_BeginContinuousSamplingTracing(
+ base::TimeTicks::NowFromSystemTraceTime()));
+}
+
+void TraceMessageFilter::SendEndContinuousSamplingTracing() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ Send(new TracingMsg_EndContinuousSamplingTracing);
+}
+
+void TraceMessageFilter::SendShowContinuousSamplingTracing() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK(!is_awaiting_continuous_sampling_ack_);
+ is_awaiting_continuous_sampling_ack_ = true;
+ Send(new TracingMsg_ShowContinuousSamplingTracing);
+}
+
void TraceMessageFilter::SendGetTraceBufferPercentFull() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!is_awaiting_buffer_percent_full_ack_);
@@ -105,12 +131,31 @@ void TraceMessageFilter::OnEndTracingAck(
}
}
+void TraceMessageFilter::OnShowContinuousSamplingTracingAck() {
+ // is_awaiting_continuous_sampling_ack_ should always be true here,
+ // but check in case the child process is compromised.
+ if (is_awaiting_continuous_sampling_ack_) {
+ is_awaiting_continuous_sampling_ack_ = false;
+ TraceControllerImpl::GetInstance()->OnShowContinuousSamplingTracingAck();
+ } else {
+ NOTREACHED();
+ }
+}
+
void TraceMessageFilter::OnTraceDataCollected(const std::string& data) {
scoped_refptr<base::RefCountedString> data_ptr(new base::RefCountedString());
data_ptr->data() = data;
TraceControllerImpl::GetInstance()->OnTraceDataCollected(data_ptr);
}
+void TraceMessageFilter::OnContinuousSamplingTraceDataCollected(
+ const std::string& data) {
+ scoped_refptr<base::RefCountedString> data_ptr(new base::RefCountedString());
+ data_ptr->data() = data;
+ TraceControllerImpl::GetInstance()->
+ OnContinuousSamplingTraceDataCollected(data_ptr);
+}
+
void TraceMessageFilter::OnTraceNotification(int notification) {
TraceControllerImpl::GetInstance()->OnTraceNotification(notification);
}
« no previous file with comments | « content/browser/tracing/trace_message_filter.h ('k') | content/browser/tracing/tracing_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698