OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "mojo/public/cpp/bindings/interface_endpoint_client.h" | 5 #include "mojo/public/cpp/bindings/interface_endpoint_client.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 encountered_error_(false), | 145 encountered_error_(false), |
146 task_runner_(std::move(runner)), | 146 task_runner_(std::move(runner)), |
147 control_message_proxy_(this), | 147 control_message_proxy_(this), |
148 control_message_handler_(interface_version), | 148 control_message_handler_(interface_version), |
149 weak_ptr_factory_(this) { | 149 weak_ptr_factory_(this) { |
150 DCHECK(handle_.is_valid()); | 150 DCHECK(handle_.is_valid()); |
151 DCHECK(handle_.is_local()); | 151 DCHECK(handle_.is_local()); |
152 | 152 |
153 // TODO(yzshen): the way to use validator (or message filter in general) | 153 // TODO(yzshen): the way to use validator (or message filter in general) |
154 // directly is a little awkward. | 154 // directly is a little awkward. |
155 filters_.Append(std::move(payload_validator)); | 155 if (payload_validator) |
| 156 filters_.Append(std::move(payload_validator)); |
156 | 157 |
157 controller_ = handle_.group_controller()->AttachEndpointClient( | 158 controller_ = handle_.group_controller()->AttachEndpointClient( |
158 handle_, this, task_runner_); | 159 handle_, this, task_runner_); |
159 if (expect_sync_requests) | 160 if (expect_sync_requests) |
160 controller_->AllowWokenUpBySyncWatchOnSameThread(); | 161 controller_->AllowWokenUpBySyncWatchOnSameThread(); |
161 } | 162 } |
162 | 163 |
163 InterfaceEndpointClient::~InterfaceEndpointClient() { | 164 InterfaceEndpointClient::~InterfaceEndpointClient() { |
164 DCHECK(thread_checker_.CalledOnValidThread()); | 165 DCHECK(thread_checker_.CalledOnValidThread()); |
165 | 166 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 return responder->Accept(message); | 330 return responder->Accept(message); |
330 } else { | 331 } else { |
331 if (mojo::internal::ControlMessageHandler::IsControlMessage(message)) | 332 if (mojo::internal::ControlMessageHandler::IsControlMessage(message)) |
332 return control_message_handler_.Accept(message); | 333 return control_message_handler_.Accept(message); |
333 | 334 |
334 return incoming_receiver_->Accept(message); | 335 return incoming_receiver_->Accept(message); |
335 } | 336 } |
336 } | 337 } |
337 | 338 |
338 } // namespace mojo | 339 } // namespace mojo |
OLD | NEW |