Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Side by Side Diff: mojo/edk/system/raw_channel.cc

Issue 1554623005: Ensure that in-flight message pipes are always closed and the other end is notified. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix dcheck of lock being acquired at destruction Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/edk/system/message_pipe_dispatcher.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « mojo/edk/system/message_pipe_dispatcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698