| 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/message_pipe_test_utils.h" | 5 #include "mojo/edk/system/message_pipe_test_utils.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "mojo/edk/system/channel.h" | 10 #include "mojo/edk/system/channel.h" |
| 11 #include "mojo/edk/system/channel_endpoint.h" | 11 #include "mojo/edk/system/channel_endpoint.h" |
| 12 #include "mojo/edk/system/message_pipe.h" | 12 #include "mojo/edk/system/message_pipe.h" |
| 13 #include "mojo/edk/system/test_utils.h" | 13 #include "mojo/edk/system/test_utils.h" |
| 14 #include "mojo/edk/system/waiter.h" | 14 #include "mojo/edk/system/waiter.h" |
| 15 | 15 |
| 16 namespace mojo { | 16 namespace mojo { |
| 17 namespace system { | 17 namespace system { |
| 18 namespace test { | 18 namespace test { |
| 19 | 19 |
| 20 MojoResult WaitIfNecessary(scoped_refptr<MessagePipe> mp, | 20 MojoResult WaitIfNecessary(MessagePipe* mp, |
| 21 MojoHandleSignals signals, | 21 MojoHandleSignals signals, |
| 22 HandleSignalsState* signals_state) { | 22 HandleSignalsState* signals_state) { |
| 23 Waiter waiter; | 23 Waiter waiter; |
| 24 waiter.Init(); | 24 waiter.Init(); |
| 25 | 25 |
| 26 MojoResult add_result = | 26 MojoResult add_result = |
| 27 mp->AddAwakable(0, &waiter, signals, 0, signals_state); | 27 mp->AddAwakable(0, &waiter, signals, 0, signals_state); |
| 28 if (add_result != MOJO_RESULT_OK) { | 28 if (add_result != MOJO_RESULT_OK) { |
| 29 return (add_result == MOJO_RESULT_ALREADY_EXISTS) ? MOJO_RESULT_OK | 29 return (add_result == MOJO_RESULT_ALREADY_EXISTS) ? MOJO_RESULT_OK |
| 30 : add_result; | 30 : add_result; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 } | 102 } |
| 103 | 103 |
| 104 void MultiprocessMessagePipeTestBase::Init(RefPtr<ChannelEndpoint>&& ep) { | 104 void MultiprocessMessagePipeTestBase::Init(RefPtr<ChannelEndpoint>&& ep) { |
| 105 channel_thread_.Start(helper_.server_platform_handle.Pass(), std::move(ep)); | 105 channel_thread_.Start(helper_.server_platform_handle.Pass(), std::move(ep)); |
| 106 } | 106 } |
| 107 #endif | 107 #endif |
| 108 | 108 |
| 109 } // namespace test | 109 } // namespace test |
| 110 } // namespace system | 110 } // namespace system |
| 111 } // namespace mojo | 111 } // namespace mojo |
| OLD | NEW |