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

Side by Side Diff: content/browser/trace_message_filter.cc

Issue 11411118: Add tracing support to NaCl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove content from tracing DEPS Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/trace_message_filter.h" 5 #include "content/browser/trace_message_filter.h"
6 6
7 #include "content/browser/trace_controller_impl.h" 7 #include "content/browser/trace_controller_impl.h"
8 #include "content/common/child_process_messages.h" 8 #include "content/components/tracing/tracing_messages.h"
9 9
10 namespace content { 10 namespace content {
11 11
12 TraceMessageFilter::TraceMessageFilter() : 12 TraceMessageFilter::TraceMessageFilter() :
13 has_child_(false), 13 has_child_(false),
14 is_awaiting_end_ack_(false), 14 is_awaiting_end_ack_(false),
15 is_awaiting_buffer_percent_full_ack_(false) { 15 is_awaiting_buffer_percent_full_ack_(false) {
16 } 16 }
17 17
18 void TraceMessageFilter::OnFilterAdded(IPC::Channel* channel) { 18 void TraceMessageFilter::OnFilterAdded(IPC::Channel* channel) {
(...skipping 14 matching lines...) Expand all
33 33
34 TraceControllerImpl::GetInstance()->RemoveFilter(this); 34 TraceControllerImpl::GetInstance()->RemoveFilter(this);
35 } 35 }
36 } 36 }
37 37
38 bool TraceMessageFilter::OnMessageReceived(const IPC::Message& message, 38 bool TraceMessageFilter::OnMessageReceived(const IPC::Message& message,
39 bool* message_was_ok) { 39 bool* message_was_ok) {
40 // Always on IO thread (BrowserMessageFilter guarantee). 40 // Always on IO thread (BrowserMessageFilter guarantee).
41 bool handled = true; 41 bool handled = true;
42 IPC_BEGIN_MESSAGE_MAP_EX(TraceMessageFilter, message, *message_was_ok) 42 IPC_BEGIN_MESSAGE_MAP_EX(TraceMessageFilter, message, *message_was_ok)
43 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ChildSupportsTracing, 43 IPC_MESSAGE_HANDLER(TracingHostMsg_ChildSupportsTracing,
44 OnChildSupportsTracing) 44 OnChildSupportsTracing)
45 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_EndTracingAck, OnEndTracingAck) 45 IPC_MESSAGE_HANDLER(TracingHostMsg_EndTracingAck, OnEndTracingAck)
46 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_TraceDataCollected, 46 IPC_MESSAGE_HANDLER(TracingHostMsg_TraceDataCollected,
47 OnTraceDataCollected) 47 OnTraceDataCollected)
48 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_TraceNotification, 48 IPC_MESSAGE_HANDLER(TracingHostMsg_TraceNotification,
49 OnTraceNotification) 49 OnTraceNotification)
50 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_TraceBufferPercentFullReply, 50 IPC_MESSAGE_HANDLER(TracingHostMsg_TraceBufferPercentFullReply,
51 OnTraceBufferPercentFullReply) 51 OnTraceBufferPercentFullReply)
52 IPC_MESSAGE_UNHANDLED(handled = false) 52 IPC_MESSAGE_UNHANDLED(handled = false)
53 IPC_END_MESSAGE_MAP_EX() 53 IPC_END_MESSAGE_MAP_EX()
54 return handled; 54 return handled;
55 } 55 }
56 56
57 void TraceMessageFilter::SendBeginTracing( 57 void TraceMessageFilter::SendBeginTracing(
58 const std::vector<std::string>& included_categories, 58 const std::vector<std::string>& included_categories,
59 const std::vector<std::string>& excluded_categories) { 59 const std::vector<std::string>& excluded_categories) {
60 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 60 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
61 Send(new ChildProcessMsg_BeginTracing(included_categories, 61 Send(new TracingMsg_BeginTracing(included_categories,
62 excluded_categories)); 62 excluded_categories,
63 base::TimeTicks::NowFromSystemTraceTime()));
63 } 64 }
64 65
65 void TraceMessageFilter::SendEndTracing() { 66 void TraceMessageFilter::SendEndTracing() {
66 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 67 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
67 DCHECK(!is_awaiting_end_ack_); 68 DCHECK(!is_awaiting_end_ack_);
68 is_awaiting_end_ack_ = true; 69 is_awaiting_end_ack_ = true;
69 Send(new ChildProcessMsg_EndTracing); 70 Send(new TracingMsg_EndTracing);
70 } 71 }
71 72
72 void TraceMessageFilter::SendGetTraceBufferPercentFull() { 73 void TraceMessageFilter::SendGetTraceBufferPercentFull() {
73 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 74 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
74 DCHECK(!is_awaiting_buffer_percent_full_ack_); 75 DCHECK(!is_awaiting_buffer_percent_full_ack_);
75 is_awaiting_buffer_percent_full_ack_ = true; 76 is_awaiting_buffer_percent_full_ack_ = true;
76 Send(new ChildProcessMsg_GetTraceBufferPercentFull); 77 Send(new TracingMsg_GetTraceBufferPercentFull);
77 } 78 }
78 79
79 void TraceMessageFilter::SendSetWatchEvent(const std::string& category_name, 80 void TraceMessageFilter::SendSetWatchEvent(const std::string& category_name,
80 const std::string& event_name) { 81 const std::string& event_name) {
81 Send(new ChildProcessMsg_SetWatchEvent(category_name, event_name)); 82 Send(new TracingMsg_SetWatchEvent(category_name, event_name));
82 } 83 }
83 84
84 void TraceMessageFilter::SendCancelWatchEvent() { 85 void TraceMessageFilter::SendCancelWatchEvent() {
85 Send(new ChildProcessMsg_CancelWatchEvent); 86 Send(new TracingMsg_CancelWatchEvent);
86 } 87 }
87 88
88 TraceMessageFilter::~TraceMessageFilter() {} 89 TraceMessageFilter::~TraceMessageFilter() {}
89 90
90 void TraceMessageFilter::OnChildSupportsTracing() { 91 void TraceMessageFilter::OnChildSupportsTracing() {
91 has_child_ = true; 92 has_child_ = true;
92 TraceControllerImpl::GetInstance()->AddFilter(this); 93 TraceControllerImpl::GetInstance()->AddFilter(this);
93 } 94 }
94 95
95 void TraceMessageFilter::OnEndTracingAck( 96 void TraceMessageFilter::OnEndTracingAck(
(...skipping 22 matching lines...) Expand all
118 if (is_awaiting_buffer_percent_full_ack_) { 119 if (is_awaiting_buffer_percent_full_ack_) {
119 is_awaiting_buffer_percent_full_ack_ = false; 120 is_awaiting_buffer_percent_full_ack_ = false;
120 TraceControllerImpl::GetInstance()->OnTraceBufferPercentFullReply( 121 TraceControllerImpl::GetInstance()->OnTraceBufferPercentFullReply(
121 percent_full); 122 percent_full);
122 } else { 123 } else {
123 NOTREACHED(); 124 NOTREACHED();
124 } 125 }
125 } 126 }
126 127
127 } // namespace content 128 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698