Index: content/browser/media/capture/aura_window_capture_machine.cc |
diff --git a/content/browser/media/capture/aura_window_capture_machine.cc b/content/browser/media/capture/aura_window_capture_machine.cc |
index d398c6d756b86feb5baf7dc12e67eb36c9265ddb..f8cd0e7c88974e2bde62930d1d47549dc024437c 100644 |
--- a/content/browser/media/capture/aura_window_capture_machine.cc |
+++ b/content/browser/media/capture/aura_window_capture_machine.cc |
@@ -117,11 +117,25 @@ AuraWindowCaptureMachine::AuraWindowCaptureMachine() |
AuraWindowCaptureMachine::~AuraWindowCaptureMachine() {} |
-bool AuraWindowCaptureMachine::Start( |
+void AuraWindowCaptureMachine::Start( |
+ const scoped_refptr<ThreadSafeCaptureOracle>& oracle_proxy, |
+ const media::VideoCaptureParams& params, |
+ const base::Callback<void(bool)> callback) { |
+ // Starts the capture machine asynchronously. |
+ BrowserThread::PostTaskAndReplyWithResult( |
+ BrowserThread::UI, |
+ FROM_HERE, |
+ base::Bind(&AuraWindowCaptureMachine::InternalStart, |
+ base::Unretained(this), |
+ oracle_proxy, |
+ params), |
+ callback); |
+} |
+ |
+bool AuraWindowCaptureMachine::InternalStart( |
const scoped_refptr<ThreadSafeCaptureOracle>& oracle_proxy, |
const media::VideoCaptureParams& params) { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
- |
// The window might be destroyed between SetWindow() and Start(). |
if (!desktop_window_) |
return false; |
@@ -157,6 +171,15 @@ bool AuraWindowCaptureMachine::Start( |
} |
void AuraWindowCaptureMachine::Stop(const base::Closure& callback) { |
+ // Stops the capture machine asynchronously. |
+ BrowserThread::PostTask( |
whywhat
2015/08/17 13:58:46
This refactoring (changing a sync method to async)
|
+ BrowserThread::UI, FROM_HERE, base::Bind( |
+ &AuraWindowCaptureMachine::InternalStop, |
+ base::Unretained(this), |
+ callback)); |
+} |
+ |
+void AuraWindowCaptureMachine::InternalStop(const base::Closure& callback) { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
power_save_blocker_.reset(); |