| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/session_manager.h" | 5 #include "remoting/host/session_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 // At this point we are going to perform one capture so save the current time. | 203 // At this point we are going to perform one capture so save the current time. |
| 204 last_capture_time_ = now; | 204 last_capture_time_ = now; |
| 205 ++recordings_; | 205 ++recordings_; |
| 206 | 206 |
| 207 // Before we actually do a capture, schedule the next one. | 207 // Before we actually do a capture, schedule the next one. |
| 208 ScheduleNextCapture(); | 208 ScheduleNextCapture(); |
| 209 | 209 |
| 210 // And finally perform one capture. | 210 // And finally perform one capture. |
| 211 DCHECK(capturer_.get()); | 211 DCHECK(capturer_.get()); |
| 212 | 212 |
| 213 // TODO(dmaclach): make this not required on the Mac eventually. | |
| 214 // Will require getting the X11client to work properly. Right now X11 expects | |
| 215 // full screens each pass. | |
| 216 capturer_->InvalidateFullScreen(); | |
| 217 capturer_->CaptureInvalidRects( | 213 capturer_->CaptureInvalidRects( |
| 218 NewCallback(this, &SessionManager::CaptureDoneCallback)); | 214 NewCallback(this, &SessionManager::CaptureDoneCallback)); |
| 219 } | 215 } |
| 220 | 216 |
| 221 void SessionManager::CaptureDoneCallback( | 217 void SessionManager::CaptureDoneCallback( |
| 222 scoped_refptr<CaptureData> capture_data) { | 218 scoped_refptr<CaptureData> capture_data) { |
| 223 // TODO(hclam): There is a bug if the capturer doesn't produce any dirty rects
. | 219 // TODO(hclam): There is a bug if the capturer doesn't produce any dirty |
| 220 // rects. |
| 224 DCHECK_EQ(capture_loop_, MessageLoop::current()); | 221 DCHECK_EQ(capture_loop_, MessageLoop::current()); |
| 225 encode_loop_->PostTask( | 222 encode_loop_->PostTask( |
| 226 FROM_HERE, | 223 FROM_HERE, |
| 227 NewRunnableMethod(this, &SessionManager::DoEncode, capture_data)); | 224 NewRunnableMethod(this, &SessionManager::DoEncode, capture_data)); |
| 228 } | 225 } |
| 229 | 226 |
| 230 void SessionManager::DoFinishEncode() { | 227 void SessionManager::DoFinishEncode() { |
| 231 DCHECK_EQ(capture_loop_, MessageLoop::current()); | 228 DCHECK_EQ(capture_loop_, MessageLoop::current()); |
| 232 | 229 |
| 233 // Decrement the number of recording in process since we have completed | 230 // Decrement the number of recording in process since we have completed |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 FROM_HERE, | 399 FROM_HERE, |
| 403 NewRunnableMethod(this, &SessionManager::DoSendUpdate, message, state)); | 400 NewRunnableMethod(this, &SessionManager::DoSendUpdate, message, state)); |
| 404 | 401 |
| 405 if (state & Encoder::EncodingEnded) { | 402 if (state & Encoder::EncodingEnded) { |
| 406 capture_loop_->PostTask( | 403 capture_loop_->PostTask( |
| 407 FROM_HERE, NewRunnableMethod(this, &SessionManager::DoFinishEncode)); | 404 FROM_HERE, NewRunnableMethod(this, &SessionManager::DoFinishEncode)); |
| 408 } | 405 } |
| 409 } | 406 } |
| 410 | 407 |
| 411 } // namespace remoting | 408 } // namespace remoting |
| OLD | NEW |