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

Side by Side Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 11858007: Splits SmoothGestureController from RenderWidgetHostImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch Created 7 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | no next file » | 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 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 // touch-events do not reset or contribute to the overscroll gesture. 1132 // touch-events do not reset or contribute to the overscroll gesture.
1133 // However, the touch-events are not sent to the renderer. So send and ACK 1133 // However, the touch-events are not sent to the renderer. So send and ACK
1134 // to the touch-event queue immediately. Mark the event as not processed, 1134 // to the touch-event queue immediately. Mark the event as not processed,
1135 // to make sure that the touch-scroll gesture that initiated the 1135 // to make sure that the touch-scroll gesture that initiated the
1136 // overscroll is updated properly. 1136 // overscroll is updated properly.
1137 touch_event_queue_->ProcessTouchAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED); 1137 touch_event_queue_->ProcessTouchAck(INPUT_EVENT_ACK_STATE_NOT_CONSUMED);
1138 } 1138 }
1139 return; 1139 return;
1140 } 1140 }
1141 1141
1142 in_process_event_types_.push(input_event.type); 1142 in_process_event_types_.push_back(input_event.type);
1143 1143
1144 // Transmit any pending wheel events on a non-wheel event. This ensures that 1144 // Transmit any pending wheel events on a non-wheel event. This ensures that
1145 // the renderer receives the final PhaseEnded wheel event, which is necessary 1145 // the renderer receives the final PhaseEnded wheel event, which is necessary
1146 // to terminate rubber-banding, for example. 1146 // to terminate rubber-banding, for example.
1147 if (input_event.type != WebInputEvent::MouseWheel) { 1147 if (input_event.type != WebInputEvent::MouseWheel) {
1148 for (size_t i = 0; i < coalesced_mouse_wheel_events_.size(); ++i) { 1148 for (size_t i = 0; i < coalesced_mouse_wheel_events_.size(); ++i) {
1149 SendInputEvent(coalesced_mouse_wheel_events_[i], 1149 SendInputEvent(coalesced_mouse_wheel_events_[i],
1150 sizeof(WebMouseWheelEvent), false); 1150 sizeof(WebMouseWheelEvent), false);
1151 } 1151 }
1152 coalesced_mouse_wheel_events_.clear(); 1152 coalesced_mouse_wheel_events_.clear();
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
1681 // MPArch.RWH_DidUpdateBackingStore, and the time spent asynchronously 1681 // MPArch.RWH_DidUpdateBackingStore, and the time spent asynchronously
1682 // waiting for the paint to complete. 1682 // waiting for the paint to complete.
1683 // 1683 //
1684 // On other platforms, this will be equivalent to MPArch.RWH_OnMsgUpdateRect. 1684 // On other platforms, this will be equivalent to MPArch.RWH_OnMsgUpdateRect.
1685 delta = now - paint_start; 1685 delta = now - paint_start;
1686 UMA_HISTOGRAM_TIMES("MPArch.RWH_TotalPaintTime", delta); 1686 UMA_HISTOGRAM_TIMES("MPArch.RWH_TotalPaintTime", delta);
1687 UNSHIPPED_TRACE_EVENT_INSTANT1("test_latency", "UpdateRectComplete", 1687 UNSHIPPED_TRACE_EVENT_INSTANT1("test_latency", "UpdateRectComplete",
1688 "x+y", params.bitmap_rect.x() + params.bitmap_rect.y()); 1688 "x+y", params.bitmap_rect.x() + params.bitmap_rect.y());
1689 } 1689 }
1690 1690
1691 void RenderWidgetHostImpl::OnInputEventAck( 1691 void RenderWidgetHostImpl::OnInputEventAck(
darin (slow to review) 2013/01/15 19:19:53 nit: This function is now too long. You need to b
1692 WebInputEvent::Type event_type, InputEventAckState ack_result) { 1692 WebInputEvent::Type event_type, InputEventAckState ack_result) {
1693 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::OnInputEventAck"); 1693 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::OnInputEventAck");
1694 bool processed = (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED); 1694 bool processed = (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED);
1695 1695
1696 if (!in_process_event_types_.empty() && 1696 if (!in_process_event_types_.empty()) {
1697 in_process_event_types_.front() == event_type) 1697 bool found = false;
1698 in_process_event_types_.pop(); 1698 for (std::deque<WebKit::WebInputEvent::Type>::iterator i =
1699 in_process_event_types_.begin();
1700 i != in_process_event_types_.end(); ++i) {
1701 if (*i == event_type) {
1702 in_process_event_types_.erase(i);
1703 found = true;
1704 break;
1705 } else {
1706 // Ensure we're not ACK'ing out of |type| order. The reason is that
1707 // we push the event stream in system order |in_process_event_types_|,
1708 // however there are various internal queues for gesture / touch / etc
1709 // that may ACK in their own internal order. When traversing
jamesr 2013/01/15 19:26:11 what does this mean? The render process should AC
1710 // |in_process_event_types_|, ensure we don't jump over an event of the
1711 // the same category.
1712 int ack_type = static_cast<int>(event_type);
1713 int queue_type = static_cast<int>(*i);
1714 bool out_of_order =
1715 (WebInputEvent::isMouseEventType(ack_type) &&
1716 WebInputEvent::isMouseEventType(queue_type)) ||
1717 (WebInputEvent::isKeyboardEventType(ack_type) &&
1718 WebInputEvent::isKeyboardEventType(queue_type)) ||
1719 (WebInputEvent::isTouchEventType(ack_type) &&
1720 WebInputEvent::isTouchEventType(queue_type)) ||
1721 (WebInputEvent::isGestureEventType(ack_type) &&
1722 WebInputEvent::isGestureEventType(queue_type));
1723 if (out_of_order) {
1724 DVLOG(1) << "OnInputEventAck out of order " << ack_type << " "
1725 << queue_type;
1726 break;
1727 }
1728 }
1729 }
1730 if (!found)
1731 DVLOG(1) << "OnInputEventAck not found " << event_type;
1732 }
1699 1733
1700 // Log the time delta for processing an input event. 1734 // Log the time delta for processing an input event.
1701 TimeDelta delta = TimeTicks::Now() - input_event_start_time_; 1735 TimeDelta delta = TimeTicks::Now() - input_event_start_time_;
1702 UMA_HISTOGRAM_TIMES("MPArch.RWH_InputEventDelta", delta); 1736 UMA_HISTOGRAM_TIMES("MPArch.RWH_InputEventDelta", delta);
1703 1737
1704 // Cancel pending hung renderer checks since the renderer is responsive. 1738 // Cancel pending hung renderer checks since the renderer is responsive.
1705 if (decrement_in_flight_event_count() == 0) 1739 if (decrement_in_flight_event_count() == 0)
1706 StopHangMonitorTimeout(); 1740 StopHangMonitorTimeout();
1707 1741
1708 // If an input ack is pending, then hold off ticking the gesture 1742 // If an input ack is pending, then hold off ticking the gesture
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
2336 return; 2370 return;
2337 2371
2338 OnRenderAutoResized(new_size); 2372 OnRenderAutoResized(new_size);
2339 } 2373 }
2340 2374
2341 void RenderWidgetHostImpl::DetachDelegate() { 2375 void RenderWidgetHostImpl::DetachDelegate() {
2342 delegate_ = NULL; 2376 delegate_ = NULL;
2343 } 2377 }
2344 2378
2345 } // namespace content 2379 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698