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

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

Issue 1353683005: EDK: Convert remaining scoped_ptr -> std::unique_ptr in //mojo/edk/system. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 3 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 <memory>
9
8 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "mojo/edk/system/channel_endpoint.h" 11 #include "mojo/edk/system/channel_endpoint.h"
11 #include "mojo/edk/system/channel_endpoint_client.h" 12 #include "mojo/edk/system/channel_endpoint_client.h"
12 #include "mojo/edk/system/message_in_transit_queue.h" 13 #include "mojo/edk/system/message_in_transit_queue.h"
13 #include "mojo/edk/system/mutex.h" 14 #include "mojo/edk/system/mutex.h"
14 #include "mojo/public/cpp/system/macros.h" 15 #include "mojo/public/cpp/system/macros.h"
15 16
16 namespace base { 17 namespace base {
17 class WaitableEvent; 18 class WaitableEvent;
18 } 19 }
19 20
20 namespace mojo { 21 namespace mojo {
21 namespace system { 22 namespace system {
22 namespace test { 23 namespace test {
23 24
24 class TestChannelEndpointClient final : public ChannelEndpointClient { 25 class TestChannelEndpointClient final : public ChannelEndpointClient {
25 public: 26 public:
26 TestChannelEndpointClient(); 27 TestChannelEndpointClient();
27 28
28 // Initializes with the given port and endpoint. 29 // Initializes with the given port and endpoint.
29 void Init(unsigned port, ChannelEndpoint* endpoint); 30 void Init(unsigned port, ChannelEndpoint* endpoint);
30 31
31 // Returns true if we're detached from the |ChannelEndpoint|. 32 // Returns true if we're detached from the |ChannelEndpoint|.
32 bool IsDetached() const; 33 bool IsDetached() const;
33 34
34 // Gets the current number of messages received (but not dequeued). 35 // Gets the current number of messages received (but not dequeued).
35 size_t NumMessages() const; 36 size_t NumMessages() const;
36 37
37 // Gets/removes a message that was received (|NumMessages()| must be 38 // Gets/removes a message that was received (|NumMessages()| must be
38 // non-zero), in FIFO order. 39 // non-zero), in FIFO order.
39 scoped_ptr<MessageInTransit> PopMessage(); 40 std::unique_ptr<MessageInTransit> PopMessage();
40 41
41 // Sets an event to signal when we receive a message. (|read_event| must live 42 // Sets an event to signal when we receive a message. (|read_event| must live
42 // until this object is destroyed or the read event is reset to null.) 43 // until this object is destroyed or the read event is reset to null.)
43 void SetReadEvent(base::WaitableEvent* read_event); 44 void SetReadEvent(base::WaitableEvent* read_event);
44 45
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:
(...skipping 10 matching lines...) Expand all
60 base::WaitableEvent* read_event_ MOJO_GUARDED_BY(mutex_); 61 base::WaitableEvent* read_event_ MOJO_GUARDED_BY(mutex_);
61 62
62 MOJO_DISALLOW_COPY_AND_ASSIGN(TestChannelEndpointClient); 63 MOJO_DISALLOW_COPY_AND_ASSIGN(TestChannelEndpointClient);
63 }; 64 };
64 65
65 } // namespace test 66 } // namespace test
66 } // namespace system 67 } // namespace system
67 } // namespace mojo 68 } // namespace mojo
68 69
69 #endif // MOJO_EDK_SYSTEM_TEST_CHANNEL_ENDPOINT_CLIENT_H_ 70 #endif // MOJO_EDK_SYSTEM_TEST_CHANNEL_ENDPOINT_CLIENT_H_
OLDNEW
« no previous file with comments | « mojo/edk/system/slave_connection_manager.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