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

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

Powered by Google App Engine
This is Rietveld 408576698