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 NET_CURVECP_MESSENGER_H_ | 5 #ifndef NET_CURVECP_MESSENGER_H_ |
6 #define NET_CURVECP_MESSENGER_H_ | 6 #define NET_CURVECP_MESSENGER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <deque> | 9 #include <deque> |
10 #include <list> | 10 #include <list> |
(...skipping 18 matching lines...) Expand all Loading... |
29 // The messenger provides the reliable CurveCP transport. | 29 // The messenger provides the reliable CurveCP transport. |
30 class Messenger : public base::NonThreadSafe, | 30 class Messenger : public base::NonThreadSafe, |
31 public Packetizer::Listener { | 31 public Packetizer::Listener { |
32 public: | 32 public: |
33 explicit Messenger(Packetizer* packetizer); | 33 explicit Messenger(Packetizer* packetizer); |
34 virtual ~Messenger(); | 34 virtual ~Messenger(); |
35 | 35 |
36 int Read(IOBuffer* buf, int buf_len, OldCompletionCallback* callback); | 36 int Read(IOBuffer* buf, int buf_len, OldCompletionCallback* callback); |
37 int Read(IOBuffer* buf, int buf_len, const CompletionCallback& callback); | 37 int Read(IOBuffer* buf, int buf_len, const CompletionCallback& callback); |
38 int Write(IOBuffer* buf, int buf_len, OldCompletionCallback* callback); | 38 int Write(IOBuffer* buf, int buf_len, OldCompletionCallback* callback); |
| 39 int Write(IOBuffer* buf, int buf_len, const CompletionCallback& callback); |
39 | 40 |
40 // Packetizer::Listener implementation. | 41 // Packetizer::Listener implementation. |
41 virtual void OnConnection(ConnectionKey key) OVERRIDE; | 42 virtual void OnConnection(ConnectionKey key) OVERRIDE; |
42 virtual void OnClose(Packetizer* packetizer, ConnectionKey key); | 43 virtual void OnClose(Packetizer* packetizer, ConnectionKey key); |
43 virtual void OnMessage(Packetizer* packetizer, | 44 virtual void OnMessage(Packetizer* packetizer, |
44 ConnectionKey key, | 45 ConnectionKey key, |
45 unsigned char* msg, | 46 unsigned char* msg, |
46 size_t length) OVERRIDE; | 47 size_t length) OVERRIDE; |
47 | 48 |
48 protected: | 49 protected: |
(...skipping 15 matching lines...) Expand all Loading... |
64 void SendMessage(int64 position); | 65 void SendMessage(int64 position); |
65 void RecvMessage(); | 66 void RecvMessage(); |
66 void SendAck(uint32 last_message_received); | 67 void SendAck(uint32 last_message_received); |
67 | 68 |
68 RttAndSendRateCalculator rtt_; | 69 RttAndSendRateCalculator rtt_; |
69 Packetizer* packetizer_; | 70 Packetizer* packetizer_; |
70 | 71 |
71 // The send_buffer is a list of pending data to pack into messages and send | 72 // The send_buffer is a list of pending data to pack into messages and send |
72 // to the remote. | 73 // to the remote. |
73 CircularBuffer send_buffer_; | 74 CircularBuffer send_buffer_; |
74 OldCompletionCallback* send_complete_callback_; | 75 OldCompletionCallback* old_send_complete_callback_; |
| 76 CompletionCallback send_complete_callback_; |
75 scoped_refptr<IOBuffer> pending_send_; | 77 scoped_refptr<IOBuffer> pending_send_; |
76 int pending_send_length_; | 78 int pending_send_length_; |
77 | 79 |
78 // The read_buffer is a list of pending data which has been unpacked from | 80 // The read_buffer is a list of pending data which has been unpacked from |
79 // messages and is awaiting delivery to the application. | 81 // messages and is awaiting delivery to the application. |
80 OldCompletionCallback* old_receive_complete_callback_; | 82 OldCompletionCallback* old_receive_complete_callback_; |
81 CompletionCallback receive_complete_callback_; | 83 CompletionCallback receive_complete_callback_; |
82 scoped_refptr<IOBuffer> pending_receive_; | 84 scoped_refptr<IOBuffer> pending_receive_; |
83 int pending_receive_length_; | 85 int pending_receive_length_; |
84 | 86 |
(...skipping 11 matching lines...) Expand all Loading... |
96 | 98 |
97 OldCompletionCallbackImpl<Messenger> send_message_callback_; | 99 OldCompletionCallbackImpl<Messenger> send_message_callback_; |
98 | 100 |
99 ScopedRunnableMethodFactory<Messenger> factory_; | 101 ScopedRunnableMethodFactory<Messenger> factory_; |
100 DISALLOW_COPY_AND_ASSIGN(Messenger); | 102 DISALLOW_COPY_AND_ASSIGN(Messenger); |
101 }; | 103 }; |
102 | 104 |
103 } // namespace net | 105 } // namespace net |
104 | 106 |
105 #endif // NET_CURVECP_MESSENGER_H_ | 107 #endif // NET_CURVECP_MESSENGER_H_ |
OLD | NEW |