Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ | 5 #ifndef REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ |
| 6 #define REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ | 6 #define REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
| 14 #include "base/synchronization/lock.h" | |
| 14 #include "remoting/protocol/session.h" | 15 #include "remoting/protocol/session.h" |
| 15 #include "remoting/protocol/video_writer.h" | 16 #include "remoting/protocol/video_writer.h" |
| 16 | 17 |
| 17 namespace remoting { | 18 namespace remoting { |
| 18 namespace protocol { | 19 namespace protocol { |
| 19 | 20 |
| 20 class ClientStub; | 21 class ClientStub; |
| 21 class HostStub; | 22 class HostStub; |
| 22 class InputStub; | 23 class InputStub; |
| 23 class HostMessageDispatcher; | 24 class HostMessageDispatcher; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 35 virtual ~EventHandler() {} | 36 virtual ~EventHandler() {} |
| 36 | 37 |
| 37 // Called when the network connection is opened. | 38 // Called when the network connection is opened. |
| 38 virtual void OnConnectionOpened(ConnectionToClient* connection) = 0; | 39 virtual void OnConnectionOpened(ConnectionToClient* connection) = 0; |
| 39 | 40 |
| 40 // Called when the network connection is closed. | 41 // Called when the network connection is closed. |
| 41 virtual void OnConnectionClosed(ConnectionToClient* connection) = 0; | 42 virtual void OnConnectionClosed(ConnectionToClient* connection) = 0; |
| 42 | 43 |
| 43 // Called when the network connection has failed. | 44 // Called when the network connection has failed. |
| 44 virtual void OnConnectionFailed(ConnectionToClient* connection) = 0; | 45 virtual void OnConnectionFailed(ConnectionToClient* connection) = 0; |
| 46 | |
| 47 // Called when sequence number is updated. | |
| 48 virtual void OnSequenceNumberUpdated(ConnectionToClient* connection, | |
| 49 int64 sequence_number) = 0; | |
| 45 }; | 50 }; |
| 46 | 51 |
| 47 // Constructs a ConnectionToClient object. |message_loop| is the message loop | 52 // Constructs a ConnectionToClient object. |message_loop| is the message loop |
| 48 // that this object runs on. A viewer object receives events and messages from | 53 // that this object runs on. A viewer object receives events and messages from |
| 49 // a libjingle channel, these events are delegated to |handler|. | 54 // a libjingle channel, these events are delegated to |handler|. |
| 50 // It is guaranteed that |handler| is called only on the |message_loop|. | 55 // It is guaranteed that |handler| is called only on the |message_loop|. |
| 51 ConnectionToClient(MessageLoop* message_loop, | 56 ConnectionToClient(MessageLoop* message_loop, |
| 52 EventHandler* handler); | 57 EventHandler* handler); |
| 53 | 58 |
| 54 virtual void Init(Session* session); | 59 virtual void Init(Session* session); |
| 55 | 60 |
| 56 // Returns the connection in use. | 61 // Returns the connection in use. |
| 57 virtual Session* session(); | 62 virtual Session* session(); |
| 58 | 63 |
| 59 // Disconnect the client connection. This method is allowed to be called | 64 // Disconnect the client connection. This method is allowed to be called |
| 60 // more than once and calls after the first one will be ignored. | 65 // more than once and calls after the first one will be ignored. |
| 61 // | 66 // |
| 62 // After this method is called all the send method calls will be ignored. | 67 // After this method is called all the send method calls will be ignored. |
| 63 virtual void Disconnect(); | 68 virtual void Disconnect(); |
| 64 | 69 |
| 70 // Update the sequence number when received from the client. EventHandler | |
| 71 // will be called. | |
| 72 virtual void UpdateSequenceNumber(int64 sequence_number); | |
| 73 | |
| 65 // Send encoded update stream data to the viewer. | 74 // Send encoded update stream data to the viewer. |
| 66 virtual VideoStub* video_stub(); | 75 virtual VideoStub* video_stub(); |
| 67 | 76 |
| 68 // Return pointer to ClientStub. | 77 // Return pointer to ClientStub. |
| 69 virtual ClientStub* client_stub(); | 78 virtual ClientStub* client_stub(); |
| 70 | 79 |
| 71 // These two setters should be called before Init(). | 80 // These two setters should be called before Init(). |
| 72 virtual void set_host_stub(HostStub* host_stub); | 81 virtual void set_host_stub(HostStub* host_stub); |
| 73 virtual void set_input_stub(InputStub* input_stub); | 82 virtual void set_input_stub(InputStub* input_stub); |
| 74 | 83 |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 101 | 110 |
| 102 // HostStub for receiving control events from the client. | 111 // HostStub for receiving control events from the client. |
| 103 HostStub* host_stub_; | 112 HostStub* host_stub_; |
| 104 | 113 |
| 105 // InputStub for receiving input events from the client. | 114 // InputStub for receiving input events from the client. |
| 106 InputStub* input_stub_; | 115 InputStub* input_stub_; |
| 107 | 116 |
| 108 // Dispatcher for submitting messages to stubs. | 117 // Dispatcher for submitting messages to stubs. |
| 109 scoped_ptr<HostMessageDispatcher> dispatcher_; | 118 scoped_ptr<HostMessageDispatcher> dispatcher_; |
| 110 | 119 |
| 120 // Sequence number received from client to trace performance. | |
| 121 int sequence_number_; | |
|
simonmorris
2011/04/05 10:47:06
Not needed.
Alpha Left Google
2011/04/08 00:07:20
Done.
| |
| 122 | |
| 111 DISALLOW_COPY_AND_ASSIGN(ConnectionToClient); | 123 DISALLOW_COPY_AND_ASSIGN(ConnectionToClient); |
| 112 }; | 124 }; |
| 113 | 125 |
| 114 } // namespace protocol | 126 } // namespace protocol |
| 115 } // namespace remoting | 127 } // namespace remoting |
| 116 | 128 |
| 117 #endif // REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ | 129 #endif // REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ |
| OLD | NEW |