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

Unified Diff: content/browser/devtools/protocol/input_handler.h

Issue 2387353004: Delay Input.dispatchKeyEvent response until after key event ack. (Closed)
Patch Set: fix nits Created 4 years, 1 month 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/devtools/protocol/input_handler.h
diff --git a/content/browser/devtools/protocol/input_handler.h b/content/browser/devtools/protocol/input_handler.h
index 691cad2f6417e1310317a2edcedbd44063dd263a..cbeb9c8ba977ce822136d07b31595340c654121a 100644
--- a/content/browser/devtools/protocol/input_handler.h
+++ b/content/browser/devtools/protocol/input_handler.h
@@ -10,6 +10,7 @@
#include "content/browser/devtools/protocol/devtools_protocol_dispatcher.h"
#include "content/browser/renderer_host/input/synthetic_gesture.h"
#include "content/common/input/synthetic_smooth_scroll_gesture_params.h"
+#include "content/public/browser/render_widget_host.h"
#include "ui/gfx/geometry/size_f.h"
namespace cc {
@@ -23,18 +24,23 @@ class RenderWidgetHostImpl;
namespace devtools {
namespace input {
-class InputHandler {
+class InputHandler : public RenderWidgetHost::InputEventObserver {
public:
typedef DevToolsProtocolClient::Response Response;
InputHandler();
- virtual ~InputHandler();
+ ~InputHandler() override;
+
+ // InputEventObserver
+ void OnInputEvent(const blink::WebInputEvent& event) override;
dgozman 2016/11/21 19:14:39 We can probably move these to private.
samuong 2016/11/21 22:28:43 Done.
+ void OnInputEventAck(const blink::WebInputEvent& event) override;
void SetRenderWidgetHost(RenderWidgetHostImpl* host);
void SetClient(std::unique_ptr<Client> client);
void OnSwapCompositorFrame(const cc::CompositorFrameMetadata& frame_metadata);
- Response DispatchKeyEvent(const std::string& type,
+ Response DispatchKeyEvent(DevToolsCommandId command_id,
+ const std::string& type,
const int* modifiers,
const double* timestamp,
const std::string* text,
@@ -48,7 +54,8 @@ class InputHandler {
const bool* is_keypad,
const bool* is_system_key);
- Response DispatchMouseEvent(const std::string& type,
+ Response DispatchMouseEvent(DevToolsCommandId command_id,
+ const std::string& type,
int x,
int y,
const int* modifiers,
@@ -101,6 +108,9 @@ class InputHandler {
const double* timestamp);
private:
+ void SendDispatchKeyEventResponse(DevToolsCommandId command_id);
+ void SendDispatchMouseEventResponse(DevToolsCommandId command_id);
+
void SendSynthesizePinchGestureResponse(DevToolsCommandId command_id,
SyntheticGesture::Result result);
@@ -127,6 +137,11 @@ class InputHandler {
RenderWidgetHostImpl* host_;
std::unique_ptr<Client> client_;
+ // DevToolsCommandIds for calls to Input.dispatchKey/MouseEvent that have been
+ // sent to the renderer, but that we haven't yet received an ack for.
+ bool input_queued_;
+ std::deque<DevToolsCommandId> pending_key_command_ids_;
+ std::deque<DevToolsCommandId> pending_mouse_command_ids_;
float page_scale_factor_;
gfx::SizeF scrollable_viewport_size_;
base::WeakPtrFactory<InputHandler> weak_factory_;

Powered by Google App Engine
This is Rietveld 408576698