OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/raw_channel.h" | 5 #include "mojo/edk/system/raw_channel.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string.h> | 9 #include <string.h> |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 const char* error_message = nullptr; | 642 const char* error_message = nullptr; |
643 if (!message_view.IsValid(GetSerializedPlatformHandleSize(), | 643 if (!message_view.IsValid(GetSerializedPlatformHandleSize(), |
644 &error_message)) { | 644 &error_message)) { |
645 DCHECK(error_message); | 645 DCHECK(error_message); |
646 LOG(ERROR) << "Received invalid message: " << error_message; | 646 LOG(ERROR) << "Received invalid message: " << error_message; |
647 CallOnError(Delegate::ERROR_READ_BAD_MESSAGE); | 647 CallOnError(Delegate::ERROR_READ_BAD_MESSAGE); |
648 *stop_dispatching = true; | 648 *stop_dispatching = true; |
649 return; // |this| may have been destroyed in |CallOnError()|. | 649 return; // |this| may have been destroyed in |CallOnError()|. |
650 } | 650 } |
651 | 651 |
652 if (message_view.type() != MessageInTransit::Type::MESSAGE) { | 652 if (message_view.type() != MessageInTransit::Type::MESSAGE && |
| 653 message_view.type() != MessageInTransit::Type::QUIT_MESSAGE) { |
653 if (!OnReadMessageForRawChannel(message_view)) { | 654 if (!OnReadMessageForRawChannel(message_view)) { |
654 CallOnError(Delegate::ERROR_READ_BAD_MESSAGE); | 655 CallOnError(Delegate::ERROR_READ_BAD_MESSAGE); |
655 *stop_dispatching = true; | 656 *stop_dispatching = true; |
656 return; // |this| may have been destroyed in |CallOnError()|. | 657 return; // |this| may have been destroyed in |CallOnError()|. |
657 } | 658 } |
658 } else { | 659 } else { |
659 ScopedPlatformHandleVectorPtr platform_handles; | 660 ScopedPlatformHandleVectorPtr platform_handles; |
660 if (message_view.transport_data_buffer()) { | 661 if (message_view.transport_data_buffer()) { |
661 size_t num_platform_handles; | 662 size_t num_platform_handles; |
662 const void* platform_handle_table; | 663 const void* platform_handle_table; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 OnReadCompletedNoLock(io_result, bytes_read); | 725 OnReadCompletedNoLock(io_result, bytes_read); |
725 } | 726 } |
726 | 727 |
727 void RawChannel::WillDestroyCurrentMessageLoop() { | 728 void RawChannel::WillDestroyCurrentMessageLoop() { |
728 base::AutoLock locker(read_lock_); | 729 base::AutoLock locker(read_lock_); |
729 OnReadCompletedNoLock(IO_FAILED_SHUTDOWN, 0); | 730 OnReadCompletedNoLock(IO_FAILED_SHUTDOWN, 0); |
730 } | 731 } |
731 | 732 |
732 } // namespace edk | 733 } // namespace edk |
733 } // namespace mojo | 734 } // namespace mojo |
OLD | NEW |