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 #include "remoting/protocol/chromium_socket_factory.h" | 5 #include "remoting/protocol/chromium_socket_factory.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "jingle/glue/utils.h" | 10 #include "jingle/glue/utils.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 // Maximum amount of data in the send buffers. This is necessary to | 27 // Maximum amount of data in the send buffers. This is necessary to |
28 // prevent out-of-memory crashes if the caller sends data faster than | 28 // prevent out-of-memory crashes if the caller sends data faster than |
29 // Pepper's UDP API can handle it. This maximum should never be | 29 // Pepper's UDP API can handle it. This maximum should never be |
30 // reached under normal conditions. | 30 // reached under normal conditions. |
31 const int kMaxSendBufferSize = 256 * 1024; | 31 const int kMaxSendBufferSize = 256 * 1024; |
32 | 32 |
33 class UdpPacketSocket : public rtc::AsyncPacketSocket { | 33 class UdpPacketSocket : public rtc::AsyncPacketSocket { |
34 public: | 34 public: |
35 UdpPacketSocket(); | 35 UdpPacketSocket(); |
36 virtual ~UdpPacketSocket(); | 36 ~UdpPacketSocket() override; |
37 | 37 |
38 bool Init(const rtc::SocketAddress& local_address, | 38 bool Init(const rtc::SocketAddress& local_address, |
39 int min_port, int max_port); | 39 int min_port, int max_port); |
40 | 40 |
41 // rtc::AsyncPacketSocket interface. | 41 // rtc::AsyncPacketSocket interface. |
42 virtual rtc::SocketAddress GetLocalAddress() const override; | 42 rtc::SocketAddress GetLocalAddress() const override; |
43 virtual rtc::SocketAddress GetRemoteAddress() const override; | 43 rtc::SocketAddress GetRemoteAddress() const override; |
44 virtual int Send(const void* data, size_t data_size, | 44 int Send(const void* data, |
45 const rtc::PacketOptions& options) override; | 45 size_t data_size, |
46 virtual int SendTo(const void* data, size_t data_size, | 46 const rtc::PacketOptions& options) override; |
47 const rtc::SocketAddress& address, | 47 int SendTo(const void* data, |
48 const rtc::PacketOptions& options) override; | 48 size_t data_size, |
49 virtual int Close() override; | 49 const rtc::SocketAddress& address, |
50 virtual State GetState() const override; | 50 const rtc::PacketOptions& options) override; |
51 virtual int GetOption(rtc::Socket::Option option, int* value) override; | 51 int Close() override; |
52 virtual int SetOption(rtc::Socket::Option option, int value) override; | 52 State GetState() const override; |
53 virtual int GetError() const override; | 53 int GetOption(rtc::Socket::Option option, int* value) override; |
54 virtual void SetError(int error) override; | 54 int SetOption(rtc::Socket::Option option, int value) override; |
| 55 int GetError() const override; |
| 56 void SetError(int error) override; |
55 | 57 |
56 private: | 58 private: |
57 struct PendingPacket { | 59 struct PendingPacket { |
58 PendingPacket(const void* buffer, | 60 PendingPacket(const void* buffer, |
59 int buffer_size, | 61 int buffer_size, |
60 const net::IPEndPoint& address); | 62 const net::IPEndPoint& address); |
61 | 63 |
62 scoped_refptr<net::IOBufferWithSize> data; | 64 scoped_refptr<net::IOBufferWithSize> data; |
63 net::IPEndPoint address; | 65 net::IPEndPoint address; |
64 bool retried; | 66 bool retried; |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 return NULL; | 390 return NULL; |
389 } | 391 } |
390 | 392 |
391 rtc::AsyncResolverInterface* | 393 rtc::AsyncResolverInterface* |
392 ChromiumPacketSocketFactory::CreateAsyncResolver() { | 394 ChromiumPacketSocketFactory::CreateAsyncResolver() { |
393 return new rtc::AsyncResolver(); | 395 return new rtc::AsyncResolver(); |
394 } | 396 } |
395 | 397 |
396 } // namespace protocol | 398 } // namespace protocol |
397 } // namespace remoting | 399 } // namespace remoting |
OLD | NEW |