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

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

Issue 11778049: Making DesktopEnvironment a factory class used by ClientSession to create audio/video capturers and… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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
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 "ipc/ipc_listener.h" 14 #include "ipc/ipc_listener.h"
15 #include "ipc/ipc_platform_file.h" 15 #include "ipc/ipc_platform_file.h"
16 #include "remoting/capturer/shared_buffer.h" 16 #include "remoting/capturer/shared_buffer.h"
17 #include "remoting/capturer/video_frame_capturer.h" 17 #include "remoting/capturer/video_frame_capturer.h"
18 #include "remoting/host/desktop_environment.h"
18 #include "remoting/proto/event.pb.h" 19 #include "remoting/proto/event.pb.h"
19 #include "remoting/protocol/clipboard_stub.h" 20 #include "remoting/protocol/clipboard_stub.h"
20 #include "third_party/skia/include/core/SkRegion.h" 21 #include "third_party/skia/include/core/SkRegion.h"
21 22
22 #if defined(OS_WIN) 23 #if defined(OS_WIN)
23 #include "base/win/scoped_handle.h" 24 #include "base/win/scoped_handle.h"
24 #endif 25 #endif
25 26
26 namespace base { 27 namespace base {
27 class SingleThreadTaskRunner; 28 class SingleThreadTaskRunner;
(...skipping 11 matching lines...) Expand all
39 class AudioPacket; 40 class AudioPacket;
40 class ClientSession; 41 class ClientSession;
41 class IpcAudioCapturer; 42 class IpcAudioCapturer;
42 class IpcVideoFrameCapturer; 43 class IpcVideoFrameCapturer;
43 44
44 // This class routes calls to the DesktopEnvironment's stubs though the IPC 45 // This class routes calls to the DesktopEnvironment's stubs though the IPC
45 // channel to the DesktopSessionAgent instance running in the desktop 46 // channel to the DesktopSessionAgent instance running in the desktop
46 // integration process. 47 // integration process.
47 class DesktopSessionProxy 48 class DesktopSessionProxy
48 : public base::RefCountedThreadSafe<DesktopSessionProxy>, 49 : public base::RefCountedThreadSafe<DesktopSessionProxy>,
50 public DesktopEnvironment,
49 public IPC::Listener { 51 public IPC::Listener {
50 public: 52 public:
51 DesktopSessionProxy( 53 DesktopSessionProxy(
52 scoped_refptr<base::SingleThreadTaskRunner> audio_capture_task_runner,
53 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, 54 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
54 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner); 55 const std::string& client_jid,
56 const base::Closure& disconnect_callback);
57
58 // DesktopEnvironment implementation.
59 virtual scoped_ptr<AudioCapturer> CreateAudioCapturer(
60 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner) OVERRIDE;
61 virtual scoped_ptr<EventExecutor> CreateEventExecutor(
62 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
63 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) OVERRIDE;
64 virtual scoped_ptr<VideoFrameCapturer> CreateVideoCapturer(
65 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner,
66 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner) OVERRIDE;
55 67
56 // IPC::Listener implementation. 68 // IPC::Listener implementation.
57 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 69 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
58 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; 70 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
59 virtual void OnChannelError() OVERRIDE; 71 virtual void OnChannelError() OVERRIDE;
60 72
61 // Initializes the object. |client_jid| specifies the client session's JID.
62 // |disconnect_callback| specifies a callback that disconnects the client
63 // session when invoked.
64 // Initialize() should be called before AttachToDesktop() is called.
65 void Initialize(const std::string& client_jid,
66 const base::Closure& disconnect_callback);
67
68 // Connects to the desktop session agent. 73 // Connects to the desktop session agent.
69 bool AttachToDesktop(IPC::PlatformFileForTransit desktop_process, 74 bool AttachToDesktop(IPC::PlatformFileForTransit desktop_process,
70 IPC::PlatformFileForTransit desktop_pipe); 75 IPC::PlatformFileForTransit desktop_pipe);
71 76
72 // Closes the connection to the desktop session agent and cleans up 77 // Closes the connection to the desktop session agent and cleans up
73 // the associated resources. 78 // the associated resources.
74 void DetachFromDesktop(); 79 void DetachFromDesktop();
75 80
76 // Disconnects the client session that owns |this|. 81 // Disconnects the client session that owns |this|.
77 void DisconnectSession(); 82 void DisconnectSession();
78 83
79 // APIs used to implement the VideoFrameCapturer interface. These must be
80 // called on |video_capture_task_runner_|.
81 void InvalidateRegion(const SkRegion& invalid_region);
82 void CaptureFrame();
83
84 // Stores |audio_capturer| to be used to post captured audio packets. 84 // Stores |audio_capturer| to be used to post captured audio packets.
85 // |audio_capturer| must be valid until StopAudioCapturer() is called. 85 // |audio_capturer| must be valid until StopAudioCapturer() is called.
86 void StartAudioCapturer(IpcAudioCapturer* audio_capturer); 86 void StartAudioCapturer(IpcAudioCapturer* audio_capturer);
87 87
88 // Clears the cached pointer to the audio capturer. Any packets captured after 88 // Clears the cached pointer to the audio capturer. Any packets captured after
89 // StopAudioCapturer() has been called will be silently dropped. 89 // StopAudioCapturer() has been called will be silently dropped.
90 void StopAudioCapturer(); 90 void StopAudioCapturer();
91 91
92 // APIs used to implement the VideoFrameCapturer interface. These must be
93 // called on |video_capture_task_runner_|.
94 void InvalidateRegion(const SkRegion& invalid_region);
95 void CaptureFrame();
96
92 // Stores |video_capturer| to be used to post captured video frames. 97 // Stores |video_capturer| to be used to post captured video frames.
93 // |video_capturer| must be valid until StopVideoCapturer() is called. 98 // |video_capturer| must be valid until StopVideoCapturer() is called.
94 void StartVideoCapturer(IpcVideoFrameCapturer* video_capturer); 99 void StartVideoCapturer(IpcVideoFrameCapturer* video_capturer);
95 100
96 // Clears the cached pointer to the video capturer. Any frames captured after 101 // Clears the cached pointer to the video capturer. Any frames captured after
97 // StopVideoCapturer() has been called will be silently dropped. 102 // StopVideoCapturer() has been called will be silently dropped.
98 void StopVideoCapturer(); 103 void StopVideoCapturer();
99 104
100 // APIs used to implement the EventExecutor interface. 105 // APIs used to implement the EventExecutor interface.
101 void InjectClipboardEvent(const protocol::ClipboardEvent& event); 106 void InjectClipboardEvent(const protocol::ClipboardEvent& event);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 188
184 // Points to the video capturer receiving captured video frames. 189 // Points to the video capturer receiving captured video frames.
185 IpcVideoFrameCapturer* video_capturer_; 190 IpcVideoFrameCapturer* video_capturer_;
186 191
187 DISALLOW_COPY_AND_ASSIGN(DesktopSessionProxy); 192 DISALLOW_COPY_AND_ASSIGN(DesktopSessionProxy);
188 }; 193 };
189 194
190 } // namespace remoting 195 } // namespace remoting
191 196
192 #endif // REMOTING_HOST_DESKTOP_SESSION_PROXY_H_ 197 #endif // REMOTING_HOST_DESKTOP_SESSION_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698