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 JINGLE_GLUE_CHANNEL_SOCKET_ADAPTER_H_ | 5 #ifndef JINGLE_GLUE_CHANNEL_SOCKET_ADAPTER_H_ |
6 #define JINGLE_GLUE_CHANNEL_SOCKET_ADAPTER_H_ | 6 #define JINGLE_GLUE_CHANNEL_SOCKET_ADAPTER_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "net/base/completion_callback.h" | 9 #include "net/base/completion_callback.h" |
10 #include "net/socket/socket.h" | 10 #include "net/socket/socket.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 // Must be called before the session and the channel are destroyed. | 34 // Must be called before the session and the channel are destroyed. |
35 void Close(int error_code); | 35 void Close(int error_code); |
36 | 36 |
37 // Socket implementation. | 37 // Socket implementation. |
38 virtual int Read(net::IOBuffer* buf, int buf_len, | 38 virtual int Read(net::IOBuffer* buf, int buf_len, |
39 net::OldCompletionCallback* callback) OVERRIDE; | 39 net::OldCompletionCallback* callback) OVERRIDE; |
40 virtual int Read(net::IOBuffer* buf, int buf_len, | 40 virtual int Read(net::IOBuffer* buf, int buf_len, |
41 const net::CompletionCallback& callback) OVERRIDE; | 41 const net::CompletionCallback& callback) OVERRIDE; |
42 virtual int Write(net::IOBuffer* buf, int buf_len, | 42 virtual int Write(net::IOBuffer* buf, int buf_len, |
43 net::OldCompletionCallback* callback) OVERRIDE; | 43 net::OldCompletionCallback* callback) OVERRIDE; |
44 virtual int Write(net::IOBuffer* buf, int buf_len, | |
45 const net::CompletionCallback& callback) OVERRIDE; | |
46 | 44 |
47 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; | 45 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; |
48 virtual bool SetSendBufferSize(int32 size) OVERRIDE; | 46 virtual bool SetSendBufferSize(int32 size) OVERRIDE; |
49 | 47 |
50 private: | 48 private: |
51 void OnNewPacket(cricket::TransportChannel* channel, | 49 void OnNewPacket(cricket::TransportChannel* channel, |
52 const char* data, size_t data_size); | 50 const char* data, size_t data_size); |
53 void OnWritableState(cricket::TransportChannel* channel); | 51 void OnWritableState(cricket::TransportChannel* channel); |
54 void OnChannelDestroyed(cricket::TransportChannel* channel); | 52 void OnChannelDestroyed(cricket::TransportChannel* channel); |
55 | 53 |
56 MessageLoop* message_loop_; | 54 MessageLoop* message_loop_; |
57 | 55 |
58 cricket::TransportChannel* channel_; | 56 cricket::TransportChannel* channel_; |
59 | 57 |
60 net::OldCompletionCallback* old_read_callback_; // Not owned. | 58 net::OldCompletionCallback* old_read_callback_; // Not owned. |
61 net::CompletionCallback read_callback_; | 59 net::CompletionCallback read_callback_; |
62 scoped_refptr<net::IOBuffer> read_buffer_; | 60 scoped_refptr<net::IOBuffer> read_buffer_; |
63 int read_buffer_size_; | 61 int read_buffer_size_; |
64 | 62 |
65 net::OldCompletionCallback* old_write_callback_; // Not owned. | 63 net::OldCompletionCallback* write_callback_; // Not owned. |
66 net::CompletionCallback write_callback_; | |
67 scoped_refptr<net::IOBuffer> write_buffer_; | 64 scoped_refptr<net::IOBuffer> write_buffer_; |
68 int write_buffer_size_; | 65 int write_buffer_size_; |
69 | 66 |
70 int closed_error_code_; | 67 int closed_error_code_; |
71 | 68 |
72 DISALLOW_COPY_AND_ASSIGN(TransportChannelSocketAdapter); | 69 DISALLOW_COPY_AND_ASSIGN(TransportChannelSocketAdapter); |
73 }; | 70 }; |
74 | 71 |
75 } // namespace jingle_glue | 72 } // namespace jingle_glue |
76 | 73 |
77 #endif // JINGLE_GLUE_CHANNEL_SOCKET_ADAPTER_H_ | 74 #endif // JINGLE_GLUE_CHANNEL_SOCKET_ADAPTER_H_ |
OLD | NEW |