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

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

Issue 2694083005: memory-infra: Finish moving memory_infra from TracingController (Closed)
Patch Set: style: auto must not deduce to raw pointer Created 3 years, 9 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 unified diff | Download patch
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/tracing/trace_message_filter.h" 5 #include "content/browser/tracing/trace_message_filter.h"
6 6
7 #include "components/tracing/common/tracing_messages.h" 7 #include "components/tracing/common/tracing_messages.h"
8 #include "content/browser/tracing/background_tracing_manager_impl.h" 8 #include "content/browser/tracing/background_tracing_manager_impl.h"
9 #include "content/browser/tracing/tracing_controller_impl.h" 9 #include "content/browser/tracing/tracing_controller_impl.h"
10 #include "content/common/child_process_host_impl.h" 10 #include "content/common/child_process_host_impl.h"
(...skipping 28 matching lines...) Expand all
39 // Always on IO thread (BrowserMessageFilter guarantee). 39 // Always on IO thread (BrowserMessageFilter guarantee).
40 bool handled = true; 40 bool handled = true;
41 IPC_BEGIN_MESSAGE_MAP(TraceMessageFilter, message) 41 IPC_BEGIN_MESSAGE_MAP(TraceMessageFilter, message)
42 IPC_MESSAGE_HANDLER(TracingHostMsg_ChildSupportsTracing, 42 IPC_MESSAGE_HANDLER(TracingHostMsg_ChildSupportsTracing,
43 OnChildSupportsTracing) 43 OnChildSupportsTracing)
44 IPC_MESSAGE_HANDLER(TracingHostMsg_EndTracingAck, OnEndTracingAck) 44 IPC_MESSAGE_HANDLER(TracingHostMsg_EndTracingAck, OnEndTracingAck)
45 IPC_MESSAGE_HANDLER(TracingHostMsg_TraceDataCollected, 45 IPC_MESSAGE_HANDLER(TracingHostMsg_TraceDataCollected,
46 OnTraceDataCollected) 46 OnTraceDataCollected)
47 IPC_MESSAGE_HANDLER(TracingHostMsg_TraceLogStatusReply, 47 IPC_MESSAGE_HANDLER(TracingHostMsg_TraceLogStatusReply,
48 OnTraceLogStatusReply) 48 OnTraceLogStatusReply)
49 IPC_MESSAGE_HANDLER(TracingHostMsg_GlobalMemoryDumpRequest,
50 OnGlobalMemoryDumpRequest)
51 IPC_MESSAGE_HANDLER(TracingHostMsg_ProcessMemoryDumpResponse,
52 OnProcessMemoryDumpResponse)
53 IPC_MESSAGE_HANDLER(TracingHostMsg_TriggerBackgroundTrace, 49 IPC_MESSAGE_HANDLER(TracingHostMsg_TriggerBackgroundTrace,
54 OnTriggerBackgroundTrace) 50 OnTriggerBackgroundTrace)
55 IPC_MESSAGE_HANDLER(TracingHostMsg_AbortBackgroundTrace, 51 IPC_MESSAGE_HANDLER(TracingHostMsg_AbortBackgroundTrace,
56 OnAbortBackgroundTrace) 52 OnAbortBackgroundTrace)
57 IPC_MESSAGE_UNHANDLED(handled = false) 53 IPC_MESSAGE_UNHANDLED(handled = false)
58 IPC_END_MESSAGE_MAP() 54 IPC_END_MESSAGE_MAP()
59 return handled; 55 return handled;
60 } 56 }
61 57
62 void TraceMessageFilter::SendBeginTracing( 58 void TraceMessageFilter::SendBeginTracing(
(...skipping 17 matching lines...) Expand all
80 Send(new TracingMsg_CancelTracing); 76 Send(new TracingMsg_CancelTracing);
81 } 77 }
82 78
83 void TraceMessageFilter::SendGetTraceLogStatus() { 79 void TraceMessageFilter::SendGetTraceLogStatus() {
84 DCHECK_CURRENTLY_ON(BrowserThread::UI); 80 DCHECK_CURRENTLY_ON(BrowserThread::UI);
85 DCHECK(!is_awaiting_buffer_percent_full_ack_); 81 DCHECK(!is_awaiting_buffer_percent_full_ack_);
86 is_awaiting_buffer_percent_full_ack_ = true; 82 is_awaiting_buffer_percent_full_ack_ = true;
87 Send(new TracingMsg_GetTraceLogStatus); 83 Send(new TracingMsg_GetTraceLogStatus);
88 } 84 }
89 85
90 // Called by TracingControllerImpl, which handles the multiprocess coordination.
91 void TraceMessageFilter::SendProcessMemoryDumpRequest(
92 const base::trace_event::MemoryDumpRequestArgs& args) {
93 Send(new TracingMsg_ProcessMemoryDumpRequest(args));
94 }
95
96 // Called by TracingControllerImpl, which handles the multiprocess coordination.
97 void TraceMessageFilter::SendGlobalMemoryDumpResponse(uint64_t dump_guid,
98 bool success) {
99 Send(new TracingMsg_GlobalMemoryDumpResponse(dump_guid, success));
100 }
101
102 void TraceMessageFilter::OnChildSupportsTracing() { 86 void TraceMessageFilter::OnChildSupportsTracing() {
103 has_child_ = true; 87 has_child_ = true;
104 TracingControllerImpl::GetInstance()->AddTraceMessageFilter(this); 88 TracingControllerImpl::GetInstance()->AddTraceMessageFilter(this);
105 } 89 }
106 90
107 void TraceMessageFilter::OnEndTracingAck( 91 void TraceMessageFilter::OnEndTracingAck(
108 const std::vector<std::string>& known_categories) { 92 const std::vector<std::string>& known_categories) {
109 // is_awaiting_end_ack_ should always be true here, but check in case the 93 // is_awaiting_end_ack_ should always be true here, but check in case the
110 // child process is compromised. 94 // child process is compromised.
111 if (is_awaiting_end_ack_) { 95 if (is_awaiting_end_ack_) {
(...skipping 14 matching lines...) Expand all
126 void TraceMessageFilter::OnTraceLogStatusReply( 110 void TraceMessageFilter::OnTraceLogStatusReply(
127 const base::trace_event::TraceLogStatus& status) { 111 const base::trace_event::TraceLogStatus& status) {
128 if (is_awaiting_buffer_percent_full_ack_) { 112 if (is_awaiting_buffer_percent_full_ack_) {
129 is_awaiting_buffer_percent_full_ack_ = false; 113 is_awaiting_buffer_percent_full_ack_ = false;
130 TracingControllerImpl::GetInstance()->OnTraceLogStatusReply(this, status); 114 TracingControllerImpl::GetInstance()->OnTraceLogStatusReply(this, status);
131 } else { 115 } else {
132 NOTREACHED(); 116 NOTREACHED();
133 } 117 }
134 } 118 }
135 119
136 void TraceMessageFilter::OnGlobalMemoryDumpRequest(
137 const base::trace_event::MemoryDumpRequestArgs& args) {
138 TracingControllerImpl::GetInstance()->RequestGlobalMemoryDump(
139 args,
140 base::Bind(&TraceMessageFilter::SendGlobalMemoryDumpResponse, this));
141 }
142
143 void TraceMessageFilter::OnProcessMemoryDumpResponse(uint64_t dump_guid,
144 bool success) {
145 TracingControllerImpl::GetInstance()->OnProcessMemoryDumpResponse(
146 this, dump_guid, success);
147 }
148
149 void TraceMessageFilter::OnTriggerBackgroundTrace(const std::string& name) { 120 void TraceMessageFilter::OnTriggerBackgroundTrace(const std::string& name) {
150 BackgroundTracingManagerImpl::GetInstance()->OnHistogramTrigger(name); 121 BackgroundTracingManagerImpl::GetInstance()->OnHistogramTrigger(name);
151 } 122 }
152 123
153 void TraceMessageFilter::OnAbortBackgroundTrace() { 124 void TraceMessageFilter::OnAbortBackgroundTrace() {
154 BackgroundTracingManagerImpl::GetInstance()->AbortScenario(); 125 BackgroundTracingManagerImpl::GetInstance()->AbortScenario();
155 } 126 }
156 127
157 } // namespace content 128 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/tracing/trace_message_filter.h ('k') | content/browser/tracing/tracing_controller_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698