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

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

Issue 10823077: Throttle SelectRange IPC (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Renamed next_select_range, handled RendererExited Created 8 years, 4 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
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8f658171e611d39e3365897998c31bae22d588d7..3d44fc4bfa42b90b42563c67cd31ede38d71f9e5 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -130,6 +130,7 @@ RenderWidgetHostImpl::RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate,
should_auto_resize_(false),
mouse_move_pending_(false),
mouse_wheel_pending_(false),
+ select_range_pending_(false),
needs_repainting_on_restore_(false),
is_unresponsive_(false),
in_flight_event_count_(0),
@@ -285,6 +286,7 @@ bool RenderWidgetHostImpl::OnMessageReceived(const IPC::Message &msg) {
IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateIsDelayed, OnMsgUpdateIsDelayed)
IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnMsgInputEventAck)
IPC_MESSAGE_HANDLER(ViewHostMsg_BeginSmoothScroll, OnMsgBeginSmoothScroll)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_SelectRange_ACK, OnMsgSelectRangeAck)
IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnMsgFocus)
IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnMsgBlur)
IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers,
@@ -1083,6 +1085,10 @@ void RenderWidgetHostImpl::RendererExited(base::TerminationStatus status,
mouse_wheel_pending_ = false;
coalesced_mouse_wheel_events_.clear();
+ // Must reset these to ensure that SelectRange works with a new renderer.
+ select_range_pending_ = false;
+ next_selection_range_.reset();
+
// Must reset these to ensure that gesture events work with a new renderer.
gesture_event_filter_->Reset();
@@ -1586,6 +1592,14 @@ void RenderWidgetHostImpl::TickActiveSmoothScrollGesture() {
}
}
+void RenderWidgetHostImpl::OnMsgSelectRangeAck() {
+ select_range_pending_ = false;
+ if (next_selection_range_.get()) {
+ scoped_ptr<SelectionRange> next(next_selection_range_.Pass());
+ SelectRange(next->start, next->end);
+ }
+}
+
void RenderWidgetHostImpl::ProcessWheelAck(bool processed) {
mouse_wheel_pending_ = false;
@@ -1878,6 +1892,16 @@ void RenderWidgetHostImpl::ScrollFocusedEditableNodeIntoRect(
void RenderWidgetHostImpl::SelectRange(const gfx::Point& start,
const gfx::Point& end) {
+ if (select_range_pending_) {
+ if (!next_selection_range_.get()) {
+ next_selection_range_.reset(new SelectionRange());
+ }
+ next_selection_range_->start = start;
+ next_selection_range_->end = end;
+ return;
+ }
+
+ select_range_pending_ = true;
Send(new ViewMsg_SelectRange(GetRoutingID(), start, end));
}
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698