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

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: Added struct SelectionRange 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_pending_(false),
138 needs_repainting_on_restore_(false), 139 needs_repainting_on_restore_(false),
139 is_unresponsive_(false), 140 is_unresponsive_(false),
140 in_flight_event_count_(0), 141 in_flight_event_count_(0),
141 in_get_backing_store_(false), 142 in_get_backing_store_(false),
142 abort_get_backing_store_(false), 143 abort_get_backing_store_(false),
143 view_being_painted_(false), 144 view_being_painted_(false),
144 ignore_input_events_(false), 145 ignore_input_events_(false),
145 text_direction_updated_(false), 146 text_direction_updated_(false),
146 text_direction_(WebKit::WebTextDirectionLeftToRight), 147 text_direction_(WebKit::WebTextDirectionLeftToRight),
147 text_direction_canceled_(false), 148 text_direction_canceled_(false),
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose) 282 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose)
282 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove) 283 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove)
283 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnMsgSetTooltipText) 284 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnMsgSetTooltipText)
284 IPC_MESSAGE_HANDLER(ViewHostMsg_PaintAtSize_ACK, OnMsgPaintAtSizeAck) 285 IPC_MESSAGE_HANDLER(ViewHostMsg_PaintAtSize_ACK, OnMsgPaintAtSizeAck)
285 IPC_MESSAGE_HANDLER(ViewHostMsg_CompositorSurfaceBuffersSwapped, 286 IPC_MESSAGE_HANDLER(ViewHostMsg_CompositorSurfaceBuffersSwapped,
286 OnCompositorSurfaceBuffersSwapped) 287 OnCompositorSurfaceBuffersSwapped)
287 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnMsgUpdateRect) 288 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnMsgUpdateRect)
288 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateIsDelayed, OnMsgUpdateIsDelayed) 289 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateIsDelayed, OnMsgUpdateIsDelayed)
289 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnMsgInputEventAck) 290 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnMsgInputEventAck)
290 IPC_MESSAGE_HANDLER(ViewHostMsg_BeginSmoothScroll, OnMsgBeginSmoothScroll) 291 IPC_MESSAGE_HANDLER(ViewHostMsg_BeginSmoothScroll, OnMsgBeginSmoothScroll)
292 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectRange_ACK, OnMsgSelectRangeAck)
291 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnMsgFocus) 293 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnMsgFocus)
292 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnMsgBlur) 294 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnMsgBlur)
293 IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers, 295 IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers,
294 OnMsgHasTouchEventHandlers) 296 OnMsgHasTouchEventHandlers)
295 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnMsgSetCursor) 297 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnMsgSetCursor)
296 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged, 298 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged,
297 OnMsgTextInputStateChanged) 299 OnMsgTextInputStateChanged)
298 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCompositionRangeChanged, 300 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCompositionRangeChanged,
299 OnMsgImeCompositionRangeChanged) 301 OnMsgImeCompositionRangeChanged)
300 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCancelComposition, 302 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCancelComposition,
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1506 base::TimeDelta::FromMilliseconds(kSyntheticScrollMessageIntervalMs)); 1508 base::TimeDelta::FromMilliseconds(kSyntheticScrollMessageIntervalMs));
1507 1509
1508 1510
1509 bool active = active_smooth_scroll_gesture_->ForwardInputEvents(now, this); 1511 bool active = active_smooth_scroll_gesture_->ForwardInputEvents(now, this);
1510 if (!active) { 1512 if (!active) {
1511 active_smooth_scroll_gesture_.reset(); 1513 active_smooth_scroll_gesture_.reset();
1512 // TODO(nduca): send "smooth scroll done" event to RenderWidget. 1514 // TODO(nduca): send "smooth scroll done" event to RenderWidget.
1513 } 1515 }
1514 } 1516 }
1515 1517
1518 void RenderWidgetHostImpl::OnMsgSelectRangeAck() {
1519 select_range_pending_ = false;
1520 if (next_select_range_.get()) {
1521 scoped_ptr<SelectionRange> next(next_select_range_.Pass());
1522 SelectRange(next->start, next->end);
1523 }
1524 }
1525
1516 void RenderWidgetHostImpl::ProcessWheelAck(bool processed) { 1526 void RenderWidgetHostImpl::ProcessWheelAck(bool processed) {
1517 mouse_wheel_pending_ = false; 1527 mouse_wheel_pending_ = false;
1518 1528
1519 // Now send the next (coalesced) mouse wheel event. 1529 // Now send the next (coalesced) mouse wheel event.
1520 if (!coalesced_mouse_wheel_events_.empty()) { 1530 if (!coalesced_mouse_wheel_events_.empty()) {
1521 WebMouseWheelEvent next_wheel_event = 1531 WebMouseWheelEvent next_wheel_event =
1522 coalesced_mouse_wheel_events_.front(); 1532 coalesced_mouse_wheel_events_.front();
1523 coalesced_mouse_wheel_events_.pop_front(); 1533 coalesced_mouse_wheel_events_.pop_front();
1524 ForwardWheelEvent(next_wheel_event); 1534 ForwardWheelEvent(next_wheel_event);
1525 } 1535 }
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1809 Send(new ViewMsg_ExecuteEditCommand(GetRoutingID(), command, value)); 1819 Send(new ViewMsg_ExecuteEditCommand(GetRoutingID(), command, value));
1810 } 1820 }
1811 1821
1812 void RenderWidgetHostImpl::ScrollFocusedEditableNodeIntoRect( 1822 void RenderWidgetHostImpl::ScrollFocusedEditableNodeIntoRect(
1813 const gfx::Rect& rect) { 1823 const gfx::Rect& rect) {
1814 Send(new ViewMsg_ScrollFocusedEditableNodeIntoRect(GetRoutingID(), rect)); 1824 Send(new ViewMsg_ScrollFocusedEditableNodeIntoRect(GetRoutingID(), rect));
1815 } 1825 }
1816 1826
1817 void RenderWidgetHostImpl::SelectRange(const gfx::Point& start, 1827 void RenderWidgetHostImpl::SelectRange(const gfx::Point& start,
1818 const gfx::Point& end) { 1828 const gfx::Point& end) {
1829 if (select_range_pending_) {
darin (slow to review) 2012/08/06 18:27:41 by the way, if the renderer crashes, you probably
Iain Merrick 2012/08/13 13:17:23 Done.
1830 if (!next_select_range_.get()) {
1831 next_select_range_.reset(new SelectionRange());
1832 }
1833 next_select_range_->start = start;
1834 next_select_range_->end = end;
1835 return;
1836 }
1837
1838 select_range_pending_ = true;
1819 Send(new ViewMsg_SelectRange(GetRoutingID(), start, end)); 1839 Send(new ViewMsg_SelectRange(GetRoutingID(), start, end));
1820 } 1840 }
1821 1841
1822 void RenderWidgetHostImpl::Undo() { 1842 void RenderWidgetHostImpl::Undo() {
1823 Send(new ViewMsg_Undo(GetRoutingID())); 1843 Send(new ViewMsg_Undo(GetRoutingID()));
1824 RecordAction(UserMetricsAction("Undo")); 1844 RecordAction(UserMetricsAction("Undo"));
1825 } 1845 }
1826 1846
1827 void RenderWidgetHostImpl::Redo() { 1847 void RenderWidgetHostImpl::Redo() {
1828 Send(new ViewMsg_Redo(GetRoutingID())); 1848 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 1954 // indicate that no callback is in progress (i.e. without this line
1935 // DelayedAutoResized will not get called again). 1955 // DelayedAutoResized will not get called again).
1936 new_auto_size_.SetSize(0, 0); 1956 new_auto_size_.SetSize(0, 0);
1937 if (!should_auto_resize_) 1957 if (!should_auto_resize_)
1938 return; 1958 return;
1939 1959
1940 OnRenderAutoResized(new_size); 1960 OnRenderAutoResized(new_size);
1941 } 1961 }
1942 1962
1943 } // namespace content 1963 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698