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

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

Issue 2724793002: Revert of memory-infra: Finish moving memory_infra from TracingController (Closed)
Patch Set: 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)
49 IPC_MESSAGE_HANDLER(TracingHostMsg_TriggerBackgroundTrace, 53 IPC_MESSAGE_HANDLER(TracingHostMsg_TriggerBackgroundTrace,
50 OnTriggerBackgroundTrace) 54 OnTriggerBackgroundTrace)
51 IPC_MESSAGE_HANDLER(TracingHostMsg_AbortBackgroundTrace, 55 IPC_MESSAGE_HANDLER(TracingHostMsg_AbortBackgroundTrace,
52 OnAbortBackgroundTrace) 56 OnAbortBackgroundTrace)
53 IPC_MESSAGE_UNHANDLED(handled = false) 57 IPC_MESSAGE_UNHANDLED(handled = false)
54 IPC_END_MESSAGE_MAP() 58 IPC_END_MESSAGE_MAP()
55 return handled; 59 return handled;
56 } 60 }
57 61
58 void TraceMessageFilter::SendBeginTracing( 62 void TraceMessageFilter::SendBeginTracing(
(...skipping 17 matching lines...) Expand all
76 Send(new TracingMsg_CancelTracing); 80 Send(new TracingMsg_CancelTracing);
77 } 81 }
78 82
79 void TraceMessageFilter::SendGetTraceLogStatus() { 83 void TraceMessageFilter::SendGetTraceLogStatus() {
80 DCHECK_CURRENTLY_ON(BrowserThread::UI); 84 DCHECK_CURRENTLY_ON(BrowserThread::UI);
81 DCHECK(!is_awaiting_buffer_percent_full_ack_); 85 DCHECK(!is_awaiting_buffer_percent_full_ack_);
82 is_awaiting_buffer_percent_full_ack_ = true; 86 is_awaiting_buffer_percent_full_ack_ = true;
83 Send(new TracingMsg_GetTraceLogStatus); 87 Send(new TracingMsg_GetTraceLogStatus);
84 } 88 }
85 89
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
86 void TraceMessageFilter::OnChildSupportsTracing() { 102 void TraceMessageFilter::OnChildSupportsTracing() {
87 has_child_ = true; 103 has_child_ = true;
88 TracingControllerImpl::GetInstance()->AddTraceMessageFilter(this); 104 TracingControllerImpl::GetInstance()->AddTraceMessageFilter(this);
89 } 105 }
90 106
91 void TraceMessageFilter::OnEndTracingAck( 107 void TraceMessageFilter::OnEndTracingAck(
92 const std::vector<std::string>& known_categories) { 108 const std::vector<std::string>& known_categories) {
93 // is_awaiting_end_ack_ should always be true here, but check in case the 109 // is_awaiting_end_ack_ should always be true here, but check in case the
94 // child process is compromised. 110 // child process is compromised.
95 if (is_awaiting_end_ack_) { 111 if (is_awaiting_end_ack_) {
(...skipping 14 matching lines...) Expand all
110 void TraceMessageFilter::OnTraceLogStatusReply( 126 void TraceMessageFilter::OnTraceLogStatusReply(
111 const base::trace_event::TraceLogStatus& status) { 127 const base::trace_event::TraceLogStatus& status) {
112 if (is_awaiting_buffer_percent_full_ack_) { 128 if (is_awaiting_buffer_percent_full_ack_) {
113 is_awaiting_buffer_percent_full_ack_ = false; 129 is_awaiting_buffer_percent_full_ack_ = false;
114 TracingControllerImpl::GetInstance()->OnTraceLogStatusReply(this, status); 130 TracingControllerImpl::GetInstance()->OnTraceLogStatusReply(this, status);
115 } else { 131 } else {
116 NOTREACHED(); 132 NOTREACHED();
117 } 133 }
118 } 134 }
119 135
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
120 void TraceMessageFilter::OnTriggerBackgroundTrace(const std::string& name) { 149 void TraceMessageFilter::OnTriggerBackgroundTrace(const std::string& name) {
121 BackgroundTracingManagerImpl::GetInstance()->OnHistogramTrigger(name); 150 BackgroundTracingManagerImpl::GetInstance()->OnHistogramTrigger(name);
122 } 151 }
123 152
124 void TraceMessageFilter::OnAbortBackgroundTrace() { 153 void TraceMessageFilter::OnAbortBackgroundTrace() {
125 BackgroundTracingManagerImpl::GetInstance()->AbortScenario(); 154 BackgroundTracingManagerImpl::GetInstance()->AbortScenario();
126 } 155 }
127 156
128 } // namespace content 157 } // 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