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

Side by Side Diff: remoting/client/chromoting_client.h

Issue 4476003: Add VideoPacket struct for video packets. Refactor Decode interface to use it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed compilation on windows and mac Created 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 // ChromotingClient is the controller for the Client implementation. 5 // ChromotingClient is the controller for the Client implementation.
6 6
7 #ifndef REMOTING_CLIENT_CHROMOTING_CLIENT_H 7 #ifndef REMOTING_CLIENT_CHROMOTING_CLIENT_H
8 #define REMOTING_CLIENT_CHROMOTING_CLIENT_H 8 #define REMOTING_CLIENT_CHROMOTING_CLIENT_H
9 9
10 #include <list> 10 #include <list>
11 11
12 #include "base/task.h" 12 #include "base/task.h"
13 #include "remoting/client/client_config.h" 13 #include "remoting/client/client_config.h"
14 #include "remoting/client/chromoting_view.h" 14 #include "remoting/client/chromoting_view.h"
15 #include "remoting/protocol/connection_to_host.h" 15 #include "remoting/protocol/connection_to_host.h"
16 #include "remoting/protocol/video_stub.h" 16 #include "remoting/protocol/video_stub.h"
17 17
18 class MessageLoop; 18 class MessageLoop;
19 19
20 namespace remoting { 20 namespace remoting {
21 21
22 class ChromotingHostMessage;
23 class ClientContext; 22 class ClientContext;
24 class InitClientMessage;
25 class InputHandler; 23 class InputHandler;
26 class RectangleUpdateDecoder; 24 class RectangleUpdateDecoder;
27 25
28 // TODO(sergeyu): Move VideoStub implementation to RectangleUpdateDecoder. 26 // TODO(sergeyu): Move VideoStub implementation to RectangleUpdateDecoder.
29 class ChromotingClient : public protocol::ConnectionToHost::HostEventCallback, 27 class ChromotingClient : public protocol::ConnectionToHost::HostEventCallback,
30 public protocol::VideoStub { 28 public protocol::VideoStub {
31 public: 29 public:
32 // Objects passed in are not owned by this class. 30 // Objects passed in are not owned by this class.
33 ChromotingClient(const ClientConfig& config, 31 ChromotingClient(const ClientConfig& config,
34 ClientContext* context, 32 ClientContext* context,
(...skipping 13 matching lines...) Expand all
48 46
49 // Sets the viewport to do display. The viewport may be larger and/or 47 // Sets the viewport to do display. The viewport may be larger and/or
50 // smaller than the actual image background being displayed. 48 // smaller than the actual image background being displayed.
51 // 49 //
52 // TODO(ajwong): This doesn't make sense to have here. We're going to have 50 // TODO(ajwong): This doesn't make sense to have here. We're going to have
53 // threading isseus since pepper view needs to be called from the main pepper 51 // threading isseus since pepper view needs to be called from the main pepper
54 // thread synchronously really. 52 // thread synchronously really.
55 virtual void SetViewport(int x, int y, int width, int height); 53 virtual void SetViewport(int x, int y, int width, int height);
56 54
57 // ConnectionToHost::HostEventCallback implementation. 55 // ConnectionToHost::HostEventCallback implementation.
58 virtual void HandleMessage(protocol::ConnectionToHost* conn,
59 ChromotingHostMessage* messages);
60 virtual void OnConnectionOpened(protocol::ConnectionToHost* conn); 56 virtual void OnConnectionOpened(protocol::ConnectionToHost* conn);
61 virtual void OnConnectionClosed(protocol::ConnectionToHost* conn); 57 virtual void OnConnectionClosed(protocol::ConnectionToHost* conn);
62 virtual void OnConnectionFailed(protocol::ConnectionToHost* conn); 58 virtual void OnConnectionFailed(protocol::ConnectionToHost* conn);
63 59
64 // VideoStub implementation. 60 // VideoStub implementation.
65 virtual void ProcessVideoPacket(const VideoPacket* packet, Task* done); 61 virtual void ProcessVideoPacket(const VideoPacket* packet, Task* done);
66 62
67 private: 63 private:
68 struct QueuedVideoPacket { 64 struct QueuedVideoPacket {
69 QueuedVideoPacket(const VideoPacket* packet, Task* done) 65 QueuedVideoPacket(const VideoPacket* packet, Task* done)
70 : packet(packet), done(done) { 66 : packet(packet), done(done) {
71 } 67 }
72 const VideoPacket* packet; 68 const VideoPacket* packet;
73 Task* done; 69 Task* done;
74 }; 70 };
75 71
76 MessageLoop* message_loop(); 72 MessageLoop* message_loop();
77 73
74 // Initializes connection.
75 void Initialize();
awong 2010/11/09 01:54:38 Minor annoyance unrelated to this CL, but we shoul
Sergey Ulanov 2010/11/09 21:34:42 Agree
76
78 // Convenience method for modifying the state on this object's message loop. 77 // Convenience method for modifying the state on this object's message loop.
79 void SetConnectionState(ConnectionState s); 78 void SetConnectionState(ConnectionState s);
80 79
81 // If a packet is not being processed, dispatches a single message from the 80 // If a packet is not being processed, dispatches a single message from the
82 // |received_packets_| queue. 81 // |received_packets_| queue.
83 void DispatchPacket(); 82 void DispatchPacket();
84 83
85 void OnPacketDone(); 84 void OnPacketDone();
86 85
87 // Handles for chromotocol messages.
88 void InitClient(const InitClientMessage& msg);
89
90 // The following are not owned by this class. 86 // The following are not owned by this class.
91 ClientConfig config_; 87 ClientConfig config_;
92 ClientContext* context_; 88 ClientContext* context_;
93 protocol::ConnectionToHost* connection_; 89 protocol::ConnectionToHost* connection_;
94 ChromotingView* view_; 90 ChromotingView* view_;
95 RectangleUpdateDecoder* rectangle_decoder_; 91 RectangleUpdateDecoder* rectangle_decoder_;
96 InputHandler* input_handler_; 92 InputHandler* input_handler_;
97 93
98 // If non-NULL, this is called when the client is done. 94 // If non-NULL, this is called when the client is done.
99 CancelableTask* client_done_; 95 CancelableTask* client_done_;
(...skipping 11 matching lines...) Expand all
111 bool packet_being_processed_; 107 bool packet_being_processed_;
112 108
113 DISALLOW_COPY_AND_ASSIGN(ChromotingClient); 109 DISALLOW_COPY_AND_ASSIGN(ChromotingClient);
114 }; 110 };
115 111
116 } // namespace remoting 112 } // namespace remoting
117 113
118 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::ChromotingClient); 114 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::ChromotingClient);
119 115
120 #endif // REMOTING_CLIENT_CHROMOTING_CLIENT_H 116 #endif // REMOTING_CLIENT_CHROMOTING_CLIENT_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698