Chromium Code Reviews| Index: blimp/net/blimp_message_buffer.h |
| diff --git a/blimp/net/blimp_message_buffer.h b/blimp/net/blimp_message_buffer.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a6389bbc68b5416ffb365e4fee3b097ec50ea43b |
| --- /dev/null |
| +++ b/blimp/net/blimp_message_buffer.h |
| @@ -0,0 +1,51 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef BLIMP_NET_BLIMP_MESSAGE_BUFFER_H_ |
| +#define BLIMP_NET_BLIMP_MESSAGE_BUFFER_H_ |
| + |
| +#include "base/macros.h" |
| +#include "blimp/net/blimp_message_ack_observer.h" |
| +#include "blimp/net/blimp_message_processor.h" |
| + |
| +namespace blimp { |
| + |
| +class BlimpConnection; |
| + |
| +// 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.
|
| +// Messages are available for redelivery until they are acknowledged by the |
| +// receiving end (via BlimpMessageAckObserver). |
| +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.
|
| + public BlimpMessageAckObserver { |
| + public: |
| + BlimpMessageBuffer(); |
| + |
| + ~BlimpMessageBuffer() override; |
| + |
| + // Sets the processor for receiving messages from this buffer. |
| + void SetOutgoingMessageProcessor(scoped_ptr<BlimpMessageProcessor> processor); |
| + |
| + // BlimpMessageProcessor implementation. |
| + // |callback|, if set, will be called once the remote end has acknowledged the |
| + // receipt of |message|. |
| + // A sequence of N dependent writes with one acknowledgement can be had by |
| + // calling ProcessMessage() N-1 times with an empty |callback|, then |
| + // calling the final (Nth) message with |callback| set. |
| + 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
|
| + const net::CompletionCallback& callback) override; |
| + |
| + // MessageAckObserver implementation. |
| + // Removes BlimpMessages from the buffer whose ID is less than or equal to |
| + // |message_id|. |
| + // Invokes outstanding CompletionCallbacks for previously unacknowledged |
| + // messages which have an ID less than or equal to |message_id|. |
| + void OnMessageAck(int64 message_id) override; |
|
haibinlu
2015/11/04 00:41:26
private?
Kevin M
2015/11/04 20:09:02
Ditto
|
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(BlimpMessageBuffer); |
| +}; |
| + |
| +} // namespace blimp |
| + |
| +#endif // BLIMP_NET_BLIMP_MESSAGE_BUFFER_H_ |