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 a56208f38aa1fac4fada467d6c43e788d2f207c0..08ad2439b0774b0f1ebb26aaf81fc1aa55bf104d 100644 |
--- a/content/browser/media/capture/aura_window_capture_machine.cc |
+++ b/content/browser/media/capture/aura_window_capture_machine.cc |
@@ -9,6 +9,7 @@ |
#include "base/logging.h" |
#include "base/metrics/histogram.h" |
+#include "base/timer/timer.h" |
#include "cc/output/copy_output_request.h" |
#include "cc/output/copy_output_result.h" |
#include "content/browser/compositor/gl_helper.h" |
@@ -38,6 +39,7 @@ |
AuraWindowCaptureMachine::AuraWindowCaptureMachine() |
: desktop_window_(NULL), |
+ timer_(true, true), |
screen_capture_(false), |
weak_factory_(this) {} |
@@ -89,6 +91,14 @@ |
PowerSaveBlocker::kReasonOther, |
"DesktopCaptureDevice is running").release()); |
+ // Starts timer. |
+ timer_.Start(FROM_HERE, |
+ std::max(oracle_proxy_->min_capture_period(), |
+ base::TimeDelta::FromMilliseconds(media:: |
+ VideoCaptureOracle::kMinTimerPollPeriodMillis)), |
+ base::Bind(&AuraWindowCaptureMachine::Capture, |
+ base::Unretained(this), false)); |
+ |
return true; |
} |
@@ -120,12 +130,10 @@ |
cursor_renderer_.reset(); |
} |
+ // Stop timer. |
+ timer_.Stop(); |
+ |
callback.Run(); |
-} |
- |
-void AuraWindowCaptureMachine::MaybeCaptureForRefresh() { |
- DCHECK_CURRENTLY_ON(BrowserThread::UI); |
- Capture(false); |
} |
void AuraWindowCaptureMachine::SetWindow(aura::Window* window) { |
@@ -171,7 +179,7 @@ |
const base::TimeTicks start_time = base::TimeTicks::Now(); |
const media::VideoCaptureOracle::Event event = |
dirty ? media::VideoCaptureOracle::kCompositorUpdate |
- : media::VideoCaptureOracle::kActiveRefreshRequest; |
+ : media::VideoCaptureOracle::kTimerPoll; |
if (oracle_proxy_->ObserveEventAndDecideCapture( |
event, gfx::Rect(), start_time, &frame, &capture_frame_cb)) { |
scoped_ptr<cc::CopyOutputRequest> request = |