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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
75 const char* message_tail = Message::FindNext(p, end); | 75 const char* message_tail = Message::FindNext(p, end); |
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 std::string name; | 83 std::string name; |
84 Logging::GetInstance()->GetMessageText(m.type(), &name, &m, NULL); | 84 Logging::GetInstance()->GetMessageText(m.type(), &name, &m, NULL); |
85 TRACE_EVENT1("ipc,toplevel", "ChannelReader::DispatchInputData", | 85 TRACE_EVENT1_WITH_FLOW("ipc,toplevel", "ChannelReader::DispatchInputData", |
86 "name", name); | 86 "name", name).APPEND_TRACE_EVENT_FLOW_END0( |
dsinclair
2015/07/14 13:52:10
Why do we have to l.APPEND a flow event? Why isn't
| |
87 TRACE_DISABLED_BY_DEFAULT("ipc.flow"), "IPC", | |
88 m.flags()); | |
87 #else | 89 #else |
88 TRACE_EVENT2("ipc,toplevel", "ChannelReader::DispatchInputData", | 90 TRACE_EVENT2_WITH_FLOW("ipc,toplevel", "ChannelReader::DispatchInputData", |
89 "class", IPC_MESSAGE_ID_CLASS(m.type()), | 91 "class", IPC_MESSAGE_ID_CLASS(m.type()), |
90 "line", IPC_MESSAGE_ID_LINE(m.type())); | 92 "line", IPC_MESSAGE_ID_LINE(m.type())).APPEND_TRACE_EVENT_FLO W_END0( |
93 TRACE_DISABLED_BY_DEFAULT("ipc.flow"), "IPC", | |
94 m.flags()); | |
91 #endif | 95 #endif |
92 m.TraceMessageEnd(); | |
93 if (IsInternalMessage(m)) | 96 if (IsInternalMessage(m)) |
94 HandleInternalMessage(m); | 97 HandleInternalMessage(m); |
95 else | 98 else |
96 listener_->OnMessageReceived(m); | 99 listener_->OnMessageReceived(m); |
97 if (m.dispatch_error()) | 100 if (m.dispatch_error()) |
98 listener_->OnBadMessageReceived(m); | 101 listener_->OnBadMessageReceived(m); |
99 p = message_tail; | 102 p = message_tail; |
100 } else { | 103 } else { |
101 // Last message is partial. | 104 // Last message is partial. |
102 break; | 105 break; |
103 } | 106 } |
104 } | 107 } |
105 | 108 |
106 // Save any partial data in the overflow buffer. | 109 // Save any partial data in the overflow buffer. |
107 input_overflow_buf_.assign(p, end - p); | 110 input_overflow_buf_.assign(p, end - p); |
108 | 111 |
109 if (input_overflow_buf_.empty() && !DidEmptyInputBuffers()) | 112 if (input_overflow_buf_.empty() && !DidEmptyInputBuffers()) |
110 return false; | 113 return false; |
111 return true; | 114 return true; |
112 } | 115 } |
113 | 116 |
114 | 117 |
115 } // namespace internal | 118 } // namespace internal |
116 } // namespace IPC | 119 } // namespace IPC |
OLD | NEW |