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); | |
40 | 39 |
41 // Packetizer::Listener implementation. | 40 // Packetizer::Listener implementation. |
42 virtual void OnConnection(ConnectionKey key) OVERRIDE; | 41 virtual void OnConnection(ConnectionKey key) OVERRIDE; |
43 virtual void OnClose(Packetizer* packetizer, ConnectionKey key); | 42 virtual void OnClose(Packetizer* packetizer, ConnectionKey key); |
44 virtual void OnMessage(Packetizer* packetizer, | 43 virtual void OnMessage(Packetizer* packetizer, |
45 ConnectionKey key, | 44 ConnectionKey key, |
46 unsigned char* msg, | 45 unsigned char* msg, |
47 size_t length) OVERRIDE; | 46 size_t length) OVERRIDE; |
48 | 47 |
49 protected: | 48 protected: |
(...skipping 15 matching lines...) Expand all Loading... |
65 void SendMessage(int64 position); | 64 void SendMessage(int64 position); |
66 void RecvMessage(); | 65 void RecvMessage(); |
67 void SendAck(uint32 last_message_received); | 66 void SendAck(uint32 last_message_received); |
68 | 67 |
69 RttAndSendRateCalculator rtt_; | 68 RttAndSendRateCalculator rtt_; |
70 Packetizer* packetizer_; | 69 Packetizer* packetizer_; |
71 | 70 |
72 // The send_buffer is a list of pending data to pack into messages and send | 71 // The send_buffer is a list of pending data to pack into messages and send |
73 // to the remote. | 72 // to the remote. |
74 CircularBuffer send_buffer_; | 73 CircularBuffer send_buffer_; |
75 OldCompletionCallback* old_send_complete_callback_; | 74 OldCompletionCallback* send_complete_callback_; |
76 CompletionCallback send_complete_callback_; | |
77 scoped_refptr<IOBuffer> pending_send_; | 75 scoped_refptr<IOBuffer> pending_send_; |
78 int pending_send_length_; | 76 int pending_send_length_; |
79 | 77 |
80 // The read_buffer is a list of pending data which has been unpacked from | 78 // The read_buffer is a list of pending data which has been unpacked from |
81 // messages and is awaiting delivery to the application. | 79 // messages and is awaiting delivery to the application. |
82 OldCompletionCallback* old_receive_complete_callback_; | 80 OldCompletionCallback* old_receive_complete_callback_; |
83 CompletionCallback receive_complete_callback_; | 81 CompletionCallback receive_complete_callback_; |
84 scoped_refptr<IOBuffer> pending_receive_; | 82 scoped_refptr<IOBuffer> pending_receive_; |
85 int pending_receive_length_; | 83 int pending_receive_length_; |
86 | 84 |
(...skipping 11 matching lines...) Expand all Loading... |
98 | 96 |
99 OldCompletionCallbackImpl<Messenger> send_message_callback_; | 97 OldCompletionCallbackImpl<Messenger> send_message_callback_; |
100 | 98 |
101 ScopedRunnableMethodFactory<Messenger> factory_; | 99 ScopedRunnableMethodFactory<Messenger> factory_; |
102 DISALLOW_COPY_AND_ASSIGN(Messenger); | 100 DISALLOW_COPY_AND_ASSIGN(Messenger); |
103 }; | 101 }; |
104 | 102 |
105 } // namespace net | 103 } // namespace net |
106 | 104 |
107 #endif // NET_CURVECP_MESSENGER_H_ | 105 #endif // NET_CURVECP_MESSENGER_H_ |
OLD | NEW |