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

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

Issue 10454018: MessageLoopProxy cleanups in remoting client. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 months 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
« no previous file with comments | « no previous file | remoting/client/chromoting_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/callback.h" 12 #include "base/callback.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/time.h" 14 #include "base/time.h"
15 #include "remoting/client/client_config.h" 15 #include "remoting/client/client_config.h"
16 #include "remoting/client/chromoting_stats.h" 16 #include "remoting/client/chromoting_stats.h"
17 #include "remoting/client/chromoting_view.h" 17 #include "remoting/client/chromoting_view.h"
18 #include "remoting/protocol/client_stub.h" 18 #include "remoting/protocol/client_stub.h"
19 #include "remoting/protocol/clipboard_stub.h" 19 #include "remoting/protocol/clipboard_stub.h"
20 #include "remoting/protocol/connection_to_host.h" 20 #include "remoting/protocol/connection_to_host.h"
21 #include "remoting/protocol/input_stub.h" 21 #include "remoting/protocol/input_stub.h"
22 #include "remoting/protocol/video_stub.h" 22 #include "remoting/protocol/video_stub.h"
23 #include "remoting/jingle_glue/xmpp_proxy.h" 23 #include "remoting/jingle_glue/xmpp_proxy.h"
24 24
25 class MessageLoop; 25 namespace base {
26 class SingleThreadTaskRunner;
27 } // namespace base
26 28
27 namespace remoting { 29 namespace remoting {
28 30
29 namespace protocol { 31 namespace protocol {
30 class TransportFactory; 32 class TransportFactory;
31 } // namespace protocol 33 } // namespace protocol
32 34
33 class ClientContext;
34 class RectangleUpdateDecoder; 35 class RectangleUpdateDecoder;
35 36
36 // TODO(sergeyu): Move VideoStub implementation to RectangleUpdateDecoder. 37 // TODO(sergeyu): Move VideoStub implementation to RectangleUpdateDecoder.
37 class ChromotingClient : public protocol::ConnectionToHost::HostEventCallback, 38 class ChromotingClient : public protocol::ConnectionToHost::HostEventCallback,
38 public protocol::ClientStub, 39 public protocol::ClientStub,
39 public protocol::VideoStub { 40 public protocol::VideoStub {
40 public: 41 public:
41 // Objects passed in are not owned by this class. 42 // Objects passed in are not owned by this class.
42 ChromotingClient(const ClientConfig& config, 43 ChromotingClient(const ClientConfig& config,
43 ClientContext* context, 44 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
44 protocol::ConnectionToHost* connection, 45 protocol::ConnectionToHost* connection,
45 ChromotingView* view, 46 ChromotingView* view,
46 RectangleUpdateDecoder* rectangle_decoder, 47 RectangleUpdateDecoder* rectangle_decoder);
47 const base::Closure& client_done);
48 virtual ~ChromotingClient(); 48 virtual ~ChromotingClient();
49 49
50 // Start/stop the client. Must be called on the main thread.
50 void Start(scoped_refptr<XmppProxy> xmpp_proxy, 51 void Start(scoped_refptr<XmppProxy> xmpp_proxy,
51 scoped_ptr<protocol::TransportFactory> transport_factory); 52 scoped_ptr<protocol::TransportFactory> transport_factory);
52 void Stop(const base::Closure& shutdown_task); 53 void Stop(const base::Closure& shutdown_task);
53 void ClientDone();
54 54
55 // Return the stats recorded by this client. 55 // Return the stats recorded by this client.
56 ChromotingStats* GetStats(); 56 ChromotingStats* GetStats();
57 57
58 // ClipboardStub implementation for receiving clipboard data from host. 58 // ClipboardStub implementation for receiving clipboard data from host.
59 virtual void InjectClipboardEvent(const protocol::ClipboardEvent& event) 59 virtual void InjectClipboardEvent(const protocol::ClipboardEvent& event)
60 OVERRIDE; 60 OVERRIDE;
61 61
62 // CursorShapeStub implementation for receiving cursor shape updates. 62 // CursorShapeStub implementation for receiving cursor shape updates.
63 virtual void SetCursorShape(const protocol::CursorShapeInfo& cursor_shape) 63 virtual void SetCursorShape(const protocol::CursorShapeInfo& cursor_shape)
(...skipping 11 matching lines...) Expand all
75 75
76 private: 76 private:
77 struct QueuedVideoPacket { 77 struct QueuedVideoPacket {
78 QueuedVideoPacket(scoped_ptr<VideoPacket> packet, 78 QueuedVideoPacket(scoped_ptr<VideoPacket> packet,
79 const base::Closure& done); 79 const base::Closure& done);
80 ~QueuedVideoPacket(); 80 ~QueuedVideoPacket();
81 VideoPacket* packet; 81 VideoPacket* packet;
82 base::Closure done; 82 base::Closure done;
83 }; 83 };
84 84
85 base::MessageLoopProxy* message_loop();
86
87 // Initializes connection. 85 // Initializes connection.
88 void Initialize(); 86 void Initialize();
89 87
90 // If a packet is not being processed, dispatches a single message from the 88 // If a packet is not being processed, dispatches a single message from the
91 // |received_packets_| queue. 89 // |received_packets_| queue.
92 void DispatchPacket(); 90 void DispatchPacket();
93 91
94 // Callback method when a VideoPacket is processed. 92 // Callback method when a VideoPacket is processed.
95 // If |last_packet| is true then |decode_start| contains the timestamp when 93 // If |last_packet| is true then |decode_start| contains the timestamp when
96 // the packet will start to be processed. 94 // the packet will start to be processed.
97 void OnPacketDone(bool last_packet, base::Time decode_start); 95 void OnPacketDone(bool last_packet, base::Time decode_start);
98 96
99 void OnDisconnected(const base::Closure& shutdown_task); 97 void OnDisconnected(const base::Closure& shutdown_task);
100 98
101 // The following are not owned by this class. 99 // The following are not owned by this class.
102 ClientConfig config_; 100 ClientConfig config_;
103 ClientContext* context_; 101 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
104 protocol::ConnectionToHost* connection_; 102 protocol::ConnectionToHost* connection_;
105 ChromotingView* view_; 103 ChromotingView* view_;
106 RectangleUpdateDecoder* rectangle_decoder_; 104 RectangleUpdateDecoder* rectangle_decoder_;
107 105
108 // If non-NULL, this is called when the client is done. 106 // If non-NULL, this is called when the client is done.
109 base::Closure client_done_; 107 base::Closure client_done_;
110 108
111 // Contains all video packets that have been received, but have not yet been 109 // Contains all video packets that have been received, but have not yet been
112 // processed. 110 // processed.
113 // 111 //
(...skipping 13 matching lines...) Expand all
127 // WeakPtr used to avoid tasks accessing the client after it is deleted. 125 // WeakPtr used to avoid tasks accessing the client after it is deleted.
128 base::WeakPtrFactory<ChromotingClient> weak_factory_; 126 base::WeakPtrFactory<ChromotingClient> weak_factory_;
129 base::WeakPtr<ChromotingClient> weak_ptr_; 127 base::WeakPtr<ChromotingClient> weak_ptr_;
130 128
131 DISALLOW_COPY_AND_ASSIGN(ChromotingClient); 129 DISALLOW_COPY_AND_ASSIGN(ChromotingClient);
132 }; 130 };
133 131
134 } // namespace remoting 132 } // namespace remoting
135 133
136 #endif // REMOTING_CLIENT_CHROMOTING_CLIENT_H_ 134 #endif // REMOTING_CLIENT_CHROMOTING_CLIENT_H_
OLDNEW
« no previous file with comments | « no previous file | remoting/client/chromoting_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698