OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 REMOTING_PROTOCOL_FAKE_DATAGRAM_SOCKET_H_ | 5 #ifndef REMOTING_PROTOCOL_FAKE_DATAGRAM_SOCKET_H_ |
6 #define REMOTING_PROTOCOL_FAKE_DATAGRAM_SOCKET_H_ | 6 #define REMOTING_PROTOCOL_FAKE_DATAGRAM_SOCKET_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
| 9 #include <memory> |
9 #include <string> | 10 #include <string> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "net/base/completion_callback.h" | 15 #include "net/base/completion_callback.h" |
16 #include "remoting/protocol/datagram_channel_factory.h" | 16 #include "remoting/protocol/datagram_channel_factory.h" |
17 #include "remoting/protocol/p2p_datagram_socket.h" | 17 #include "remoting/protocol/p2p_datagram_socket.h" |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 class SingleThreadTaskRunner; | 20 class SingleThreadTaskRunner; |
21 } | 21 } |
22 | 22 |
23 namespace remoting { | 23 namespace remoting { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 FakeDatagramSocket* GetFakeChannel(const std::string& name); | 116 FakeDatagramSocket* GetFakeChannel(const std::string& name); |
117 | 117 |
118 // DatagramChannelFactory interface. | 118 // DatagramChannelFactory interface. |
119 void CreateChannel(const std::string& name, | 119 void CreateChannel(const std::string& name, |
120 const ChannelCreatedCallback& callback) override; | 120 const ChannelCreatedCallback& callback) override; |
121 void CancelChannelCreation(const std::string& name) override; | 121 void CancelChannelCreation(const std::string& name) override; |
122 | 122 |
123 private: | 123 private: |
124 typedef std::map<std::string, base::WeakPtr<FakeDatagramSocket> > ChannelsMap; | 124 typedef std::map<std::string, base::WeakPtr<FakeDatagramSocket> > ChannelsMap; |
125 | 125 |
126 void NotifyChannelCreated(scoped_ptr<FakeDatagramSocket> owned_socket, | 126 void NotifyChannelCreated(std::unique_ptr<FakeDatagramSocket> owned_socket, |
127 const std::string& name, | 127 const std::string& name, |
128 const ChannelCreatedCallback& callback); | 128 const ChannelCreatedCallback& callback); |
129 | 129 |
130 base::WeakPtr<FakeDatagramChannelFactory> peer_factory_; | 130 base::WeakPtr<FakeDatagramChannelFactory> peer_factory_; |
131 | 131 |
132 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 132 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
133 bool asynchronous_create_; | 133 bool asynchronous_create_; |
134 ChannelsMap channels_; | 134 ChannelsMap channels_; |
135 | 135 |
136 bool fail_create_; | 136 bool fail_create_; |
137 | 137 |
138 base::WeakPtrFactory<FakeDatagramChannelFactory> weak_factory_; | 138 base::WeakPtrFactory<FakeDatagramChannelFactory> weak_factory_; |
139 | 139 |
140 DISALLOW_COPY_AND_ASSIGN(FakeDatagramChannelFactory); | 140 DISALLOW_COPY_AND_ASSIGN(FakeDatagramChannelFactory); |
141 }; | 141 }; |
142 | 142 |
143 } // namespace protocol | 143 } // namespace protocol |
144 } // namespace remoting | 144 } // namespace remoting |
145 | 145 |
146 #endif // REMOTING_PROTOCOL_FAKE_DATAGRAM_SOCKET_H_ | 146 #endif // REMOTING_PROTOCOL_FAKE_DATAGRAM_SOCKET_H_ |
OLD | NEW |