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

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

Issue 11470028: Move screen capturers to remoting/capturer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 #include "remoting/host/desktop_session_proxy.h" 5 #include "remoting/host/desktop_session_proxy.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/platform_file.h" 9 #include "base/platform_file.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
11 #include "ipc/ipc_channel_proxy.h" 11 #include "ipc/ipc_channel_proxy.h"
12 #include "ipc/ipc_message_macros.h" 12 #include "ipc/ipc_message_macros.h"
13 #include "remoting/base/capture_data.h" 13 #include "remoting/capturer/capture_data.h"
14 #include "remoting/host/audio_capturer.h" 14 #include "remoting/host/audio_capturer.h"
15 #include "remoting/host/chromoting_messages.h" 15 #include "remoting/host/chromoting_messages.h"
16 #include "remoting/host/ipc_video_frame_capturer.h" 16 #include "remoting/host/ipc_video_frame_capturer.h"
17 #include "remoting/proto/control.pb.h" 17 #include "remoting/proto/control.pb.h"
18 #include "remoting/proto/event.pb.h" 18 #include "remoting/proto/event.pb.h"
19 19
20 #if defined(OS_WIN) 20 #if defined(OS_WIN)
21 #include "base/win/scoped_handle.h" 21 #include "base/win/scoped_handle.h"
22 #endif // defined(OS_WIN) 22 #endif // defined(OS_WIN)
23 23
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 capture_data = new CaptureData( 294 capture_data = new CaptureData(
295 planes, serialized_data.dimensions, 295 planes, serialized_data.dimensions,
296 static_cast<media::VideoFrame::Format>(serialized_data.pixel_format)); 296 static_cast<media::VideoFrame::Format>(serialized_data.pixel_format));
297 capture_data->set_capture_time_ms(serialized_data.capture_time_ms); 297 capture_data->set_capture_time_ms(serialized_data.capture_time_ms);
298 capture_data->set_client_sequence_number( 298 capture_data->set_client_sequence_number(
299 serialized_data.client_sequence_number); 299 serialized_data.client_sequence_number);
300 capture_data->set_dpi(serialized_data.dpi); 300 capture_data->set_dpi(serialized_data.dpi);
301 capture_data->set_shared_buffer(shared_buffer); 301 capture_data->set_shared_buffer(shared_buffer);
302 302
303 if (!serialized_data.dirty_region.empty()) { 303 if (!serialized_data.dirty_region.empty()) {
304 capture_data->mutable_dirty_region().setRects( 304 capture_data->mutable_dirty_region().setRects(
305 &serialized_data.dirty_region[0], 305 &serialized_data.dirty_region[0],
306 serialized_data.dirty_region.size()); 306 serialized_data.dirty_region.size());
307 } 307 }
308 308
309 --pending_capture_frame_requests_; 309 --pending_capture_frame_requests_;
310 PostCaptureCompleted(capture_data); 310 PostCaptureCompleted(capture_data);
311 } 311 }
312 312
313 void DesktopSessionProxy::OnCursorShapeChanged( 313 void DesktopSessionProxy::OnCursorShapeChanged(
314 const std::string& serialized_cursor_shape) { 314 const MouseCursorShape& cursor_shape) {
315 DCHECK(caller_task_runner_->BelongsToCurrentThread()); 315 DCHECK(caller_task_runner_->BelongsToCurrentThread());
316 316 PostCursorShape(cursor_shape);
317 scoped_ptr<protocol::CursorShapeInfo> cursor_shape(
318 new protocol::CursorShapeInfo());
319 if (!cursor_shape->ParseFromString(serialized_cursor_shape)) {
320 LOG(ERROR) << "Failed to parse protocol::CursorShapeInfo.";
321 return;
322 }
323
324 PostCursorShape(cursor_shape.Pass());
325 } 317 }
326 318
327 void DesktopSessionProxy::OnInjectClipboardEvent( 319 void DesktopSessionProxy::OnInjectClipboardEvent(
328 const std::string& serialized_event) { 320 const std::string& serialized_event) {
329 DCHECK(caller_task_runner_->BelongsToCurrentThread()); 321 DCHECK(caller_task_runner_->BelongsToCurrentThread());
330 322
331 protocol::ClipboardEvent event; 323 protocol::ClipboardEvent event;
332 if (!event.ParseFromString(serialized_event)) { 324 if (!event.ParseFromString(serialized_event)) {
333 LOG(ERROR) << "Failed to parse protocol::ClipboardEvent."; 325 LOG(ERROR) << "Failed to parse protocol::ClipboardEvent.";
334 return; 326 return;
(...skipping 10 matching lines...) Expand all
345 FROM_HERE, base::Bind(&DesktopSessionProxy::PostCaptureCompleted, 337 FROM_HERE, base::Bind(&DesktopSessionProxy::PostCaptureCompleted,
346 this, capture_data)); 338 this, capture_data));
347 return; 339 return;
348 } 340 }
349 341
350 if (video_capturer_) 342 if (video_capturer_)
351 video_capturer_->OnCaptureCompleted(capture_data); 343 video_capturer_->OnCaptureCompleted(capture_data);
352 } 344 }
353 345
354 void DesktopSessionProxy::PostCursorShape( 346 void DesktopSessionProxy::PostCursorShape(
355 scoped_ptr<protocol::CursorShapeInfo> cursor_shape) { 347 const MouseCursorShape& cursor_shape) {
356 if (!video_capture_task_runner_->BelongsToCurrentThread()) { 348 if (!video_capture_task_runner_->BelongsToCurrentThread()) {
357 video_capture_task_runner_->PostTask( 349 video_capture_task_runner_->PostTask(
358 FROM_HERE, base::Bind(&DesktopSessionProxy::PostCursorShape, 350 FROM_HERE, base::Bind(&DesktopSessionProxy::PostCursorShape,
359 this, base::Passed(&cursor_shape))); 351 this, cursor_shape));
360 return; 352 return;
361 } 353 }
362 354
363 if (video_capturer_) 355 if (video_capturer_)
364 video_capturer_->OnCursorShapeChanged(cursor_shape.Pass()); 356 video_capturer_->OnCursorShapeChanged(cursor_shape);
365 } 357 }
366 358
367 void DesktopSessionProxy::SendToDesktop(IPC::Message* message) { 359 void DesktopSessionProxy::SendToDesktop(IPC::Message* message) {
368 DCHECK(caller_task_runner_->BelongsToCurrentThread()); 360 DCHECK(caller_task_runner_->BelongsToCurrentThread());
369 361
370 if (desktop_channel_) { 362 if (desktop_channel_) {
371 desktop_channel_->Send(message); 363 desktop_channel_->Send(message);
372 } else { 364 } else {
373 delete message; 365 delete message;
374 } 366 }
375 } 367 }
376 368
377 } // namespace remoting 369 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698