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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/render_widget_host_impl.h" 5 #include "content/browser/renderer_host/render_widget_host_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 is_loading_(false), 128 is_loading_(false),
129 is_hidden_(false), 129 is_hidden_(false),
130 is_fullscreen_(false), 130 is_fullscreen_(false),
131 is_accelerated_compositing_active_(false), 131 is_accelerated_compositing_active_(false),
132 repaint_ack_pending_(false), 132 repaint_ack_pending_(false),
133 resize_ack_pending_(false), 133 resize_ack_pending_(false),
134 should_auto_resize_(false), 134 should_auto_resize_(false),
135 mouse_move_pending_(false), 135 mouse_move_pending_(false),
136 mouse_wheel_pending_(false), 136 mouse_wheel_pending_(false),
137 gesture_event_pending_(false), 137 gesture_event_pending_(false),
138 select_range_in_flight_(false),
139 select_range_pending_(false),
138 needs_repainting_on_restore_(false), 140 needs_repainting_on_restore_(false),
139 is_unresponsive_(false), 141 is_unresponsive_(false),
140 in_flight_event_count_(0), 142 in_flight_event_count_(0),
141 in_get_backing_store_(false), 143 in_get_backing_store_(false),
142 abort_get_backing_store_(false), 144 abort_get_backing_store_(false),
143 view_being_painted_(false), 145 view_being_painted_(false),
144 ignore_input_events_(false), 146 ignore_input_events_(false),
145 text_direction_updated_(false), 147 text_direction_updated_(false),
146 text_direction_(WebKit::WebTextDirectionLeftToRight), 148 text_direction_(WebKit::WebTextDirectionLeftToRight),
147 text_direction_canceled_(false), 149 text_direction_canceled_(false),
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose) 283 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose)
282 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove) 284 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove)
283 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnMsgSetTooltipText) 285 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnMsgSetTooltipText)
284 IPC_MESSAGE_HANDLER(ViewHostMsg_PaintAtSize_ACK, OnMsgPaintAtSizeAck) 286 IPC_MESSAGE_HANDLER(ViewHostMsg_PaintAtSize_ACK, OnMsgPaintAtSizeAck)
285 IPC_MESSAGE_HANDLER(ViewHostMsg_CompositorSurfaceBuffersSwapped, 287 IPC_MESSAGE_HANDLER(ViewHostMsg_CompositorSurfaceBuffersSwapped,
286 OnCompositorSurfaceBuffersSwapped) 288 OnCompositorSurfaceBuffersSwapped)
287 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnMsgUpdateRect) 289 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnMsgUpdateRect)
288 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateIsDelayed, OnMsgUpdateIsDelayed) 290 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateIsDelayed, OnMsgUpdateIsDelayed)
289 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnMsgInputEventAck) 291 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnMsgInputEventAck)
290 IPC_MESSAGE_HANDLER(ViewHostMsg_BeginSmoothScroll, OnMsgBeginSmoothScroll) 292 IPC_MESSAGE_HANDLER(ViewHostMsg_BeginSmoothScroll, OnMsgBeginSmoothScroll)
293 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectRange_ACK, OnMsgSelectRangeAck)
291 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnMsgFocus) 294 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnMsgFocus)
292 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnMsgBlur) 295 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnMsgBlur)
293 IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers, 296 IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers,
294 OnMsgHasTouchEventHandlers) 297 OnMsgHasTouchEventHandlers)
295 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnMsgSetCursor) 298 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnMsgSetCursor)
296 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged, 299 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged,
297 OnMsgTextInputStateChanged) 300 OnMsgTextInputStateChanged)
298 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCompositionRangeChanged, 301 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCompositionRangeChanged,
299 OnMsgImeCompositionRangeChanged) 302 OnMsgImeCompositionRangeChanged)
300 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCancelComposition, 303 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCancelComposition,
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1506 base::TimeDelta::FromMilliseconds(kSyntheticScrollMessageIntervalMs)); 1509 base::TimeDelta::FromMilliseconds(kSyntheticScrollMessageIntervalMs));
1507 1510
1508 1511
1509 bool active = active_smooth_scroll_gesture_->ForwardInputEvents(now, this); 1512 bool active = active_smooth_scroll_gesture_->ForwardInputEvents(now, this);
1510 if (!active) { 1513 if (!active) {
1511 active_smooth_scroll_gesture_.reset(); 1514 active_smooth_scroll_gesture_.reset();
1512 // TODO(nduca): send "smooth scroll done" event to RenderWidget. 1515 // TODO(nduca): send "smooth scroll done" event to RenderWidget.
1513 } 1516 }
1514 } 1517 }
1515 1518
1519 void RenderWidgetHostImpl::OnMsgSelectRangeAck() {
1520 select_range_in_flight_ = false;
1521 if (select_range_pending_) {
1522 select_range_pending_ = false;
1523 SelectRange(pend_select_start_, pend_select_end_);
1524 }
1525 }
1526
1516 void RenderWidgetHostImpl::ProcessWheelAck(bool processed) { 1527 void RenderWidgetHostImpl::ProcessWheelAck(bool processed) {
1517 mouse_wheel_pending_ = false; 1528 mouse_wheel_pending_ = false;
1518 1529
1519 // Now send the next (coalesced) mouse wheel event. 1530 // Now send the next (coalesced) mouse wheel event.
1520 if (!coalesced_mouse_wheel_events_.empty()) { 1531 if (!coalesced_mouse_wheel_events_.empty()) {
1521 WebMouseWheelEvent next_wheel_event = 1532 WebMouseWheelEvent next_wheel_event =
1522 coalesced_mouse_wheel_events_.front(); 1533 coalesced_mouse_wheel_events_.front();
1523 coalesced_mouse_wheel_events_.pop_front(); 1534 coalesced_mouse_wheel_events_.pop_front();
1524 ForwardWheelEvent(next_wheel_event); 1535 ForwardWheelEvent(next_wheel_event);
1525 } 1536 }
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1809 Send(new ViewMsg_ExecuteEditCommand(GetRoutingID(), command, value)); 1820 Send(new ViewMsg_ExecuteEditCommand(GetRoutingID(), command, value));
1810 } 1821 }
1811 1822
1812 void RenderWidgetHostImpl::ScrollFocusedEditableNodeIntoRect( 1823 void RenderWidgetHostImpl::ScrollFocusedEditableNodeIntoRect(
1813 const gfx::Rect& rect) { 1824 const gfx::Rect& rect) {
1814 Send(new ViewMsg_ScrollFocusedEditableNodeIntoRect(GetRoutingID(), rect)); 1825 Send(new ViewMsg_ScrollFocusedEditableNodeIntoRect(GetRoutingID(), rect));
1815 } 1826 }
1816 1827
1817 void RenderWidgetHostImpl::SelectRange(const gfx::Point& start, 1828 void RenderWidgetHostImpl::SelectRange(const gfx::Point& start,
1818 const gfx::Point& end) { 1829 const gfx::Point& end) {
1830 if (select_range_in_flight_) {
1831 select_range_pending_ = true;
1832 pend_select_start_ = start;
1833 pend_select_end_ = end;
1834 return;
1835 }
1836 select_range_in_flight_ = true;
1819 Send(new ViewMsg_SelectRange(GetRoutingID(), start, end)); 1837 Send(new ViewMsg_SelectRange(GetRoutingID(), start, end));
1820 } 1838 }
1821 1839
1822 void RenderWidgetHostImpl::Undo() { 1840 void RenderWidgetHostImpl::Undo() {
1823 Send(new ViewMsg_Undo(GetRoutingID())); 1841 Send(new ViewMsg_Undo(GetRoutingID()));
1824 RecordAction(UserMetricsAction("Undo")); 1842 RecordAction(UserMetricsAction("Undo"));
1825 } 1843 }
1826 1844
1827 void RenderWidgetHostImpl::Redo() { 1845 void RenderWidgetHostImpl::Redo() {
1828 Send(new ViewMsg_Redo(GetRoutingID())); 1846 Send(new ViewMsg_Redo(GetRoutingID()));
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1934 // indicate that no callback is in progress (i.e. without this line 1952 // indicate that no callback is in progress (i.e. without this line
1935 // DelayedAutoResized will not get called again). 1953 // DelayedAutoResized will not get called again).
1936 new_auto_size_.SetSize(0, 0); 1954 new_auto_size_.SetSize(0, 0);
1937 if (!should_auto_resize_) 1955 if (!should_auto_resize_)
1938 return; 1956 return;
1939 1957
1940 OnRenderAutoResized(new_size); 1958 OnRenderAutoResized(new_size);
1941 } 1959 }
1942 1960
1943 } // namespace content 1961 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698