| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/fake_desktop_capturer.h" | 5 #include "remoting/host/fake_desktop_capturer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 | 136 |
| 137 void FakeDesktopCapturer::Start(Callback* callback) { | 137 void FakeDesktopCapturer::Start(Callback* callback) { |
| 138 DCHECK(!callback_); | 138 DCHECK(!callback_); |
| 139 DCHECK(callback); | 139 DCHECK(callback); |
| 140 callback_ = callback; | 140 callback_ = callback; |
| 141 } | 141 } |
| 142 | 142 |
| 143 void FakeDesktopCapturer::Capture(const webrtc::DesktopRegion& region) { | 143 void FakeDesktopCapturer::Capture(const webrtc::DesktopRegion& region) { |
| 144 base::Time capture_start_time = base::Time::Now(); | 144 base::Time capture_start_time = base::Time::Now(); |
| 145 scoped_ptr<webrtc::DesktopFrame> frame = frame_generator_.Run(callback_); | 145 scoped_ptr<webrtc::DesktopFrame> frame = frame_generator_.Run(callback_); |
| 146 frame->set_capture_time_ms( | 146 if (frame) { |
| 147 (base::Time::Now() - capture_start_time).InMillisecondsRoundedUp()); | 147 frame->set_capture_time_ms( |
| 148 (base::Time::Now() - capture_start_time).InMillisecondsRoundedUp()); |
| 149 } |
| 148 callback_->OnCaptureCompleted(frame.release()); | 150 callback_->OnCaptureCompleted(frame.release()); |
| 149 } | 151 } |
| 150 | 152 |
| 151 } // namespace remoting | 153 } // namespace remoting |
| OLD | NEW |