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_MULTIPLEXER_H_ | |
| 6 #define BLIMP_NET_BLIMP_MESSAGE_MULTIPLEXER_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "blimp/common/proto/blimp_message.pb.h" | |
| 11 #include "blimp/net/blimp_message_processor.h" | |
| 12 #include "net/base/completion_callback.h" | |
| 13 | |
| 14 namespace blimp { | |
| 15 | |
| 16 class BlimpConnection; | |
| 17 class BlimpMessageBuffer; | |
| 18 | |
| 19 // Creates MessageProcessors that take outgoing messages and multiplex them | |
| 20 // on to a single output message processor. | |
| 21 class BlimpMessageMultiplexer : private BlimpMessageProcessor { | |
| 22 public: | |
| 23 explicit BlimpMessageMultiplexer(scoped_ptr<BlimpMessageProcessor> output); | |
| 24 | |
| 25 ~BlimpMessageMultiplexer() override; | |
| 26 | |
| 27 // Creates a BlimpMessageProcessor object that may only receive messages of | |
| 28 // type |type|. This object is used by features for sending messages. | |
| 29 scoped_ptr<BlimpMessageProcessor> CreateReceiverForType( | |
|
haibinlu
2015/11/04 00:41:26
use "receiver" and "processor" consistently?
Kevin M
2015/11/04 20:09:02
Done.
| |
| 30 BlimpMessage::Type type); | |
| 31 | |
| 32 private: | |
| 33 class MultiplexedSender : public BlimpMessageProcessor { | |
| 34 public: | |
| 35 MultiplexedSender(BlimpMessageBuffer* output, BlimpMessage::Type type); | |
| 36 | |
| 37 ~MultiplexedSender() override; | |
| 38 | |
| 39 // BlimpMessageProcessor implementation. | |
| 40 void ProcessMessage(const BlimpMessage& message, | |
| 41 const net::CompletionCallback& callback) override; | |
| 42 | |
| 43 private: | |
| 44 DISALLOW_COPY_AND_ASSIGN(MultiplexedSender); | |
| 45 }; | |
| 46 friend class MultiplexedSender; | |
| 47 | |
| 48 // BlimpMessageProcessor implementation. | |
| 49 // Private linkage so that only MultiplexedSender may call it. | |
| 50 void ProcessMessage(const BlimpMessage& message, | |
| 51 const net::CompletionCallback& callback) override; | |
| 52 | |
| 53 DISALLOW_COPY_AND_ASSIGN(BlimpMessageMultiplexer); | |
| 54 }; | |
| 55 | |
| 56 } // namespace blimp | |
| 57 | |
| 58 #endif // BLIMP_NET_BLIMP_MESSAGE_MULTIPLEXER_H_ | |
| OLD | NEW |