| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 #include <stdio.h> | 6 #include <stdio.h> |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 mojo::test::MultiprocessTestHelper* helper() { return &helper_; } | 119 mojo::test::MultiprocessTestHelper* helper() { return &helper_; } |
| 120 | 120 |
| 121 private: | 121 private: |
| 122 ChannelThread channel_thread_; | 122 ChannelThread channel_thread_; |
| 123 mojo::test::MultiprocessTestHelper helper_; | 123 mojo::test::MultiprocessTestHelper helper_; |
| 124 | 124 |
| 125 DISALLOW_COPY_AND_ASSIGN(MultiprocessMessagePipeTest); | 125 DISALLOW_COPY_AND_ASSIGN(MultiprocessMessagePipeTest); |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 MojoResult WaitIfNecessary(scoped_refptr<MessagePipe> mp, MojoWaitFlags flags) { | 128 MojoResult WaitIfNecessary(scoped_refptr<MessagePipe> mp, |
| 129 MojoHandleSignals signals) { |
| 129 Waiter waiter; | 130 Waiter waiter; |
| 130 waiter.Init(); | 131 waiter.Init(); |
| 131 | 132 |
| 132 MojoResult add_result = mp->AddWaiter(0, &waiter, flags, 0); | 133 MojoResult add_result = mp->AddWaiter(0, &waiter, signals, 0); |
| 133 if (add_result != MOJO_RESULT_OK) { | 134 if (add_result != MOJO_RESULT_OK) { |
| 134 return (add_result == MOJO_RESULT_ALREADY_EXISTS) ? MOJO_RESULT_OK : | 135 return (add_result == MOJO_RESULT_ALREADY_EXISTS) ? MOJO_RESULT_OK : |
| 135 add_result; | 136 add_result; |
| 136 } | 137 } |
| 137 | 138 |
| 138 MojoResult wait_result = waiter.Wait(MOJO_DEADLINE_INDEFINITE, NULL); | 139 MojoResult wait_result = waiter.Wait(MOJO_DEADLINE_INDEFINITE, NULL); |
| 139 mp->RemoveWaiter(0, &waiter); | 140 mp->RemoveWaiter(0, &waiter); |
| 140 return wait_result; | 141 return wait_result; |
| 141 } | 142 } |
| 142 | 143 |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 WaitIfNecessary(mp, MOJO_WAIT_FLAG_READABLE)); | 546 WaitIfNecessary(mp, MOJO_WAIT_FLAG_READABLE)); |
| 546 | 547 |
| 547 mp->Close(0); | 548 mp->Close(0); |
| 548 | 549 |
| 549 EXPECT_EQ(0, helper()->WaitForChildShutdown()); | 550 EXPECT_EQ(0, helper()->WaitForChildShutdown()); |
| 550 } | 551 } |
| 551 | 552 |
| 552 } // namespace | 553 } // namespace |
| 553 } // namespace system | 554 } // namespace system |
| 554 } // namespace mojo | 555 } // namespace mojo |
| OLD | NEW |