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

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: 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <math.h> 7 #include <math.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 surface_id_(0), 123 surface_id_(0),
124 is_loading_(false), 124 is_loading_(false),
125 is_hidden_(false), 125 is_hidden_(false),
126 is_fullscreen_(false), 126 is_fullscreen_(false),
127 is_accelerated_compositing_active_(false), 127 is_accelerated_compositing_active_(false),
128 repaint_ack_pending_(false), 128 repaint_ack_pending_(false),
129 resize_ack_pending_(false), 129 resize_ack_pending_(false),
130 should_auto_resize_(false), 130 should_auto_resize_(false),
131 mouse_move_pending_(false), 131 mouse_move_pending_(false),
132 mouse_wheel_pending_(false), 132 mouse_wheel_pending_(false),
133 select_range_pending_(false),
133 needs_repainting_on_restore_(false), 134 needs_repainting_on_restore_(false),
134 is_unresponsive_(false), 135 is_unresponsive_(false),
135 in_flight_event_count_(0), 136 in_flight_event_count_(0),
136 in_get_backing_store_(false), 137 in_get_backing_store_(false),
137 abort_get_backing_store_(false), 138 abort_get_backing_store_(false),
138 view_being_painted_(false), 139 view_being_painted_(false),
139 ignore_input_events_(false), 140 ignore_input_events_(false),
140 text_direction_updated_(false), 141 text_direction_updated_(false),
141 text_direction_(WebKit::WebTextDirectionLeftToRight), 142 text_direction_(WebKit::WebTextDirectionLeftToRight),
142 text_direction_canceled_(false), 143 text_direction_canceled_(false),
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose) 279 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose)
279 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove) 280 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove)
280 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnMsgSetTooltipText) 281 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnMsgSetTooltipText)
281 IPC_MESSAGE_HANDLER(ViewHostMsg_PaintAtSize_ACK, OnMsgPaintAtSizeAck) 282 IPC_MESSAGE_HANDLER(ViewHostMsg_PaintAtSize_ACK, OnMsgPaintAtSizeAck)
282 IPC_MESSAGE_HANDLER(ViewHostMsg_CompositorSurfaceBuffersSwapped, 283 IPC_MESSAGE_HANDLER(ViewHostMsg_CompositorSurfaceBuffersSwapped,
283 OnCompositorSurfaceBuffersSwapped) 284 OnCompositorSurfaceBuffersSwapped)
284 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnMsgUpdateRect) 285 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnMsgUpdateRect)
285 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateIsDelayed, OnMsgUpdateIsDelayed) 286 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateIsDelayed, OnMsgUpdateIsDelayed)
286 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnMsgInputEventAck) 287 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnMsgInputEventAck)
287 IPC_MESSAGE_HANDLER(ViewHostMsg_BeginSmoothScroll, OnMsgBeginSmoothScroll) 288 IPC_MESSAGE_HANDLER(ViewHostMsg_BeginSmoothScroll, OnMsgBeginSmoothScroll)
289 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectRange_ACK, OnMsgSelectRangeAck)
288 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnMsgFocus) 290 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnMsgFocus)
289 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnMsgBlur) 291 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnMsgBlur)
290 IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers, 292 IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers,
291 OnMsgHasTouchEventHandlers) 293 OnMsgHasTouchEventHandlers)
292 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnMsgSetCursor) 294 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnMsgSetCursor)
293 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged, 295 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged,
294 OnMsgTextInputStateChanged) 296 OnMsgTextInputStateChanged)
295 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCompositionRangeChanged, 297 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCompositionRangeChanged,
296 OnMsgImeCompositionRangeChanged) 298 OnMsgImeCompositionRangeChanged)
297 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCancelComposition, 299 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCancelComposition,
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 // from a crashed renderer. 1078 // from a crashed renderer.
1077 renderer_initialized_ = false; 1079 renderer_initialized_ = false;
1078 1080
1079 // Must reset these to ensure that mouse move/wheel events work with a new 1081 // Must reset these to ensure that mouse move/wheel events work with a new
1080 // renderer. 1082 // renderer.
1081 mouse_move_pending_ = false; 1083 mouse_move_pending_ = false;
1082 next_mouse_move_.reset(); 1084 next_mouse_move_.reset();
1083 mouse_wheel_pending_ = false; 1085 mouse_wheel_pending_ = false;
1084 coalesced_mouse_wheel_events_.clear(); 1086 coalesced_mouse_wheel_events_.clear();
1085 1087
1088 // Must reset these to ensure that SelectRange works with a new renderer.
1089 select_range_pending_ = false;
1090 next_selection_range_.reset();
1091
1086 // Must reset these to ensure that gesture events work with a new renderer. 1092 // Must reset these to ensure that gesture events work with a new renderer.
1087 gesture_event_filter_->Reset(); 1093 gesture_event_filter_->Reset();
1088 1094
1089 // Must reset these to ensure that keyboard events work with a new renderer. 1095 // Must reset these to ensure that keyboard events work with a new renderer.
1090 key_queue_.clear(); 1096 key_queue_.clear();
1091 suppress_next_char_events_ = false; 1097 suppress_next_char_events_ = false;
1092 1098
1093 // Reset some fields in preparation for recovering from a crash. 1099 // Reset some fields in preparation for recovering from a crash.
1094 resize_ack_pending_ = false; 1100 resize_ack_pending_ = false;
1095 repaint_ack_pending_ = false; 1101 repaint_ack_pending_ = false;
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
1579 base::TimeDelta::FromMilliseconds(kSyntheticScrollMessageIntervalMs)); 1585 base::TimeDelta::FromMilliseconds(kSyntheticScrollMessageIntervalMs));
1580 1586
1581 1587
1582 bool active = active_smooth_scroll_gesture_->ForwardInputEvents(now, this); 1588 bool active = active_smooth_scroll_gesture_->ForwardInputEvents(now, this);
1583 if (!active) { 1589 if (!active) {
1584 active_smooth_scroll_gesture_.reset(); 1590 active_smooth_scroll_gesture_.reset();
1585 // TODO(nduca): send "smooth scroll done" event to RenderWidget. 1591 // TODO(nduca): send "smooth scroll done" event to RenderWidget.
1586 } 1592 }
1587 } 1593 }
1588 1594
1595 void RenderWidgetHostImpl::OnMsgSelectRangeAck() {
1596 select_range_pending_ = false;
1597 if (next_selection_range_.get()) {
1598 scoped_ptr<SelectionRange> next(next_selection_range_.Pass());
1599 SelectRange(next->start, next->end);
1600 }
1601 }
1602
1589 void RenderWidgetHostImpl::ProcessWheelAck(bool processed) { 1603 void RenderWidgetHostImpl::ProcessWheelAck(bool processed) {
1590 mouse_wheel_pending_ = false; 1604 mouse_wheel_pending_ = false;
1591 1605
1592 // Now send the next (coalesced) mouse wheel event. 1606 // Now send the next (coalesced) mouse wheel event.
1593 if (!coalesced_mouse_wheel_events_.empty()) { 1607 if (!coalesced_mouse_wheel_events_.empty()) {
1594 WebMouseWheelEvent next_wheel_event = 1608 WebMouseWheelEvent next_wheel_event =
1595 coalesced_mouse_wheel_events_.front(); 1609 coalesced_mouse_wheel_events_.front();
1596 coalesced_mouse_wheel_events_.pop_front(); 1610 coalesced_mouse_wheel_events_.pop_front();
1597 ForwardWheelEvent(next_wheel_event); 1611 ForwardWheelEvent(next_wheel_event);
1598 } 1612 }
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
1871 Send(new ViewMsg_ExecuteEditCommand(GetRoutingID(), command, value)); 1885 Send(new ViewMsg_ExecuteEditCommand(GetRoutingID(), command, value));
1872 } 1886 }
1873 1887
1874 void RenderWidgetHostImpl::ScrollFocusedEditableNodeIntoRect( 1888 void RenderWidgetHostImpl::ScrollFocusedEditableNodeIntoRect(
1875 const gfx::Rect& rect) { 1889 const gfx::Rect& rect) {
1876 Send(new ViewMsg_ScrollFocusedEditableNodeIntoRect(GetRoutingID(), rect)); 1890 Send(new ViewMsg_ScrollFocusedEditableNodeIntoRect(GetRoutingID(), rect));
1877 } 1891 }
1878 1892
1879 void RenderWidgetHostImpl::SelectRange(const gfx::Point& start, 1893 void RenderWidgetHostImpl::SelectRange(const gfx::Point& start,
1880 const gfx::Point& end) { 1894 const gfx::Point& end) {
1895 if (select_range_pending_) {
1896 if (!next_selection_range_.get()) {
1897 next_selection_range_.reset(new SelectionRange());
1898 }
1899 next_selection_range_->start = start;
1900 next_selection_range_->end = end;
1901 return;
1902 }
1903
1904 select_range_pending_ = true;
1881 Send(new ViewMsg_SelectRange(GetRoutingID(), start, end)); 1905 Send(new ViewMsg_SelectRange(GetRoutingID(), start, end));
1882 } 1906 }
1883 1907
1884 void RenderWidgetHostImpl::Undo() { 1908 void RenderWidgetHostImpl::Undo() {
1885 Send(new ViewMsg_Undo(GetRoutingID())); 1909 Send(new ViewMsg_Undo(GetRoutingID()));
1886 RecordAction(UserMetricsAction("Undo")); 1910 RecordAction(UserMetricsAction("Undo"));
1887 } 1911 }
1888 1912
1889 void RenderWidgetHostImpl::Redo() { 1913 void RenderWidgetHostImpl::Redo() {
1890 Send(new ViewMsg_Redo(GetRoutingID())); 1914 Send(new ViewMsg_Redo(GetRoutingID()));
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1985 // indicate that no callback is in progress (i.e. without this line 2009 // indicate that no callback is in progress (i.e. without this line
1986 // DelayedAutoResized will not get called again). 2010 // DelayedAutoResized will not get called again).
1987 new_auto_size_.SetSize(0, 0); 2011 new_auto_size_.SetSize(0, 0);
1988 if (!should_auto_resize_) 2012 if (!should_auto_resize_)
1989 return; 2013 return;
1990 2014
1991 OnRenderAutoResized(new_size); 2015 OnRenderAutoResized(new_size);
1992 } 2016 }
1993 2017
1994 } // namespace content 2018 } // namespace content
OLDNEW
« 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