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