Dont hold input event ack if hidden.

When a RWH goes invisible in single thread mode, it stops sending input events to the RenderWidget. In single thread mode, these sends are processed in-order, so RW never gets an input event sent while the widget is invisible.

In multi threaded mode, RWH sends an input event, then set visible to false.

The IO thread redirects the input event to the compositor thread, but sends the visible to the main thread immediately.

The compositor receives the input event, rejects it, and posts it to the main thread. By the time it hits the main thread, the main thread has already set its visibility to false.

If, when we receive the input ack on the main thread when we're invisble, AND the screen is damaged, then we will hold the input ack until the next frame. Since we're invisible, that frame isn't going to happen, and thus the input ack isn't sent. The hang monitor is based on this input ack being received by the RWH. Thus, 20s after the tab going invisible when damaged, we show a hang warning.

To fix this, we just need to disable holding of input acks when RW is invisible.

[email protected]
BUG=123934
TEST=Open Webkit poster circle. Open new tab. Go back to poster circle. Move mouse and at the same time as mosue is moving, switch to the other tab. Wait for hang monitor timeout (20sec). Bug is fixed if you dont get a unresponsive dialog.

Review URL: https://chromiumcodereview.appspot.com/10187010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134319 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index e21aeda..f9868c4 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -565,7 +565,7 @@
       webwidget_->isInputThrottled() ||
       paint_aggregator_.HasPendingUpdate();
 
-  if (event_type_gets_rate_limited && is_input_throttled) {
+  if (event_type_gets_rate_limited && is_input_throttled && !is_hidden_) {
     // We want to rate limit the input events in this case, so we'll wait for
     // painting to finish before ACKing this message.
     if (pending_input_event_ack_.get()) {