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/edk/system/message_pipe_dispatcher.h" | 5 #include "mojo/edk/system/message_pipe_dispatcher.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <utility> | 10 #include <utility> |
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 } else { | 979 } else { |
980 CHECK_NE(non_transferable_state_, CLOSED); | 980 CHECK_NE(non_transferable_state_, CLOSED); |
981 internal::g_broker->CloseMessagePipe(pipe_id_, this); | 981 internal::g_broker->CloseMessagePipe(pipe_id_, this); |
982 non_transferable_state_ = CLOSED; | 982 non_transferable_state_ = CLOSED; |
983 } | 983 } |
984 channel_ = nullptr; | 984 channel_ = nullptr; |
985 if (close_requested_) { | 985 if (close_requested_) { |
986 // Balance AddRef in CloseOnIO. | 986 // Balance AddRef in CloseOnIO. |
987 call_release = true; | 987 call_release = true; |
988 } | 988 } |
| 989 } else if (!channel_ && !transferable_ && |
| 990 non_transferable_state_ == WAITING_FOR_CONNECT_TO_CLOSE) { |
| 991 // Balance AddRef in CloseOnIO. |
| 992 call_release = true; |
989 } | 993 } |
990 awakable_list_.AwakeForStateChange(GetHandleSignalsStateImplNoLock()); | 994 awakable_list_.AwakeForStateChange(GetHandleSignalsStateImplNoLock()); |
991 started_transport_.Release(); | 995 started_transport_.Release(); |
992 } else { | 996 } else { |
993 // We must be waiting to call ReleaseHandle. It will call Shutdown. | 997 // We must be waiting to call ReleaseHandle. It will call Shutdown. |
994 } | 998 } |
995 | 999 |
996 if (call_release) | 1000 if (call_release) |
997 Release(); | 1001 Release(); |
998 } | 1002 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1056 // PostTask since the broker can call us back synchronously. | 1060 // PostTask since the broker can call us back synchronously. |
1057 internal::g_io_thread_task_runner->PostTask( | 1061 internal::g_io_thread_task_runner->PostTask( |
1058 FROM_HERE, | 1062 FROM_HERE, |
1059 base::Bind(&Broker::ConnectMessagePipe, | 1063 base::Bind(&Broker::ConnectMessagePipe, |
1060 base::Unretained(internal::g_broker), pipe_id_, | 1064 base::Unretained(internal::g_broker), pipe_id_, |
1061 base::Unretained(this))); | 1065 base::Unretained(this))); |
1062 } | 1066 } |
1063 | 1067 |
1064 } // namespace edk | 1068 } // namespace edk |
1065 } // namespace mojo | 1069 } // namespace mojo |
OLD | NEW |