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

Side by Side Diff: jingle/glue/channel_socket_adapter.h

Issue 8801005: base::Bind: Convert Socket::Read. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 9 years 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 | Annotate | Revision Log
OLDNEW
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/socket/socket.h" 9 #include "net/socket/socket.h"
10 #include "third_party/libjingle/source/talk/base/socketaddress.h" 10 #include "third_party/libjingle/source/talk/base/socketaddress.h"
(...skipping 15 matching lines...) Expand all
26 public: 26 public:
27 // TransportChannel object is always owned by the corresponding session. 27 // TransportChannel object is always owned by the corresponding session.
28 explicit TransportChannelSocketAdapter(cricket::TransportChannel* channel); 28 explicit TransportChannelSocketAdapter(cricket::TransportChannel* channel);
29 virtual ~TransportChannelSocketAdapter(); 29 virtual ~TransportChannelSocketAdapter();
30 30
31 // Closes the stream. |error_code| specifies error code that will 31 // Closes the stream. |error_code| specifies error code that will
32 // be returned by Read() and Write() after the stream is closed. 32 // be returned by Read() and Write() after the stream is closed.
33 // Must be called before the session and the channel are destroyed. 33 // Must be called before the session and the channel are destroyed.
34 void Close(int error_code); 34 void Close(int error_code);
35 35
36 // Socket interface. 36 // Socket implementation.
37 virtual int Read(net::IOBuffer* buf, int buf_len, 37 virtual int Read(net::IOBuffer* buf, int buf_len,
38 net::OldCompletionCallback* callback) OVERRIDE; 38 net::OldCompletionCallback* callback) OVERRIDE;
39 virtual int Read(net::IOBuffer* buf, int buf_len,
40 const net::CompletionCallback& callback) OVERRIDE;
39 virtual int Write(net::IOBuffer* buf, int buf_len, 41 virtual int Write(net::IOBuffer* buf, int buf_len,
40 net::OldCompletionCallback* callback) OVERRIDE; 42 net::OldCompletionCallback* callback) OVERRIDE;
41 43
42 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; 44 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE;
43 virtual bool SetSendBufferSize(int32 size) OVERRIDE; 45 virtual bool SetSendBufferSize(int32 size) OVERRIDE;
44 46
45 private: 47 private:
46 void OnNewPacket(cricket::TransportChannel* channel, 48 void OnNewPacket(cricket::TransportChannel* channel,
47 const char* data, size_t data_size); 49 const char* data, size_t data_size);
48 void OnWritableState(cricket::TransportChannel* channel); 50 void OnWritableState(cricket::TransportChannel* channel);
49 void OnChannelDestroyed(cricket::TransportChannel* channel); 51 void OnChannelDestroyed(cricket::TransportChannel* channel);
50 52
51 MessageLoop* message_loop_; 53 MessageLoop* message_loop_;
52 54
53 cricket::TransportChannel* channel_; 55 cricket::TransportChannel* channel_;
54 56
55 net::OldCompletionCallback* read_callback_; // Not owned. 57 net::OldCompletionCallback* old_read_callback_; // Not owned.
58 net::CompletionCallback read_callback_;
James Hawkins 2011/12/07 00:01:57 #include "net/base/completion_callback.h"
James Hawkins 2011/12/07 00:08:11 Done.
56 scoped_refptr<net::IOBuffer> read_buffer_; 59 scoped_refptr<net::IOBuffer> read_buffer_;
57 int read_buffer_size_; 60 int read_buffer_size_;
58 61
59 net::OldCompletionCallback* write_callback_; // Not owned. 62 net::OldCompletionCallback* write_callback_; // Not owned.
60 scoped_refptr<net::IOBuffer> write_buffer_; 63 scoped_refptr<net::IOBuffer> write_buffer_;
61 int write_buffer_size_; 64 int write_buffer_size_;
62 65
63 int closed_error_code_; 66 int closed_error_code_;
64 67
65 DISALLOW_COPY_AND_ASSIGN(TransportChannelSocketAdapter); 68 DISALLOW_COPY_AND_ASSIGN(TransportChannelSocketAdapter);
66 }; 69 };
67 70
68 } // namespace jingle_glue 71 } // namespace jingle_glue
69 72
70 #endif // JINGLE_GLUE_CHANNEL_SOCKET_ADAPTER_H_ 73 #endif // JINGLE_GLUE_CHANNEL_SOCKET_ADAPTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698