Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1699)

Unified Diff: blimp/net/blimp_message_output_buffer.h

Issue 1429193002: Add interfaces for most major Blimp net components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address wez's feedback. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: blimp/net/blimp_message_output_buffer.h
diff --git a/blimp/net/blimp_message_output_buffer.h b/blimp/net/blimp_message_output_buffer.h
new file mode 100644
index 0000000000000000000000000000000000000000..03c9beb9e345f55b62b5fa9d1a7fb0f34bc06561
--- /dev/null
+++ b/blimp/net/blimp_message_output_buffer.h
@@ -0,0 +1,53 @@
+// 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_OUTPUT_BUFFER_H_
+#define BLIMP_NET_BLIMP_MESSAGE_OUTPUT_BUFFER_H_
+
+#include "base/macros.h"
+#include "blimp/net/blimp_message_checkpoint_observer.h"
+#include "blimp/net/blimp_message_processor.h"
+#include "blimp/net/blimp_net_export.h"
+
+namespace blimp {
+
+class BlimpConnection;
+
+// Provides a FIFO buffer for reliable, ordered message delivery.
+// Messages are retained for redelivery until they are acknowledged by the
+// receiving end (via BlimpMessageAckObserver).
+// (Redelivery will be used in a future CL to implement Fast Recovery
+// of dropped connections.)
+class BLIMP_NET_EXPORT BlimpMessageOutputBuffer
+ : public BlimpMessageProcessor,
+ public BlimpMessageCheckpointObserver {
+ public:
+ BlimpMessageOutputBuffer();
+ ~BlimpMessageOutputBuffer() override;
+
+ // Sets the processor to receive messages from this buffer.
+ void set_outgoing_message_processor(BlimpMessageProcessor* processor) {
+ 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.
+ }
+
+ // BlimpMessageProcessor implementation.
+ // |callback|, if set, will be called once the remote end has acknowledged the
+ // receipt of |message|.
+ void ProcessMessage(const BlimpMessage& message,
+ const net::CompletionCallback& callback) override;
+
+ // MessageCheckpointObserver implementation.
+ // Flushes acknowledged messages from the buffer and invokes their
+ // |callbacks|, if any.
+ // Callbacks should not destroy |this| so as to not interfere with the
+ // processing of any other pending callbacks.
+ void OnMessageCheckpoint(int64 message_id) override;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(BlimpMessageOutputBuffer);
+};
+
+} // namespace blimp
+
+#endif // BLIMP_NET_BLIMP_MESSAGE_OUTPUT_BUFFER_H_

Powered by Google App Engine
This is Rietveld 408576698