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

Side by Side Diff: mojo/edk/system/waiter_test_utils.h

Issue 1412283002: Convert mojo::system::Dispatcher to use our new refcounting stuff (instead of base's). (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: no change Created 5 years, 2 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/simple_dispatcher_unittest.cc ('k') | mojo/edk/system/waiter_test_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_EDK_SYSTEM_WAITER_TEST_UTILS_H_ 5 #ifndef MOJO_EDK_SYSTEM_WAITER_TEST_UTILS_H_
6 #define MOJO_EDK_SYSTEM_WAITER_TEST_UTILS_H_ 6 #define MOJO_EDK_SYSTEM_WAITER_TEST_UTILS_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/memory/ref_counted.h"
11 #include "mojo/edk/system/dispatcher.h" 10 #include "mojo/edk/system/dispatcher.h"
12 #include "mojo/edk/system/handle_signals_state.h" 11 #include "mojo/edk/system/handle_signals_state.h"
12 #include "mojo/edk/system/ref_ptr.h"
13 #include "mojo/edk/system/waiter.h" 13 #include "mojo/edk/system/waiter.h"
14 #include "mojo/edk/test/simple_test_thread.h" 14 #include "mojo/edk/test/simple_test_thread.h"
15 #include "mojo/public/c/system/types.h" 15 #include "mojo/public/c/system/types.h"
16 #include "mojo/public/cpp/system/macros.h" 16 #include "mojo/public/cpp/system/macros.h"
17 17
18 namespace mojo { 18 namespace mojo {
19 namespace system { 19 namespace system {
20 namespace test { 20 namespace test {
21 21
22 // This is a very simple thread that has a |Waiter|, on which it waits 22 // This is a very simple thread that has a |Waiter|, on which it waits
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 mojo::test::SimpleTestThread { 68 class WaiterThread : public mojo::test::SimpleTestThread {
69 public: 69 public:
70 // Note: |*did_wait_out|, |*result_out|, |*context_out| and 70 // Note: |*did_wait_out|, |*result_out|, |*context_out| and
71 // |*signals_state_out| "belong" to this object (i.e., may be modified by, on 71 // |*signals_state_out| "belong" to this object (i.e., may be modified by, on
72 // some other thread) while it's alive. 72 // some other thread) while it's alive.
73 WaiterThread(scoped_refptr<Dispatcher> dispatcher, 73 WaiterThread(RefPtr<Dispatcher>&& dispatcher,
74 MojoHandleSignals handle_signals, 74 MojoHandleSignals handle_signals,
75 MojoDeadline deadline, 75 MojoDeadline deadline,
76 uint32_t context, 76 uint32_t context,
77 bool* did_wait_out, 77 bool* did_wait_out,
78 MojoResult* result_out, 78 MojoResult* result_out,
79 uint32_t* context_out, 79 uint32_t* context_out,
80 HandleSignalsState* signals_state_out); 80 HandleSignalsState* signals_state_out);
81 ~WaiterThread() override; 81 ~WaiterThread() override;
82 82
83 private: 83 private:
84 void Run() override; 84 void Run() override;
85 85
86 const scoped_refptr<Dispatcher> dispatcher_; 86 const RefPtr<Dispatcher> dispatcher_;
87 const MojoHandleSignals handle_signals_; 87 const MojoHandleSignals handle_signals_;
88 const MojoDeadline deadline_; 88 const MojoDeadline deadline_;
89 const uint32_t context_; 89 const uint32_t context_;
90 bool* const did_wait_out_; 90 bool* const did_wait_out_;
91 MojoResult* const result_out_; 91 MojoResult* const result_out_;
92 uint32_t* const context_out_; 92 uint32_t* const context_out_;
93 HandleSignalsState* const signals_state_out_; 93 HandleSignalsState* const signals_state_out_;
94 94
95 Waiter waiter_; 95 Waiter waiter_;
96 96
97 MOJO_DISALLOW_COPY_AND_ASSIGN(WaiterThread); 97 MOJO_DISALLOW_COPY_AND_ASSIGN(WaiterThread);
98 }; 98 };
99 99
100 } // namespace test 100 } // namespace test
101 } // namespace system 101 } // namespace system
102 } // namespace mojo 102 } // namespace mojo
103 103
104 #endif // MOJO_EDK_SYSTEM_WAITER_TEST_UTILS_H_ 104 #endif // MOJO_EDK_SYSTEM_WAITER_TEST_UTILS_H_
OLDNEW
« no previous file with comments | « mojo/edk/system/simple_dispatcher_unittest.cc ('k') | mojo/edk/system/waiter_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698