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

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

Issue 2336803003: Make SyntheticPointerAction to flush the pointer action sequence (Closed)
Patch Set: 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..442c8b5bed89e30e66f0779279f4cb5380b6f2bc 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -1184,10 +1184,7 @@ 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()));
- }
+ SetSyntheticGestureController();
tdresser 2016/10/26 18:28:40 We call SetSyntheticGestureController before we ev
lanwei 2016/10/30 23:23:13 Yes, there are some other places which also call t
if (synthetic_gesture_controller_) {
synthetic_gesture_controller_->QueueSyntheticGesture(
std::move(synthetic_gesture), on_complete);
@@ -1746,10 +1743,23 @@ void RenderWidgetHostImpl::OnQueueSyntheticGesture(
return;
}
+ SetSyntheticGestureController();
+ 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 +2202,14 @@ void RenderWidgetHostImpl::OnSnapshotDataReceivedAsync(
OnSnapshotDataReceived(snapshot_id, NULL, 0);
}
+void RenderWidgetHostImpl::SetSyntheticGestureController() {
tdresser 2016/10/26 18:28:40 This method is confusing. Should it be called Crea
lanwei 2016/10/30 23:23:13 Done.
+ if (synthetic_gesture_controller_ || !view_)
+ return;
+
+ synthetic_gesture_controller_.reset(
+ new SyntheticGestureController(view_->CreateSyntheticGestureTarget()));
+}
+
// static
void RenderWidgetHostImpl::CompositorFrameDrawn(
const std::vector<ui::LatencyInfo>& latency_info) {

Powered by Google App Engine
This is Rietveld 408576698