OLD | NEW |
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 "ipc/ipc_channel_reader.h" | 5 #include "ipc/ipc_channel_reader.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iostream> |
8 | 9 |
9 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| 11 #include "content/renderer/greenweb_latency_tracking.h" |
10 #include "ipc/ipc_listener.h" | 12 #include "ipc/ipc_listener.h" |
11 #include "ipc/ipc_logging.h" | 13 #include "ipc/ipc_logging.h" |
12 #include "ipc/ipc_message.h" | 14 #include "ipc/ipc_message.h" |
13 #include "ipc/ipc_message_attachment_set.h" | 15 #include "ipc/ipc_message_attachment_set.h" |
14 #include "ipc/ipc_message_macros.h" | 16 #include "ipc/ipc_message_macros.h" |
15 | 17 |
16 namespace IPC { | 18 namespace IPC { |
17 namespace internal { | 19 namespace internal { |
18 | 20 |
19 ChannelReader::ChannelReader(Listener* listener) : listener_(listener) { | 21 ChannelReader::ChannelReader(Listener* listener) : listener_(listener) { |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 } | 202 } |
201 | 203 |
202 void ChannelReader::EmitLogBeforeDispatch(const Message& message) { | 204 void ChannelReader::EmitLogBeforeDispatch(const Message& message) { |
203 #ifdef IPC_MESSAGE_LOG_ENABLED | 205 #ifdef IPC_MESSAGE_LOG_ENABLED |
204 std::string name; | 206 std::string name; |
205 Logging::GetInstance()->GetMessageText(message.type(), &name, &message, NULL); | 207 Logging::GetInstance()->GetMessageText(message.type(), &name, &message, NULL); |
206 TRACE_EVENT_WITH_FLOW1("ipc,toplevel", "ChannelReader::DispatchInputData", | 208 TRACE_EVENT_WITH_FLOW1("ipc,toplevel", "ChannelReader::DispatchInputData", |
207 message.flags(), TRACE_EVENT_FLAG_FLOW_IN, "name", | 209 message.flags(), TRACE_EVENT_FLAG_FLOW_IN, "name", |
208 name); | 210 name); |
209 #else | 211 #else |
210 TRACE_EVENT_WITH_FLOW2("ipc,toplevel", "ChannelReader::DispatchInputData", | 212 TRACE_EVENT_WITH_FLOW1("ipc,toplevel", "ChannelReader::DispatchInputData", |
211 message.flags(), TRACE_EVENT_FLAG_FLOW_IN, "class", | 213 message.flags(), TRACE_EVENT_FLAG_FLOW_IN, "QoS Type", |
212 IPC_MESSAGE_ID_CLASS(message.type()), "line", | 214 message.qos_type()); |
213 IPC_MESSAGE_ID_LINE(message.type())); | |
214 #endif | 215 #endif |
| 216 // The info of the main renderer thread can't be overwritten! |
| 217 // This is because in the current implementation we send the ebs_enable and qo
s_type |
| 218 // info along with every IPC message. So it's possible that the GPU process
sends |
| 219 // a default ebs_enabled value that overwrites the value that is already cor
rectly |
| 220 // set in the main renderer thread. |
| 221 if (base::trace_event::TraceLog::GetInstance()->GetProcessName() != "Renderer"
) { |
| 222 g_qos_type = message.qos_type(); |
| 223 g_qos_target = message.qos_target(); |
| 224 g_ebs_enabled = message.ebs_enabled(); |
| 225 } |
| 226 dbg_ipc_cout("Receive" << ": g_ebs_enabled: " << g_ebs_enabled << |
| 227 ", g_qos_type: " << g_qos_type << |
| 228 ", g_qos_target" << g_qos_target); |
215 } | 229 } |
216 | 230 |
217 bool ChannelReader::DispatchAttachmentBrokerMessage(const Message& message) { | 231 bool ChannelReader::DispatchAttachmentBrokerMessage(const Message& message) { |
218 #if USE_ATTACHMENT_BROKER | 232 #if USE_ATTACHMENT_BROKER |
219 if (IsAttachmentBrokerEndpoint() && GetAttachmentBroker()) { | 233 if (IsAttachmentBrokerEndpoint() && GetAttachmentBroker()) { |
220 return GetAttachmentBroker()->OnMessageReceived(message); | 234 return GetAttachmentBroker()->OnMessageReceived(message); |
221 } | 235 } |
222 #endif // USE_ATTACHMENT_BROKER | 236 #endif // USE_ATTACHMENT_BROKER |
223 | 237 |
224 return false; | 238 return false; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 if (size <= Channel::kMaximumMessageSize) { | 317 if (size <= Channel::kMaximumMessageSize) { |
304 return true; | 318 return true; |
305 } | 319 } |
306 input_overflow_buf_.clear(); | 320 input_overflow_buf_.clear(); |
307 LOG(ERROR) << "IPC message is too big: " << size; | 321 LOG(ERROR) << "IPC message is too big: " << size; |
308 return false; | 322 return false; |
309 } | 323 } |
310 | 324 |
311 } // namespace internal | 325 } // namespace internal |
312 } // namespace IPC | 326 } // namespace IPC |
OLD | NEW |