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 | 8 |
9 #include "ipc/ipc_listener.h" | 9 #include "ipc/ipc_listener.h" |
10 #include "ipc/ipc_logging.h" | 10 #include "ipc/ipc_logging.h" |
11 #include "ipc/ipc_message.h" | 11 #include "ipc/ipc_message.h" |
12 #include "ipc/ipc_message_attachment_set.h" | 12 #include "ipc/ipc_message_attachment_set.h" |
13 #include "ipc/ipc_message_macros.h" | 13 #include "ipc/ipc_message_macros.h" |
| 14 #include "ipc/ipc_message_start.h" |
14 | 15 |
15 namespace IPC { | 16 namespace IPC { |
16 namespace internal { | 17 namespace internal { |
17 | 18 |
18 ChannelReader::ChannelReader(Listener* listener) : listener_(listener) { | 19 ChannelReader::ChannelReader(Listener* listener) : listener_(listener) { |
19 memset(input_buf_, 0, sizeof(input_buf_)); | 20 memset(input_buf_, 0, sizeof(input_buf_)); |
20 } | 21 } |
21 | 22 |
22 ChannelReader::~ChannelReader() { | 23 ChannelReader::~ChannelReader() { |
23 DCHECK(blocked_ids_.empty()); | 24 DCHECK(blocked_ids_.empty()); |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 bool handled = false; | 183 bool handled = false; |
183 if (IsInternalMessage(*m)) { | 184 if (IsInternalMessage(*m)) { |
184 HandleInternalMessage(*m); | 185 HandleInternalMessage(*m); |
185 handled = true; | 186 handled = true; |
186 } | 187 } |
187 #if USE_ATTACHMENT_BROKER | 188 #if USE_ATTACHMENT_BROKER |
188 if (!handled && IsAttachmentBrokerEndpoint() && GetAttachmentBroker()) { | 189 if (!handled && IsAttachmentBrokerEndpoint() && GetAttachmentBroker()) { |
189 handled = GetAttachmentBroker()->OnMessageReceived(*m); | 190 handled = GetAttachmentBroker()->OnMessageReceived(*m); |
190 } | 191 } |
191 #endif // USE_ATTACHMENT_BROKER | 192 #endif // USE_ATTACHMENT_BROKER |
| 193 |
| 194 // TODO(erikchen): Temporary code to help track http://crbug.com/527588. |
| 195 Channel::MessageVerifier verifier = Channel::GetMessageVerifier(); |
| 196 if (verifier) |
| 197 verifier(m); |
| 198 |
192 if (!handled) | 199 if (!handled) |
193 listener_->OnMessageReceived(*m); | 200 listener_->OnMessageReceived(*m); |
194 if (m->dispatch_error()) | 201 if (m->dispatch_error()) |
195 listener_->OnBadMessageReceived(*m); | 202 listener_->OnBadMessageReceived(*m); |
196 } | 203 } |
197 | 204 |
198 ChannelReader::AttachmentIdSet ChannelReader::GetBrokeredAttachments( | 205 ChannelReader::AttachmentIdSet ChannelReader::GetBrokeredAttachments( |
199 Message* msg) { | 206 Message* msg) { |
200 std::set<BrokerableAttachment::AttachmentId> blocked_ids; | 207 std::set<BrokerableAttachment::AttachmentId> blocked_ids; |
201 | 208 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 } | 251 } |
245 | 252 |
246 void ChannelReader::StopObservingAttachmentBroker() { | 253 void ChannelReader::StopObservingAttachmentBroker() { |
247 #if USE_ATTACHMENT_BROKER | 254 #if USE_ATTACHMENT_BROKER |
248 GetAttachmentBroker()->RemoveObserver(this); | 255 GetAttachmentBroker()->RemoveObserver(this); |
249 #endif // USE_ATTACHMENT_BROKER | 256 #endif // USE_ATTACHMENT_BROKER |
250 } | 257 } |
251 | 258 |
252 } // namespace internal | 259 } // namespace internal |
253 } // namespace IPC | 260 } // namespace IPC |
OLD | NEW |