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

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

Issue 1153283004: Make TestChannelEndpointClient use MessageInTransitQueue. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 6 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
OLDNEW
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 <deque>
9
10 #include "base/macros.h" 8 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
13 #include "base/synchronization/lock.h" 11 #include "base/synchronization/lock.h"
14 #include "mojo/edk/system/channel_endpoint.h" 12 #include "mojo/edk/system/channel_endpoint.h"
15 #include "mojo/edk/system/channel_endpoint_client.h" 13 #include "mojo/edk/system/channel_endpoint_client.h"
14 #include "mojo/edk/system/message_in_transit_queue.h"
16 15
17 namespace base { 16 namespace base {
18 class WaitableEvent; 17 class WaitableEvent;
19 } 18 }
20 19
21 namespace mojo { 20 namespace mojo {
22 namespace system { 21 namespace system {
23
24 class MessageInTransit;
25
26 namespace test { 22 namespace test {
27 23
28 class TestChannelEndpointClient : public ChannelEndpointClient { 24 class TestChannelEndpointClient : public ChannelEndpointClient {
29 public: 25 public:
30 TestChannelEndpointClient(); 26 TestChannelEndpointClient();
31 27
32 // Initializes with the given port and endpoint. 28 // Initializes with the given port and endpoint.
33 void Init(unsigned port, ChannelEndpoint* endpoint); 29 void Init(unsigned port, ChannelEndpoint* endpoint);
34 30
35 // Returns true if we're detached from the |ChannelEndpoint|. 31 // Returns true if we're detached from the |ChannelEndpoint|.
(...skipping 15 matching lines...) Expand all
51 void OnDetachFromChannel(unsigned port) override; 47 void OnDetachFromChannel(unsigned port) override;
52 48
53 private: 49 private:
54 ~TestChannelEndpointClient() override; 50 ~TestChannelEndpointClient() override;
55 51
56 mutable base::Lock lock_; // Protects the members below. 52 mutable base::Lock lock_; // Protects the members below.
57 53
58 unsigned port_; 54 unsigned port_;
59 scoped_refptr<ChannelEndpoint> endpoint_; 55 scoped_refptr<ChannelEndpoint> endpoint_;
60 56
61 // Owns the messages. TODO(vtl): Change them to scoped_ptr/unique_ptr when we 57 MessageInTransitQueue messages_;
62 // can.
63 std::deque<MessageInTransit*> messages_;
64 58
65 // Event to trigger if we read a message (may be null). 59 // Event to trigger if we read a message (may be null).
66 base::WaitableEvent* read_event_; 60 base::WaitableEvent* read_event_;
67 61
68 DISALLOW_COPY_AND_ASSIGN(TestChannelEndpointClient); 62 DISALLOW_COPY_AND_ASSIGN(TestChannelEndpointClient);
69 }; 63 };
70 64
71 } // namespace test 65 } // namespace test
72 } // namespace system 66 } // namespace system
73 } // namespace mojo 67 } // namespace mojo
74 68
75 #endif // MOJO_EDK_SYSTEM_TEST_CHANNEL_ENDPOINT_CLIENT_H_ 69 #endif // MOJO_EDK_SYSTEM_TEST_CHANNEL_ENDPOINT_CLIENT_H_
OLDNEW
« no previous file with comments | « mojo/edk/system/message_in_transit_queue_unittest.cc ('k') | mojo/edk/system/test_channel_endpoint_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698