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

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

Issue 1484403002: cast: Support for low-latency interactive mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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/cursor_renderer_aura.cc
diff --git a/content/browser/media/capture/cursor_renderer_aura.cc b/content/browser/media/capture/cursor_renderer_aura.cc
index f2ce8aee50a37e7ca030d8c564f3b5fa78ad180c..84e9b31dfc6d52d26e4a84a71dbed186e18ad446 100644
--- a/content/browser/media/capture/cursor_renderer_aura.cc
+++ b/content/browser/media/capture/cursor_renderer_aura.cc
@@ -23,6 +23,10 @@ namespace content {
namespace {
+// The time period within which a triggered UI event is considered
+// currently active.
+const int kTimePeriodUiEventMicros = 100000; // 100 ms
+
inline int clip_byte(int x) {
return std::max(0, std::min(x, 255));
}
@@ -53,6 +57,11 @@ base::WeakPtr<CursorRenderer> CursorRendererAura::GetWeakPtr() {
return weak_factory_.GetWeakPtr();
}
+bool CursorRendererAura::ui_event_detected() const {
+ return (tick_clock_->NowTicks() - last_time_ui_event_detected_) <
+ base::TimeDelta::FromMicroseconds(kTimePeriodUiEventMicros);
+}
+
void CursorRendererAura::Clear() {
last_cursor_ = ui::Cursor();
window_size_when_cursor_last_updated_ = gfx::Size();
@@ -184,6 +193,11 @@ void CursorRendererAura::RenderOnVideoFrame(
scaled_cursor_bitmap_.unlockPixels();
}
+void CursorRendererAura::OnEvent(ui::Event* event) {
+ last_time_ui_event_detected_ = tick_clock_->NowTicks();
+ ui::EventHandler::OnEvent(event);
+}
+
void CursorRendererAura::OnMouseEvent(ui::MouseEvent* event) {
switch (event->type()) {
case ui::ET_MOUSE_MOVED:

Powered by Google App Engine
This is Rietveld 408576698