| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_HOST_CLIENT_CONNECTION_H_ | 5 #ifndef REMOTING_HOST_CLIENT_CONNECTION_H_ |
| 6 #define REMOTING_HOST_CLIENT_CONNECTION_H_ | 6 #define REMOTING_HOST_CLIENT_CONNECTION_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // Constructs a ClientConnection object. |message_loop| is the message loop | 55 // Constructs a ClientConnection object. |message_loop| is the message loop |
| 56 // that this object runs on. A viewer object receives events and messages from | 56 // that this object runs on. A viewer object receives events and messages from |
| 57 // a libjingle channel, these events are delegated to |handler|. | 57 // a libjingle channel, these events are delegated to |handler|. |
| 58 // It is guranteed that |handler| is called only on the |message_loop|. | 58 // It is guranteed that |handler| is called only on the |message_loop|. |
| 59 ClientConnection(MessageLoop* message_loop, | 59 ClientConnection(MessageLoop* message_loop, |
| 60 ProtocolDecoder* decoder, | 60 ProtocolDecoder* decoder, |
| 61 EventHandler* handler); | 61 EventHandler* handler); |
| 62 | 62 |
| 63 virtual ~ClientConnection(); | 63 virtual ~ClientConnection(); |
| 64 | 64 |
| 65 // Creates a DataBuffer object that wraps around HostMessage. The DataBuffer |
| 66 // object will be responsible for serializing and framing the message. |
| 67 // DataBuffer will also own |msg| after this call. |
| 68 static scoped_refptr<media::DataBuffer> CreateWireFormatDataBuffer( |
| 69 const HostMessage* msg); |
| 70 |
| 65 virtual void set_jingle_channel(JingleChannel* channel) { | 71 virtual void set_jingle_channel(JingleChannel* channel) { |
| 66 channel_ = channel; | 72 channel_ = channel; |
| 67 } | 73 } |
| 68 | 74 |
| 69 // Returns the channel in use. | 75 // Returns the channel in use. |
| 70 virtual JingleChannel* jingle_channel() { return channel_; } | 76 virtual JingleChannel* jingle_channel() { return channel_; } |
| 71 | 77 |
| 72 // Send information to the client for initialization. | 78 // Send information to the client for initialization. |
| 73 virtual void SendInitClientMessage(int width, int height); | 79 virtual void SendInitClientMessage(int width, int height); |
| 74 | 80 |
| 75 // Notifies the viewer the start of an update stream. | 81 // Notifies the viewer the start of an update stream. |
| 76 virtual void SendBeginUpdateStreamMessage(); | 82 virtual void SendBeginUpdateStreamMessage(); |
| 77 | 83 |
| 78 // Send encoded update stream data to the viewer. The viewer | 84 // Send encoded update stream data to the viewer. |
| 79 // should not take ownership of the data. | 85 // |
| 86 // |data| is the actual bytes in wire format. That means it is fully framed |
| 87 // and serialized from a HostMessage. This is a special case only for |
| 88 // UpdateStreamPacket to reduce the amount of memory copies. |
| 89 // |
| 90 // |data| should be created by calling to |
| 91 // CreateWireFormatDataBuffer(HostMessage). |
| 80 virtual void SendUpdateStreamPacketMessage( | 92 virtual void SendUpdateStreamPacketMessage( |
| 81 const UpdateStreamPacketHeader* header, | |
| 82 scoped_refptr<media::DataBuffer> data); | 93 scoped_refptr<media::DataBuffer> data); |
| 83 | 94 |
| 84 // Notifies the viewer the update stream has ended. | 95 // Notifies the viewer the update stream has ended. |
| 85 virtual void SendEndUpdateStreamMessage(); | 96 virtual void SendEndUpdateStreamMessage(); |
| 86 | 97 |
| 87 // Gets the number of update stream messages not yet transmitted. | 98 // Gets the number of update stream messages not yet transmitted. |
| 88 // Note that the value returned is an estimate using average size of the | 99 // Note that the value returned is an estimate using average size of the |
| 89 // most recent update streams. | 100 // most recent update streams. |
| 90 // TODO(hclam): Report this number accurately. | 101 // TODO(hclam): Report this number accurately. |
| 91 virtual int GetPendingUpdateStreamMessages(); | 102 virtual int GetPendingUpdateStreamMessages(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 146 |
| 136 // Event handler for handling events sent from this object. | 147 // Event handler for handling events sent from this object. |
| 137 EventHandler* handler_; | 148 EventHandler* handler_; |
| 138 | 149 |
| 139 DISALLOW_COPY_AND_ASSIGN(ClientConnection); | 150 DISALLOW_COPY_AND_ASSIGN(ClientConnection); |
| 140 }; | 151 }; |
| 141 | 152 |
| 142 } // namespace remoting | 153 } // namespace remoting |
| 143 | 154 |
| 144 #endif // REMOTING_HOST_CLIENT_CONNECTION_H_ | 155 #endif // REMOTING_HOST_CLIENT_CONNECTION_H_ |
| OLD | NEW |