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

Unified Diff: content/browser/media/capture/aura_window_capture_machine.cc

Issue 2364413002: Screen Video Capture: Implement suspend optimization. (Closed)
Patch Set: Unwind ScreenCaptureMachineAndroid changes. Created 4 years, 3 months 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 side-by-side diff with in-line comments
Download patch
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 800d6f9c4fce8057f30d6160e0994cc7ebd12cf1..0878419cb6090df866da803a9533b4fe8c3d81e5 100644
--- a/content/browser/media/capture/aura_window_capture_machine.cc
+++ b/content/browser/media/capture/aura_window_capture_machine.cc
@@ -38,6 +38,7 @@ namespace content {
AuraWindowCaptureMachine::AuraWindowCaptureMachine()
: desktop_window_(NULL),
screen_capture_(false),
+ frame_capture_active_(true),
weak_factory_(this) {}
AuraWindowCaptureMachine::~AuraWindowCaptureMachine() {}
@@ -94,6 +95,30 @@ bool AuraWindowCaptureMachine::InternalStart(
return true;
}
+void AuraWindowCaptureMachine::Suspend() {
+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
+ base::Bind(&AuraWindowCaptureMachine::InternalSuspend,
+ base::Unretained(this)));
+}
+
+void AuraWindowCaptureMachine::InternalSuspend() {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ DVLOG(1) << "Suspending frame capture and delivery.";
+ frame_capture_active_ = false;
+}
+
+void AuraWindowCaptureMachine::Resume() {
+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
+ base::Bind(&AuraWindowCaptureMachine::InternalResume,
+ base::Unretained(this)));
+}
+
+void AuraWindowCaptureMachine::InternalResume() {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ DVLOG(1) << "Resuming frame capture and delivery.";
+ frame_capture_active_ = true;
+}
+
void AuraWindowCaptureMachine::Stop(const base::Closure& callback) {
// Stops the capture machine asynchronously.
BrowserThread::PostTask(
@@ -408,7 +433,8 @@ void AuraWindowCaptureMachine::OnAnimationStep(base::TimeTicks timestamp) {
// captures and quality/smoothness of animating content will suffer
// significantly.
// http://crbug.com/492839
- Capture(timestamp);
+ if (frame_capture_active_)
+ Capture(timestamp);
}
void AuraWindowCaptureMachine::OnCompositingShuttingDown(

Powered by Google App Engine
This is Rietveld 408576698