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 #ifndef MOJO_EDK_SYSTEM_TEST_CHANNEL_ENDPOINT_CLIENT_H_ | 5 #ifndef MOJO_EDK_SYSTEM_TEST_CHANNEL_ENDPOINT_CLIENT_H_ |
6 #define MOJO_EDK_SYSTEM_TEST_CHANNEL_ENDPOINT_CLIENT_H_ | 6 #define MOJO_EDK_SYSTEM_TEST_CHANNEL_ENDPOINT_CLIENT_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "mojo/edk/system/channel_endpoint.h" | 10 #include "mojo/edk/system/channel_endpoint.h" |
11 #include "mojo/edk/system/channel_endpoint_client.h" | 11 #include "mojo/edk/system/channel_endpoint_client.h" |
12 #include "mojo/edk/system/message_in_transit_queue.h" | 12 #include "mojo/edk/system/message_in_transit_queue.h" |
13 #include "mojo/edk/system/mutex.h" | 13 #include "mojo/edk/util/mutex.h" |
14 #include "mojo/edk/util/ref_ptr.h" | 14 #include "mojo/edk/util/ref_ptr.h" |
| 15 #include "mojo/edk/util/thread_annotations.h" |
15 #include "mojo/public/cpp/system/macros.h" | 16 #include "mojo/public/cpp/system/macros.h" |
16 | 17 |
17 namespace mojo { | 18 namespace mojo { |
18 namespace system { | 19 namespace system { |
19 | 20 |
20 class ManualResetWaitableEvent; | 21 class ManualResetWaitableEvent; |
21 | 22 |
22 namespace test { | 23 namespace test { |
23 | 24 |
24 class TestChannelEndpointClient final : public ChannelEndpointClient { | 25 class TestChannelEndpointClient final : public ChannelEndpointClient { |
(...skipping 20 matching lines...) Expand all Loading... |
45 // |ChannelEndpointClient| implementation: | 46 // |ChannelEndpointClient| implementation: |
46 bool OnReadMessage(unsigned port, MessageInTransit* message) override; | 47 bool OnReadMessage(unsigned port, MessageInTransit* message) override; |
47 void OnDetachFromChannel(unsigned port) override; | 48 void OnDetachFromChannel(unsigned port) override; |
48 | 49 |
49 private: | 50 private: |
50 FRIEND_MAKE_REF_COUNTED(TestChannelEndpointClient); | 51 FRIEND_MAKE_REF_COUNTED(TestChannelEndpointClient); |
51 | 52 |
52 TestChannelEndpointClient(); | 53 TestChannelEndpointClient(); |
53 ~TestChannelEndpointClient() override; | 54 ~TestChannelEndpointClient() override; |
54 | 55 |
55 mutable Mutex mutex_; | 56 mutable util::Mutex mutex_; |
56 | 57 |
57 unsigned port_ MOJO_GUARDED_BY(mutex_); | 58 unsigned port_ MOJO_GUARDED_BY(mutex_); |
58 util::RefPtr<ChannelEndpoint> endpoint_ MOJO_GUARDED_BY(mutex_); | 59 util::RefPtr<ChannelEndpoint> endpoint_ MOJO_GUARDED_BY(mutex_); |
59 | 60 |
60 MessageInTransitQueue messages_ MOJO_GUARDED_BY(mutex_); | 61 MessageInTransitQueue messages_ MOJO_GUARDED_BY(mutex_); |
61 | 62 |
62 // Event to trigger if we read a message (may be null). | 63 // Event to trigger if we read a message (may be null). |
63 ManualResetWaitableEvent* read_event_ MOJO_GUARDED_BY(mutex_); | 64 ManualResetWaitableEvent* read_event_ MOJO_GUARDED_BY(mutex_); |
64 | 65 |
65 MOJO_DISALLOW_COPY_AND_ASSIGN(TestChannelEndpointClient); | 66 MOJO_DISALLOW_COPY_AND_ASSIGN(TestChannelEndpointClient); |
66 }; | 67 }; |
67 | 68 |
68 } // namespace test | 69 } // namespace test |
69 } // namespace system | 70 } // namespace system |
70 } // namespace mojo | 71 } // namespace mojo |
71 | 72 |
72 #endif // MOJO_EDK_SYSTEM_TEST_CHANNEL_ENDPOINT_CLIENT_H_ | 73 #endif // MOJO_EDK_SYSTEM_TEST_CHANNEL_ENDPOINT_CLIENT_H_ |
OLD | NEW |