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

Side by Side Diff: remoting/host/desktop_session_proxy.h

Issue 12096071: Adding a unit test to verify the IPC channel between the network and desktop processes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix posix #2 Created 7 years, 10 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 | « remoting/host/desktop_session_connector.h ('k') | remoting/host/desktop_session_proxy.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 #ifndef REMOTING_HOST_DESKTOP_SESSION_PROXY_H_ 5 #ifndef REMOTING_HOST_DESKTOP_SESSION_PROXY_H_
6 #define REMOTING_HOST_DESKTOP_SESSION_PROXY_H_ 6 #define REMOTING_HOST_DESKTOP_SESSION_PROXY_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
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/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/process.h"
14 #include "ipc/ipc_listener.h" 15 #include "ipc/ipc_listener.h"
15 #include "ipc/ipc_platform_file.h" 16 #include "ipc/ipc_platform_file.h"
16 #include "media/video/capture/screen/screen_capturer.h" 17 #include "media/video/capture/screen/screen_capturer.h"
17 #include "media/video/capture/screen/shared_buffer.h" 18 #include "media/video/capture/screen/shared_buffer.h"
18 #include "remoting/host/desktop_environment.h" 19 #include "remoting/host/desktop_environment.h"
19 #include "remoting/proto/event.pb.h" 20 #include "remoting/proto/event.pb.h"
20 #include "remoting/protocol/clipboard_stub.h" 21 #include "remoting/protocol/clipboard_stub.h"
21 #include "third_party/skia/include/core/SkRegion.h" 22 #include "third_party/skia/include/core/SkRegion.h"
22 23
23 #if defined(OS_WIN)
24 #include "base/win/scoped_handle.h"
25 #endif
26
27 namespace base { 24 namespace base {
28 class SingleThreadTaskRunner; 25 class SingleThreadTaskRunner;
29 } // namespace base 26 } // namespace base
30 27
31 namespace IPC { 28 namespace IPC {
32 class ChannelProxy; 29 class ChannelProxy;
33 class Message; 30 class Message;
34 } // namespace IPC 31 } // namespace IPC
35 32
36 struct SerializedCapturedData; 33 struct SerializedCapturedData;
37 34
38 namespace remoting { 35 namespace remoting {
39 36
40 class AudioPacket; 37 class AudioPacket;
41 class ClientSession; 38 class ClientSession;
42 class IpcAudioCapturer; 39 class IpcAudioCapturer;
43 class IpcVideoFrameCapturer; 40 class IpcVideoFrameCapturer;
44 41
45 // This class routes calls to the DesktopEnvironment's stubs though the IPC 42 // This class routes calls to the DesktopEnvironment's stubs though the IPC
46 // channel to the DesktopSessionAgent instance running in the desktop 43 // channel to the DesktopSessionAgent instance running in the desktop
47 // integration process. 44 // integration process.
48 class DesktopSessionProxy 45 class DesktopSessionProxy
49 : public base::RefCountedThreadSafe<DesktopSessionProxy>, 46 : public base::RefCountedThreadSafe<DesktopSessionProxy>,
50 public IPC::Listener { 47 public IPC::Listener {
51 public: 48 public:
52 DesktopSessionProxy( 49 DesktopSessionProxy(
53 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, 50 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
51 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
54 const std::string& client_jid, 52 const std::string& client_jid,
55 const base::Closure& disconnect_callback); 53 const base::Closure& disconnect_callback);
56 54
57 // Mirrors DesktopEnvironment. 55 // Mirrors DesktopEnvironment.
58 scoped_ptr<AudioCapturer> CreateAudioCapturer( 56 scoped_ptr<AudioCapturer> CreateAudioCapturer(
59 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner); 57 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner);
60 scoped_ptr<EventExecutor> CreateEventExecutor( 58 scoped_ptr<EventExecutor> CreateEventExecutor(
61 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, 59 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
62 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); 60 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner);
63 scoped_ptr<media::ScreenCapturer> CreateVideoCapturer( 61 scoped_ptr<media::ScreenCapturer> CreateVideoCapturer(
64 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner, 62 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner,
65 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner); 63 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner);
66 64
67 // IPC::Listener implementation. 65 // IPC::Listener implementation.
68 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 66 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
69 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; 67 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
70 virtual void OnChannelError() OVERRIDE; 68 virtual void OnChannelError() OVERRIDE;
71 69
72 // Connects to the desktop session agent. 70 // Connects to the desktop session agent.
73 bool AttachToDesktop(IPC::PlatformFileForTransit desktop_process, 71 bool AttachToDesktop(base::ProcessHandle desktop_process,
74 IPC::PlatformFileForTransit desktop_pipe); 72 IPC::PlatformFileForTransit desktop_pipe);
75 73
76 // Closes the connection to the desktop session agent and cleans up 74 // Closes the connection to the desktop session agent and cleans up
77 // the associated resources. 75 // the associated resources.
78 void DetachFromDesktop(); 76 void DetachFromDesktop();
79 77
80 // Disconnects the client session that owns |this|. 78 // Disconnects the client session that owns |this|.
81 void DisconnectSession(); 79 void DisconnectSession();
82 80
83 // Stores |audio_capturer| to be used to post captured audio packets. 81 // Stores |audio_capturer| to be used to post captured audio packets.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 // deleted if the channel is broken. 149 // deleted if the channel is broken.
152 void SendToDesktop(IPC::Message* message); 150 void SendToDesktop(IPC::Message* message);
153 151
154 // Task runner on which methods of |audio_capturer_| will be invoked. 152 // Task runner on which methods of |audio_capturer_| will be invoked.
155 scoped_refptr<base::SingleThreadTaskRunner> audio_capture_task_runner_; 153 scoped_refptr<base::SingleThreadTaskRunner> audio_capture_task_runner_;
156 154
157 // Task runner on which public methods of this class should be called (unless 155 // Task runner on which public methods of this class should be called (unless
158 // it is documented otherwise). 156 // it is documented otherwise).
159 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_; 157 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_;
160 158
159 // Task runner used for running background I/O.
160 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
161
161 // Task runner on which methods of |video_capturer_| will be invoked. 162 // Task runner on which methods of |video_capturer_| will be invoked.
162 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner_; 163 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner_;
163 164
164 // Points to the audio capturer receiving captured audio packets. 165 // Points to the audio capturer receiving captured audio packets.
165 IpcAudioCapturer* audio_capturer_; 166 IpcAudioCapturer* audio_capturer_;
166 167
167 // Points to the client stub passed to StartEventExecutor(). 168 // Points to the client stub passed to StartEventExecutor().
168 scoped_ptr<protocol::ClipboardStub> client_clipboard_; 169 scoped_ptr<protocol::ClipboardStub> client_clipboard_;
169 170
170 // JID of the client session. 171 // JID of the client session.
171 std::string client_jid_; 172 std::string client_jid_;
172 173
173 // IPC channel to the desktop session agent. 174 // IPC channel to the desktop session agent.
174 scoped_ptr<IPC::ChannelProxy> desktop_channel_; 175 scoped_ptr<IPC::ChannelProxy> desktop_channel_;
175 176
176 // Disconnects the client session when invoked. 177 // Disconnects the client session when invoked.
177 base::Closure disconnect_callback_; 178 base::Closure disconnect_callback_;
178 179
179 #if defined(OS_WIN)
180 // Handle of the desktop process. 180 // Handle of the desktop process.
181 base::win::ScopedHandle desktop_process_; 181 base::ProcessHandle desktop_process_;
182 #endif // defined(OS_WIN)
183 182
184 int pending_capture_frame_requests_; 183 int pending_capture_frame_requests_;
185 184
186 typedef std::map<int, scoped_refptr<media::SharedBuffer> > SharedBuffers; 185 typedef std::map<int, scoped_refptr<media::SharedBuffer> > SharedBuffers;
187 SharedBuffers shared_buffers_; 186 SharedBuffers shared_buffers_;
188 187
189 // Points to the video capturer receiving captured video frames. 188 // Points to the video capturer receiving captured video frames.
190 IpcVideoFrameCapturer* video_capturer_; 189 IpcVideoFrameCapturer* video_capturer_;
191 190
192 DISALLOW_COPY_AND_ASSIGN(DesktopSessionProxy); 191 DISALLOW_COPY_AND_ASSIGN(DesktopSessionProxy);
193 }; 192 };
194 193
195 } // namespace remoting 194 } // namespace remoting
196 195
197 #endif // REMOTING_HOST_DESKTOP_SESSION_PROXY_H_ 196 #endif // REMOTING_HOST_DESKTOP_SESSION_PROXY_H_
OLDNEW
« no previous file with comments | « remoting/host/desktop_session_connector.h ('k') | remoting/host/desktop_session_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698