OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef BLIMP_NET_BLIMP_MESSAGE_BUFFER_H_ | |
6 #define BLIMP_NET_BLIMP_MESSAGE_BUFFER_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "blimp/net/blimp_message_ack_observer.h" | |
10 #include "blimp/net/blimp_message_processor.h" | |
11 | |
12 namespace blimp { | |
13 | |
14 class BlimpConnection; | |
15 | |
16 // Provides a reliable, ordered outgoing message buffer. | |
haibinlu
2015/11/04 00:41:26
"reliable message buffer" ? or, this buffer is jus
Kevin M
2015/11/04 20:09:02
Done.
| |
17 // Messages are available for redelivery until they are acknowledged by the | |
18 // receiving end (via BlimpMessageAckObserver). | |
19 class BlimpMessageBuffer : public BlimpMessageProcessor, | |
haibinlu
2015/11/04 00:41:26
BlimpOutgoingMessageBuffer? so it is clear that th
Kevin M
2015/11/04 20:09:01
That might be chopping up the terms a bit too much
haibinlu
2015/11/04 20:33:20
BlimpMessageOutputBuffer sgtm.
| |
20 public BlimpMessageAckObserver { | |
21 public: | |
22 BlimpMessageBuffer(); | |
23 | |
24 ~BlimpMessageBuffer() override; | |
25 | |
26 // Sets the processor for receiving messages from this buffer. | |
27 void SetOutgoingMessageProcessor(scoped_ptr<BlimpMessageProcessor> processor); | |
28 | |
29 // BlimpMessageProcessor implementation. | |
30 // |callback|, if set, will be called once the remote end has acknowledged the | |
31 // receipt of |message|. | |
32 // A sequence of N dependent writes with one acknowledgement can be had by | |
33 // calling ProcessMessage() N-1 times with an empty |callback|, then | |
34 // calling the final (Nth) message with |callback| set. | |
35 void ProcessMessage(const BlimpMessage& message, | |
haibinlu
2015/11/04 00:41:26
private ?
Kevin M
2015/11/04 20:09:01
I think this should be public, because this is the
| |
36 const net::CompletionCallback& callback) override; | |
37 | |
38 // MessageAckObserver implementation. | |
39 // Removes BlimpMessages from the buffer whose ID is less than or equal to | |
40 // |message_id|. | |
41 // Invokes outstanding CompletionCallbacks for previously unacknowledged | |
42 // messages which have an ID less than or equal to |message_id|. | |
43 void OnMessageAck(int64 message_id) override; | |
haibinlu
2015/11/04 00:41:26
private?
Kevin M
2015/11/04 20:09:02
Ditto
| |
44 | |
45 private: | |
46 DISALLOW_COPY_AND_ASSIGN(BlimpMessageBuffer); | |
47 }; | |
48 | |
49 } // namespace blimp | |
50 | |
51 #endif // BLIMP_NET_BLIMP_MESSAGE_BUFFER_H_ | |
OLD | NEW |