| 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 "media/capture/content/screen_capture_device_core.h" | 5 #include "media/capture/content/screen_capture_device_core.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 oracle_proxy_ = new ThreadSafeCaptureOracle( | 58 oracle_proxy_ = new ThreadSafeCaptureOracle( |
| 59 std::move(client), params, capture_machine_->IsAutoThrottlingEnabled()); | 59 std::move(client), params, capture_machine_->IsAutoThrottlingEnabled()); |
| 60 | 60 |
| 61 capture_machine_->Start( | 61 capture_machine_->Start( |
| 62 oracle_proxy_, params, | 62 oracle_proxy_, params, |
| 63 base::Bind(&ScreenCaptureDeviceCore::CaptureStarted, AsWeakPtr())); | 63 base::Bind(&ScreenCaptureDeviceCore::CaptureStarted, AsWeakPtr())); |
| 64 | 64 |
| 65 TransitionStateTo(kCapturing); | 65 TransitionStateTo(kCapturing); |
| 66 } | 66 } |
| 67 | 67 |
| 68 void ScreenCaptureDeviceCore::RequestRefreshFrame() { | |
| 69 DCHECK(thread_checker_.CalledOnValidThread()); | |
| 70 | |
| 71 if (state_ != kCapturing) | |
| 72 return; | |
| 73 | |
| 74 if (oracle_proxy_->AttemptPassiveRefresh()) | |
| 75 return; | |
| 76 capture_machine_->MaybeCaptureForRefresh(); | |
| 77 } | |
| 78 | |
| 79 void ScreenCaptureDeviceCore::StopAndDeAllocate() { | 68 void ScreenCaptureDeviceCore::StopAndDeAllocate() { |
| 80 DCHECK(thread_checker_.CalledOnValidThread()); | 69 DCHECK(thread_checker_.CalledOnValidThread()); |
| 81 | 70 |
| 82 if (state_ != kCapturing) | 71 if (state_ != kCapturing) |
| 83 return; | 72 return; |
| 84 | 73 |
| 85 oracle_proxy_->Stop(); | 74 oracle_proxy_->Stop(); |
| 86 oracle_proxy_ = NULL; | 75 oracle_proxy_ = NULL; |
| 87 | 76 |
| 88 TransitionStateTo(kIdle); | 77 TransitionStateTo(kIdle); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 return; | 123 return; |
| 135 | 124 |
| 136 if (oracle_proxy_.get()) | 125 if (oracle_proxy_.get()) |
| 137 oracle_proxy_->ReportError(from_here, reason); | 126 oracle_proxy_->ReportError(from_here, reason); |
| 138 | 127 |
| 139 StopAndDeAllocate(); | 128 StopAndDeAllocate(); |
| 140 TransitionStateTo(kError); | 129 TransitionStateTo(kError); |
| 141 } | 130 } |
| 142 | 131 |
| 143 } // namespace media | 132 } // namespace media |
| OLD | NEW |