Chromium Code Reviews| 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_OUTPUT_BUFFER_H_ | |
| 6 #define BLIMP_NET_BLIMP_MESSAGE_OUTPUT_BUFFER_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "blimp/net/blimp_message_checkpoint_observer.h" | |
| 10 #include "blimp/net/blimp_message_processor.h" | |
| 11 #include "blimp/net/blimp_net_export.h" | |
| 12 | |
| 13 namespace blimp { | |
| 14 | |
| 15 class BlimpConnection; | |
| 16 | |
| 17 // Provides a FIFO buffer for reliable, ordered message delivery. | |
| 18 // Messages are retained for redelivery until they are acknowledged by the | |
| 19 // receiving end (via BlimpMessageAckObserver). | |
| 20 // (Redelivery will be used in a future CL to implement Fast Recovery | |
| 21 // of dropped connections.) | |
| 22 class BLIMP_NET_EXPORT BlimpMessageOutputBuffer | |
| 23 : public BlimpMessageProcessor, | |
| 24 public BlimpMessageCheckpointObserver { | |
| 25 public: | |
| 26 BlimpMessageOutputBuffer(); | |
| 27 ~BlimpMessageOutputBuffer() override; | |
| 28 | |
| 29 // Sets the processor to receive messages from this buffer. | |
| 30 void set_outgoing_message_processor(BlimpMessageProcessor* processor) { | |
| 31 NOTIMPLEMENTED(); | |
|
Wez
2015/11/12 03:45:57
Simple setter is no good if it's not simple. Let's
Kevin M
2015/11/12 19:03:47
Done.
| |
| 32 } | |
| 33 | |
| 34 // BlimpMessageProcessor implementation. | |
| 35 // |callback|, if set, will be called once the remote end has acknowledged the | |
| 36 // receipt of |message|. | |
| 37 void ProcessMessage(const BlimpMessage& message, | |
| 38 const net::CompletionCallback& callback) override; | |
| 39 | |
| 40 // MessageCheckpointObserver implementation. | |
| 41 // Flushes acknowledged messages from the buffer and invokes their | |
| 42 // |callbacks|, if any. | |
| 43 // Callbacks should not destroy |this| so as to not interfere with the | |
| 44 // processing of any other pending callbacks. | |
| 45 void OnMessageCheckpoint(int64 message_id) override; | |
| 46 | |
| 47 private: | |
| 48 DISALLOW_COPY_AND_ASSIGN(BlimpMessageOutputBuffer); | |
| 49 }; | |
| 50 | |
| 51 } // namespace blimp | |
| 52 | |
| 53 #endif // BLIMP_NET_BLIMP_MESSAGE_OUTPUT_BUFFER_H_ | |
| OLD | NEW |