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

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

Issue 12047101: Move screen capturers from remoting/capturer to media/video/capturer/screen (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 "media/video/capture/screen/screen_capturer.h"
17 #include "remoting/capturer/video_frame_capturer.h" 17 #include "media/video/capture/screen/shared_buffer.h"
18 #include "remoting/host/desktop_environment.h" 18 #include "remoting/host/desktop_environment.h"
19 #include "remoting/proto/event.pb.h" 19 #include "remoting/proto/event.pb.h"
20 #include "remoting/protocol/clipboard_stub.h" 20 #include "remoting/protocol/clipboard_stub.h"
21 #include "third_party/skia/include/core/SkRegion.h" 21 #include "third_party/skia/include/core/SkRegion.h"
22 22
23 #if defined(OS_WIN) 23 #if defined(OS_WIN)
24 #include "base/win/scoped_handle.h" 24 #include "base/win/scoped_handle.h"
25 #endif 25 #endif
26 26
27 namespace base { 27 namespace base {
(...skipping 26 matching lines...) Expand all
54 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, 54 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
55 const std::string& client_jid, 55 const std::string& client_jid,
56 const base::Closure& disconnect_callback); 56 const base::Closure& disconnect_callback);
57 57
58 // DesktopEnvironment implementation. 58 // DesktopEnvironment implementation.
59 virtual scoped_ptr<AudioCapturer> CreateAudioCapturer( 59 virtual scoped_ptr<AudioCapturer> CreateAudioCapturer(
60 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner) OVERRIDE; 60 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner) OVERRIDE;
61 virtual scoped_ptr<EventExecutor> CreateEventExecutor( 61 virtual scoped_ptr<EventExecutor> CreateEventExecutor(
62 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, 62 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
63 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) OVERRIDE; 63 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) OVERRIDE;
64 virtual scoped_ptr<VideoFrameCapturer> CreateVideoCapturer( 64 virtual scoped_ptr<media::ScreenCapturer> CreateVideoCapturer(
65 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner, 65 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner,
66 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner) OVERRIDE; 66 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner) OVERRIDE;
67 67
68 // IPC::Listener implementation. 68 // IPC::Listener implementation.
69 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 69 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
70 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; 70 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
71 virtual void OnChannelError() OVERRIDE; 71 virtual void OnChannelError() OVERRIDE;
72 72
73 // Connects to the desktop session agent. 73 // Connects to the desktop session agent.
74 bool AttachToDesktop(IPC::PlatformFileForTransit desktop_process, 74 bool AttachToDesktop(IPC::PlatformFileForTransit desktop_process,
75 IPC::PlatformFileForTransit desktop_pipe); 75 IPC::PlatformFileForTransit desktop_pipe);
76 76
77 // Closes the connection to the desktop session agent and cleans up 77 // Closes the connection to the desktop session agent and cleans up
78 // the associated resources. 78 // the associated resources.
79 void DetachFromDesktop(); 79 void DetachFromDesktop();
80 80
81 // Disconnects the client session that owns |this|. 81 // Disconnects the client session that owns |this|.
82 void DisconnectSession(); 82 void DisconnectSession();
83 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 92 // APIs used to implement the media::ScreenCapturer interface. These must be
93 // called on |video_capture_task_runner_|. 93 // called on |video_capture_task_runner_|.
94 void InvalidateRegion(const SkRegion& invalid_region); 94 void InvalidateRegion(const SkRegion& invalid_region);
95 void CaptureFrame(); 95 void CaptureFrame();
96 96
97 // Stores |video_capturer| to be used to post captured video frames. 97 // Stores |video_capturer| to be used to post captured video frames.
98 // |video_capturer| must be valid until StopVideoCapturer() is called. 98 // |video_capturer| must be valid until StopVideoCapturer() is called.
99 void StartVideoCapturer(IpcVideoFrameCapturer* video_capturer); 99 void StartVideoCapturer(IpcVideoFrameCapturer* video_capturer);
100 100
101 // 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
102 // StopVideoCapturer() has been called will be silently dropped. 102 // StopVideoCapturer() has been called will be silently dropped.
103 void StopVideoCapturer(); 103 void StopVideoCapturer();
104 104
105 // APIs used to implement the EventExecutor interface. 105 // APIs used to implement the EventExecutor interface.
106 void InjectClipboardEvent(const protocol::ClipboardEvent& event); 106 void InjectClipboardEvent(const protocol::ClipboardEvent& event);
107 void InjectKeyEvent(const protocol::KeyEvent& event); 107 void InjectKeyEvent(const protocol::KeyEvent& event);
108 void InjectMouseEvent(const protocol::MouseEvent& event); 108 void InjectMouseEvent(const protocol::MouseEvent& event);
109 void StartEventExecutor(scoped_ptr<protocol::ClipboardStub> client_clipboard); 109 void StartEventExecutor(scoped_ptr<protocol::ClipboardStub> client_clipboard);
110 110
111 private: 111 private:
112 friend class base::RefCountedThreadSafe<DesktopSessionProxy>; 112 friend class base::RefCountedThreadSafe<DesktopSessionProxy>;
113 virtual ~DesktopSessionProxy(); 113 virtual ~DesktopSessionProxy();
114 114
115 // Returns a shared buffer from the list of known buffers. 115 // Returns a shared buffer from the list of known buffers.
116 scoped_refptr<SharedBuffer> GetSharedBuffer(int id); 116 scoped_refptr<media::SharedBuffer> GetSharedBuffer(int id);
117 117
118 // Handles AudioPacket notification from the desktop session agent. 118 // Handles AudioPacket notification from the desktop session agent.
119 void OnAudioPacket(const std::string& serialized_packet); 119 void OnAudioPacket(const std::string& serialized_packet);
120 120
121 // Registers a new shared buffer created by the desktop process. 121 // Registers a new shared buffer created by the desktop process.
122 void OnCreateSharedBuffer(int id, 122 void OnCreateSharedBuffer(int id,
123 IPC::PlatformFileForTransit handle, 123 IPC::PlatformFileForTransit handle,
124 uint32 size); 124 uint32 size);
125 125
126 // Drops a cached reference to the shared buffer. 126 // Drops a cached reference to the shared buffer.
127 void OnReleaseSharedBuffer(int id); 127 void OnReleaseSharedBuffer(int id);
128 128
129 // Handles CaptureCompleted notification from the desktop session agent. 129 // Handles CaptureCompleted notification from the desktop session agent.
130 void OnCaptureCompleted(const SerializedCapturedData& serialized_data); 130 void OnCaptureCompleted(const SerializedCapturedData& serialized_data);
131 131
132 // Handles CursorShapeChanged notification from the desktop session agent. 132 // Handles CursorShapeChanged notification from the desktop session agent.
133 void OnCursorShapeChanged(const MouseCursorShape& cursor_shape); 133 void OnCursorShapeChanged(const media::MouseCursorShape& cursor_shape);
134 134
135 // Handles InjectClipboardEvent request from the desktop integration process. 135 // Handles InjectClipboardEvent request from the desktop integration process.
136 void OnInjectClipboardEvent(const std::string& serialized_event); 136 void OnInjectClipboardEvent(const std::string& serialized_event);
137 137
138 // Posted to |audio_capture_task_runner_| to pass a captured audio packet back 138 // Posted to |audio_capture_task_runner_| to pass a captured audio packet back
139 // to |audio_capturer_|. 139 // to |audio_capturer_|.
140 void PostAudioPacket(scoped_ptr<AudioPacket> packet); 140 void PostAudioPacket(scoped_ptr<AudioPacket> packet);
141 141
142 // Posted to |video_capture_task_runner_| to pass a captured video frame back 142 // Posted to |video_capture_task_runner_| to pass a captured video frame back
143 // to |video_capturer_|. 143 // to |video_capturer_|.
144 void PostCaptureCompleted(scoped_refptr<CaptureData> capture_data); 144 void PostCaptureCompleted(
145 scoped_refptr<media::ScreenCaptureData> capture_data);
145 146
146 // Posted to |video_capture_task_runner_| to pass |cursor_shape| back to 147 // Posted to |video_capture_task_runner_| to pass |cursor_shape| back to
147 // |video_capturer_|. 148 // |video_capturer_|.
148 void PostCursorShape(scoped_ptr<MouseCursorShape> cursor_shape); 149 void PostCursorShape(scoped_ptr<media::MouseCursorShape> cursor_shape);
149 150
150 // Sends a message to the desktop session agent. The message is silently 151 // Sends a message to the desktop session agent. The message is silently
151 // deleted if the channel is broken. 152 // deleted if the channel is broken.
152 void SendToDesktop(IPC::Message* message); 153 void SendToDesktop(IPC::Message* message);
153 154
154 // Task runner on which methods of |audio_capturer_| will be invoked. 155 // Task runner on which methods of |audio_capturer_| will be invoked.
155 scoped_refptr<base::SingleThreadTaskRunner> audio_capture_task_runner_; 156 scoped_refptr<base::SingleThreadTaskRunner> audio_capture_task_runner_;
156 157
157 // Task runner on which public methods of this class should be called (unless 158 // Task runner on which public methods of this class should be called (unless
158 // it is documented otherwise). 159 // it is documented otherwise).
(...skipping 17 matching lines...) Expand all
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 #if defined(OS_WIN)
180 // Handle of the desktop process. 181 // Handle of the desktop process.
181 base::win::ScopedHandle desktop_process_; 182 base::win::ScopedHandle desktop_process_;
182 #endif // defined(OS_WIN) 183 #endif // defined(OS_WIN)
183 184
184 int pending_capture_frame_requests_; 185 int pending_capture_frame_requests_;
185 186
186 typedef std::map<int, scoped_refptr<SharedBuffer> > SharedBuffers; 187 typedef std::map<int, scoped_refptr<media::SharedBuffer> > SharedBuffers;
187 SharedBuffers shared_buffers_; 188 SharedBuffers shared_buffers_;
188 189
189 // Points to the video capturer receiving captured video frames. 190 // Points to the video capturer receiving captured video frames.
190 IpcVideoFrameCapturer* video_capturer_; 191 IpcVideoFrameCapturer* video_capturer_;
191 192
192 DISALLOW_COPY_AND_ASSIGN(DesktopSessionProxy); 193 DISALLOW_COPY_AND_ASSIGN(DesktopSessionProxy);
193 }; 194 };
194 195
195 } // namespace remoting 196 } // namespace remoting
196 197
197 #endif // REMOTING_HOST_DESKTOP_SESSION_PROXY_H_ 198 #endif // REMOTING_HOST_DESKTOP_SESSION_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698