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

Unified Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 2336803003: Make SyntheticPointerAction to flush the pointer action sequence (Closed)
Patch Set: pointer controller Created 4 years, 2 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/renderer_host/render_widget_host_impl.cc
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index fde38b4ccd86bfdf1b97442ac82f4ee70f496363..f9bb07246f13c3bc556a76725809aa1840e10009 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -1184,14 +1184,13 @@ void RenderWidgetHostImpl::ForwardKeyboardEvent(
void RenderWidgetHostImpl::QueueSyntheticGesture(
std::unique_ptr<SyntheticGesture> synthetic_gesture,
const base::Callback<void(SyntheticGesture::Result)>& on_complete) {
- if (!synthetic_gesture_controller_ && view_) {
- synthetic_gesture_controller_.reset(
- new SyntheticGestureController(view_->CreateSyntheticGestureTarget()));
+ if (!synthetic_gesture_controller_) {
+ if(!CreateSyntheticGestureController())
+ return;
tdresser 2016/10/31 14:22:58 Should this ever happen? Should there be a CHECK o
lanwei 2016/12/04 18:08:02 Done.
}
- if (synthetic_gesture_controller_) {
- synthetic_gesture_controller_->QueueSyntheticGesture(
+
+ synthetic_gesture_controller_->QueueSyntheticGesture(
std::move(synthetic_gesture), on_complete);
- }
}
void RenderWidgetHostImpl::SetCursor(const WebCursor& cursor) {
@@ -1746,10 +1745,26 @@ void RenderWidgetHostImpl::OnQueueSyntheticGesture(
return;
}
+ if (!synthetic_gesture_controller_) {
+ if(!CreateSyntheticGestureController())
+ return;
tdresser 2016/10/31 14:22:58 Should this ever happen?
lanwei 2016/12/04 18:08:02 Done.
+ }
+ std::unique_ptr<SyntheticGesture> synthetic_gesture;
+ const SyntheticGestureParams* gesture_params =
+ gesture_packet.gesture_params();
+ if (gesture_params->GetGestureType() ==
+ SyntheticGestureParams::POINTER_ACTION_LIST) {
+ synthetic_gesture =
+ synthetic_gesture_controller_->CreateSyntheticPointerAction(
+ *SyntheticPointerActionListParams::Cast(gesture_params));
+ } else {
+ synthetic_gesture = SyntheticGesture::Create(*gesture_params);
+ }
+
QueueSyntheticGesture(
- SyntheticGesture::Create(*gesture_packet.gesture_params()),
- base::Bind(&RenderWidgetHostImpl::OnSyntheticGestureCompleted,
- weak_factory_.GetWeakPtr()));
+ std::move(synthetic_gesture),
+ base::Bind(&RenderWidgetHostImpl::OnSyntheticGestureCompleted,
+ weak_factory_.GetWeakPtr()));
}
void RenderWidgetHostImpl::OnSetCursor(const WebCursor& cursor) {
@@ -2192,6 +2207,17 @@ void RenderWidgetHostImpl::OnSnapshotDataReceivedAsync(
OnSnapshotDataReceived(snapshot_id, NULL, 0);
}
+bool RenderWidgetHostImpl::CreateSyntheticGestureController() {
+ DCHECK(!synthetic_gesture_controller_);
+
+ if (!view_)
+ return false;
+
+ synthetic_gesture_controller_.reset(
+ new SyntheticGestureController(view_->CreateSyntheticGestureTarget()));
+ return true;
+}
+
// static
void RenderWidgetHostImpl::CompositorFrameDrawn(
const std::vector<ui::LatencyInfo>& latency_info) {

Powered by Google App Engine
This is Rietveld 408576698