| 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 "ipc/ipc_listener.h" | 7 #include "ipc/ipc_listener.h" |
| 8 #include "ipc/ipc_logging.h" | 8 #include "ipc/ipc_logging.h" |
| 9 #include "ipc/ipc_message_macros.h" | 9 #include "ipc/ipc_message_macros.h" |
| 10 | 10 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 if (message_tail) { | 76 if (message_tail) { |
| 77 int len = static_cast<int>(message_tail - p); | 77 int len = static_cast<int>(message_tail - p); |
| 78 Message m(p, len); | 78 Message m(p, len); |
| 79 if (!WillDispatchInputMessage(&m)) | 79 if (!WillDispatchInputMessage(&m)) |
| 80 return false; | 80 return false; |
| 81 | 81 |
| 82 #ifdef IPC_MESSAGE_LOG_ENABLED | 82 #ifdef IPC_MESSAGE_LOG_ENABLED |
| 83 Logging* logger = Logging::GetInstance(); | 83 Logging* logger = Logging::GetInstance(); |
| 84 std::string name; | 84 std::string name; |
| 85 logger->GetMessageText(m.type(), &name, &m, NULL); | 85 logger->GetMessageText(m.type(), &name, &m, NULL); |
| 86 TRACE_EVENT1("toplevel", "ChannelReader::DispatchInputData", | 86 TRACE_EVENT1("ipc,toplevel", "ChannelReader::DispatchInputData", |
| 87 "name", name); | 87 "name", name); |
| 88 #else | 88 #else |
| 89 TRACE_EVENT2("toplevel", "ChannelReader::DispatchInputData", | 89 TRACE_EVENT2("ipc,toplevel", "ChannelReader::DispatchInputData", |
| 90 "class", IPC_MESSAGE_ID_CLASS(m.type()), | 90 "class", IPC_MESSAGE_ID_CLASS(m.type()), |
| 91 "line", IPC_MESSAGE_ID_LINE(m.type())); | 91 "line", IPC_MESSAGE_ID_LINE(m.type())); |
| 92 #endif | 92 #endif |
| 93 m.TraceMessageEnd(); | 93 m.TraceMessageEnd(); |
| 94 if (IsInternalMessage(m)) | 94 if (IsInternalMessage(m)) |
| 95 HandleInternalMessage(m); | 95 HandleInternalMessage(m); |
| 96 else | 96 else |
| 97 listener_->OnMessageReceived(m); | 97 listener_->OnMessageReceived(m); |
| 98 p = message_tail; | 98 p = message_tail; |
| 99 } else { | 99 } else { |
| 100 // Last message is partial. | 100 // Last message is partial. |
| 101 break; | 101 break; |
| 102 } | 102 } |
| 103 } | 103 } |
| 104 | 104 |
| 105 // Save any partial data in the overflow buffer. | 105 // Save any partial data in the overflow buffer. |
| 106 input_overflow_buf_.assign(p, end - p); | 106 input_overflow_buf_.assign(p, end - p); |
| 107 | 107 |
| 108 if (input_overflow_buf_.empty() && !DidEmptyInputBuffers()) | 108 if (input_overflow_buf_.empty() && !DidEmptyInputBuffers()) |
| 109 return false; | 109 return false; |
| 110 return true; | 110 return true; |
| 111 } | 111 } |
| 112 | 112 |
| 113 | 113 |
| 114 } // namespace internal | 114 } // namespace internal |
| 115 } // namespace IPC | 115 } // namespace IPC |
| OLD | NEW |