OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_PEPPER_TRANSPORT_SOCKET_ADAPTER_H_ | 5 #ifndef REMOTING_PROTOCOL_PEPPER_TRANSPORT_SOCKET_ADAPTER_H_ |
6 #define REMOTING_PROTOCOL_PEPPER_TRANSPORT_SOCKET_ADAPTER_H_ | 6 #define REMOTING_PROTOCOL_PEPPER_TRANSPORT_SOCKET_ADAPTER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 Observer* observer); | 43 Observer* observer); |
44 virtual ~PepperTransportSocketAdapter(); | 44 virtual ~PepperTransportSocketAdapter(); |
45 | 45 |
46 const std::string& name() { return name_; } | 46 const std::string& name() { return name_; } |
47 | 47 |
48 // Adds candidate received from the peer. | 48 // Adds candidate received from the peer. |
49 void AddRemoteCandidate(const std::string& candidate); | 49 void AddRemoteCandidate(const std::string& candidate); |
50 | 50 |
51 // net::Socket implementation. | 51 // net::Socket implementation. |
52 virtual int Read(net::IOBuffer* buf, int buf_len, | 52 virtual int Read(net::IOBuffer* buf, int buf_len, |
53 net::OldCompletionCallback* callback) OVERRIDE; | |
54 virtual int Read(net::IOBuffer* buf, int buf_len, | |
55 const net::CompletionCallback& callback) OVERRIDE; | 53 const net::CompletionCallback& callback) OVERRIDE; |
56 virtual int Write(net::IOBuffer* buf, int buf_len, | 54 virtual int Write(net::IOBuffer* buf, int buf_len, |
57 net::OldCompletionCallback* callback) OVERRIDE; | 55 const net::CompletionCallback& callback) OVERRIDE; |
58 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; | 56 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; |
59 virtual bool SetSendBufferSize(int32 size) OVERRIDE; | 57 virtual bool SetSendBufferSize(int32 size) OVERRIDE; |
60 | 58 |
61 // net::StreamSocket implementation. | 59 // net::StreamSocket implementation. |
62 virtual int Connect(net::OldCompletionCallback* callback) OVERRIDE; | |
63 virtual int Connect(const net::CompletionCallback& callback) OVERRIDE; | 60 virtual int Connect(const net::CompletionCallback& callback) OVERRIDE; |
64 virtual void Disconnect() OVERRIDE; | 61 virtual void Disconnect() OVERRIDE; |
65 virtual bool IsConnected() const OVERRIDE; | 62 virtual bool IsConnected() const OVERRIDE; |
66 virtual bool IsConnectedAndIdle() const OVERRIDE; | 63 virtual bool IsConnectedAndIdle() const OVERRIDE; |
67 virtual int GetPeerAddress(net::AddressList* address) const OVERRIDE; | 64 virtual int GetPeerAddress(net::AddressList* address) const OVERRIDE; |
68 virtual int GetLocalAddress(net::IPEndPoint* address) const OVERRIDE; | 65 virtual int GetLocalAddress(net::IPEndPoint* address) const OVERRIDE; |
69 virtual const net::BoundNetLog& NetLog() const OVERRIDE; | 66 virtual const net::BoundNetLog& NetLog() const OVERRIDE; |
70 virtual void SetSubresourceSpeculation() OVERRIDE; | 67 virtual void SetSubresourceSpeculation() OVERRIDE; |
71 virtual void SetOmniboxSpeculation() OVERRIDE; | 68 virtual void SetOmniboxSpeculation() OVERRIDE; |
72 virtual bool WasEverUsed() const OVERRIDE; | 69 virtual bool WasEverUsed() const OVERRIDE; |
73 virtual bool UsingTCPFastOpen() const OVERRIDE; | 70 virtual bool UsingTCPFastOpen() const OVERRIDE; |
74 virtual int64 NumBytesRead() const OVERRIDE; | 71 virtual int64 NumBytesRead() const OVERRIDE; |
75 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; | 72 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; |
76 | 73 |
77 private: | 74 private: |
78 // Callbacks for PPAPI calls. | 75 // Callbacks for PPAPI calls. |
79 void OnConnect(int result); | 76 void OnConnect(int result); |
80 void OnNextAddress(int32_t result); | 77 void OnNextAddress(int32_t result); |
81 void OnRead(int32_t result); | 78 void OnRead(int32_t result); |
82 void OnWrite(int32_t result); | 79 void OnWrite(int32_t result); |
83 | 80 |
84 int ProcessCandidates(); | 81 int ProcessCandidates(); |
85 | 82 |
86 std::string name_; | 83 std::string name_; |
87 Observer* observer_; | 84 Observer* observer_; |
88 | 85 |
89 scoped_ptr<pp::Transport_Dev> transport_; | 86 scoped_ptr<pp::Transport_Dev> transport_; |
90 | 87 |
91 net::OldCompletionCallback* old_connect_callback_; | |
92 net::CompletionCallback connect_callback_; | 88 net::CompletionCallback connect_callback_; |
93 bool connected_; | 89 bool connected_; |
94 | 90 |
95 bool get_address_pending_; | 91 bool get_address_pending_; |
96 | 92 |
97 net::OldCompletionCallback* old_read_callback_; | |
98 net::CompletionCallback read_callback_; | 93 net::CompletionCallback read_callback_; |
99 scoped_refptr<net::IOBuffer> read_buffer_; | 94 scoped_refptr<net::IOBuffer> read_buffer_; |
100 | 95 |
101 net::OldCompletionCallback* write_callback_; | 96 net::CompletionCallback write_callback_; |
102 scoped_refptr<net::IOBuffer> write_buffer_; | 97 scoped_refptr<net::IOBuffer> write_buffer_; |
103 | 98 |
104 net::BoundNetLog net_log_; | 99 net::BoundNetLog net_log_; |
105 | 100 |
106 pp::CompletionCallbackFactory<PepperTransportSocketAdapter> callback_factory_; | 101 pp::CompletionCallbackFactory<PepperTransportSocketAdapter> callback_factory_; |
107 | 102 |
108 DISALLOW_COPY_AND_ASSIGN(PepperTransportSocketAdapter); | 103 DISALLOW_COPY_AND_ASSIGN(PepperTransportSocketAdapter); |
109 }; | 104 }; |
110 | 105 |
111 } // namespace protocol | 106 } // namespace protocol |
112 } // namespace remoting | 107 } // namespace remoting |
113 | 108 |
114 #endif // REMOTING_PROTOCOL_PEPPER_TRANSPORT_SOCKET_ADAPTER_H_ | 109 #endif // REMOTING_PROTOCOL_PEPPER_TRANSPORT_SOCKET_ADAPTER_H_ |
OLD | NEW |