| 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 #ifndef MOJO_SYSTEM_WAITER_TEST_UTILS_H_ | 5 #ifndef MOJO_SYSTEM_WAITER_TEST_UTILS_H_ |
| 6 #define MOJO_SYSTEM_WAITER_TEST_UTILS_H_ | 6 #define MOJO_SYSTEM_WAITER_TEST_UTILS_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 // This is a more complex and realistic thread that has a |Waiter|, on which it | 65 // This is a more complex and realistic thread that has a |Waiter|, on which it |
| 66 // waits for the given deadline (with the given flags). Unlike | 66 // waits for the given deadline (with the given flags). Unlike |
| 67 // |SimpleWaiterThread|, it requires the machinery of |Dispatcher|. | 67 // |SimpleWaiterThread|, it requires the machinery of |Dispatcher|. |
| 68 class WaiterThread : public base::SimpleThread { | 68 class WaiterThread : public base::SimpleThread { |
| 69 public: | 69 public: |
| 70 // Note: |*did_wait_out|, |*result_out|, and |*context_out| "belong" to this | 70 // Note: |*did_wait_out|, |*result_out|, and |*context_out| "belong" to this |
| 71 // object (i.e., may be modified by, on some other thread) while it's alive. | 71 // object (i.e., may be modified by, on some other thread) while it's alive. |
| 72 WaiterThread(scoped_refptr<Dispatcher> dispatcher, | 72 WaiterThread(scoped_refptr<Dispatcher> dispatcher, |
| 73 MojoWaitFlags wait_flags, | 73 MojoHandleSignals handle_signals, |
| 74 MojoDeadline deadline, | 74 MojoDeadline deadline, |
| 75 uint32_t context, | 75 uint32_t context, |
| 76 bool* did_wait_out, | 76 bool* did_wait_out, |
| 77 MojoResult* result_out, | 77 MojoResult* result_out, |
| 78 uint32_t* context_out); | 78 uint32_t* context_out); |
| 79 virtual ~WaiterThread(); | 79 virtual ~WaiterThread(); |
| 80 | 80 |
| 81 private: | 81 private: |
| 82 virtual void Run() OVERRIDE; | 82 virtual void Run() OVERRIDE; |
| 83 | 83 |
| 84 const scoped_refptr<Dispatcher> dispatcher_; | 84 const scoped_refptr<Dispatcher> dispatcher_; |
| 85 const MojoWaitFlags wait_flags_; | 85 const MojoHandleSignals handle_signals_; |
| 86 const MojoDeadline deadline_; | 86 const MojoDeadline deadline_; |
| 87 const uint32_t context_; | 87 const uint32_t context_; |
| 88 bool* const did_wait_out_; | 88 bool* const did_wait_out_; |
| 89 MojoResult* const result_out_; | 89 MojoResult* const result_out_; |
| 90 uint32_t* const context_out_; | 90 uint32_t* const context_out_; |
| 91 | 91 |
| 92 Waiter waiter_; | 92 Waiter waiter_; |
| 93 | 93 |
| 94 DISALLOW_COPY_AND_ASSIGN(WaiterThread); | 94 DISALLOW_COPY_AND_ASSIGN(WaiterThread); |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 } // namespace test | 97 } // namespace test |
| 98 } // namespace system | 98 } // namespace system |
| 99 } // namespace mojo | 99 } // namespace mojo |
| 100 | 100 |
| 101 #endif // MOJO_SYSTEM_WAITER_TEST_UTILS_H_ | 101 #endif // MOJO_SYSTEM_WAITER_TEST_UTILS_H_ |
| OLD | NEW |