| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/edk/system/channel.h" | 5 #include "mojo/edk/system/channel.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 } | 290 } |
| 291 | 291 |
| 292 void Channel::OnReadMessage( | 292 void Channel::OnReadMessage( |
| 293 const MessageInTransit::View& message_view, | 293 const MessageInTransit::View& message_view, |
| 294 embedder::ScopedPlatformHandleVectorPtr platform_handles) { | 294 embedder::ScopedPlatformHandleVectorPtr platform_handles) { |
| 295 DCHECK(creation_thread_checker_.CalledOnValidThread()); | 295 DCHECK(creation_thread_checker_.CalledOnValidThread()); |
| 296 | 296 |
| 297 switch (message_view.type()) { | 297 switch (message_view.type()) { |
| 298 case MessageInTransit::Type::ENDPOINT_CLIENT: | 298 case MessageInTransit::Type::ENDPOINT_CLIENT: |
| 299 case MessageInTransit::Type::ENDPOINT: | 299 case MessageInTransit::Type::ENDPOINT: |
| 300 OnReadMessageForEndpoint(message_view, platform_handles.Pass()); | 300 OnReadMessageForEndpoint(message_view, std::move(platform_handles)); |
| 301 break; | 301 break; |
| 302 case MessageInTransit::Type::CHANNEL: | 302 case MessageInTransit::Type::CHANNEL: |
| 303 OnReadMessageForChannel(message_view, platform_handles.Pass()); | 303 OnReadMessageForChannel(message_view, std::move(platform_handles)); |
| 304 break; | 304 break; |
| 305 default: | 305 default: |
| 306 HandleRemoteError( | 306 HandleRemoteError( |
| 307 base::StringPrintf("Received message of invalid type %u", | 307 base::StringPrintf("Received message of invalid type %u", |
| 308 static_cast<unsigned>(message_view.type())) | 308 static_cast<unsigned>(message_view.type())) |
| 309 .c_str()); | 309 .c_str()); |
| 310 break; | 310 break; |
| 311 } | 311 } |
| 312 } | 312 } |
| 313 | 313 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 // tested (TODO(vtl)). | 389 // tested (TODO(vtl)). |
| 390 DLOG(ERROR) << "This should not happen under normal operation."; | 390 DLOG(ERROR) << "This should not happen under normal operation."; |
| 391 return; | 391 return; |
| 392 } | 392 } |
| 393 | 393 |
| 394 std::unique_ptr<MessageInTransit> message(new MessageInTransit(message_view)); | 394 std::unique_ptr<MessageInTransit> message(new MessageInTransit(message_view)); |
| 395 if (message_view.transport_data_buffer_size() > 0) { | 395 if (message_view.transport_data_buffer_size() > 0) { |
| 396 DCHECK(message_view.transport_data_buffer()); | 396 DCHECK(message_view.transport_data_buffer()); |
| 397 message->SetDispatchers(TransportData::DeserializeDispatchers( | 397 message->SetDispatchers(TransportData::DeserializeDispatchers( |
| 398 message_view.transport_data_buffer(), | 398 message_view.transport_data_buffer(), |
| 399 message_view.transport_data_buffer_size(), platform_handles.Pass(), | 399 message_view.transport_data_buffer_size(), std::move(platform_handles), |
| 400 this)); | 400 this)); |
| 401 } | 401 } |
| 402 | 402 |
| 403 endpoint->OnReadMessage(std::move(message)); | 403 endpoint->OnReadMessage(std::move(message)); |
| 404 } | 404 } |
| 405 | 405 |
| 406 void Channel::OnReadMessageForChannel( | 406 void Channel::OnReadMessageForChannel( |
| 407 const MessageInTransit::View& message_view, | 407 const MessageInTransit::View& message_view, |
| 408 embedder::ScopedPlatformHandleVectorPtr platform_handles) { | 408 embedder::ScopedPlatformHandleVectorPtr platform_handles) { |
| 409 DCHECK(creation_thread_checker_.CalledOnValidThread()); | 409 DCHECK(creation_thread_checker_.CalledOnValidThread()); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 << ", local ID " << local_id << ", remote ID " << remote_id; | 626 << ", local ID " << local_id << ", remote ID " << remote_id; |
| 627 std::unique_ptr<MessageInTransit> message(new MessageInTransit( | 627 std::unique_ptr<MessageInTransit> message(new MessageInTransit( |
| 628 MessageInTransit::Type::CHANNEL, subtype, num_bytes, bytes)); | 628 MessageInTransit::Type::CHANNEL, subtype, num_bytes, bytes)); |
| 629 message->set_source_id(local_id); | 629 message->set_source_id(local_id); |
| 630 message->set_destination_id(remote_id); | 630 message->set_destination_id(remote_id); |
| 631 return WriteMessage(std::move(message)); | 631 return WriteMessage(std::move(message)); |
| 632 } | 632 } |
| 633 | 633 |
| 634 } // namespace system | 634 } // namespace system |
| 635 } // namespace mojo | 635 } // namespace mojo |
| OLD | NEW |