OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BLIMP_NET_BLIMP_CONNECTION_H_ | 5 #ifndef BLIMP_NET_BLIMP_CONNECTION_H_ |
6 #define BLIMP_NET_BLIMP_CONNECTION_H_ | 6 #define BLIMP_NET_BLIMP_CONNECTION_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 // Sets the processor which will take incoming messages for this connection. | 37 // Sets the processor which will take incoming messages for this connection. |
38 // Can be set multiple times, but previously set processors are discarded. | 38 // Can be set multiple times, but previously set processors are discarded. |
39 // Caller retains the ownership of |processor|. | 39 // Caller retains the ownership of |processor|. |
40 virtual void SetIncomingMessageProcessor(BlimpMessageProcessor* processor); | 40 virtual void SetIncomingMessageProcessor(BlimpMessageProcessor* processor); |
41 | 41 |
42 // Gets a processor for BrowserSession->BlimpConnection message routing. | 42 // Gets a processor for BrowserSession->BlimpConnection message routing. |
43 virtual BlimpMessageProcessor* GetOutgoingMessageProcessor(); | 43 virtual BlimpMessageProcessor* GetOutgoingMessageProcessor(); |
44 | 44 |
45 protected: | 45 protected: |
| 46 class EndConnectionHandler; |
| 47 friend class EndConnectionHandler; |
| 48 |
46 BlimpConnection(); | 49 BlimpConnection(); |
47 | 50 |
48 // ConnectionErrorObserver implementation. | 51 // ConnectionErrorObserver implementation. |
49 void OnConnectionError(int error) override; | 52 void OnConnectionError(int error) override; |
50 | 53 |
51 private: | 54 private: |
52 std::unique_ptr<PacketReader> reader_; | 55 std::unique_ptr<PacketReader> reader_; |
53 std::unique_ptr<BlimpMessagePump> message_pump_; | 56 std::unique_ptr<BlimpMessagePump> message_pump_; |
54 std::unique_ptr<PacketWriter> writer_; | 57 std::unique_ptr<PacketWriter> writer_; |
55 std::unique_ptr<BlimpMessageProcessor> outgoing_msg_processor_; | 58 std::unique_ptr<BlimpMessageProcessor> outgoing_msg_processor_; |
56 base::ObserverList<ConnectionErrorObserver> error_observers_; | 59 base::ObserverList<ConnectionErrorObserver> error_observers_; |
| 60 std::unique_ptr<EndConnectionHandler> end_connection_handler_; |
57 | 61 |
58 DISALLOW_COPY_AND_ASSIGN(BlimpConnection); | 62 DISALLOW_COPY_AND_ASSIGN(BlimpConnection); |
59 }; | 63 }; |
60 | 64 |
61 } // namespace blimp | 65 } // namespace blimp |
62 | 66 |
63 #endif // BLIMP_NET_BLIMP_CONNECTION_H_ | 67 #endif // BLIMP_NET_BLIMP_CONNECTION_H_ |
OLD | NEW |