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

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

Issue 10837330: Add a completion callback to gpuBenchmarking.beginSmoothScroll (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: virtual and todo note 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
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 0f21484a92d1eb2ccf2f25fdbedf966345b5aa41..9f47d0740c04877d2c4c6384deb9328431e2dfc0 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -1568,16 +1568,18 @@ void RenderWidgetHostImpl::OnMsgInputEventAck(WebInputEvent::Type event_type,
}
void RenderWidgetHostImpl::OnMsgBeginSmoothScroll(
- bool scroll_down, bool scroll_far) {
+ int gesture_id, bool scroll_down, bool scroll_far) {
if (!view_)
return;
- active_smooth_scroll_gesture_.reset(
- view_->CreateSmoothScrollGesture(scroll_down, scroll_far));
+ active_smooth_scroll_gestures_.insert(
+ std::make_pair(gesture_id,
+ view_->CreateSmoothScrollGesture(
+ scroll_down, scroll_far)));
TickActiveSmoothScrollGesture();
}
void RenderWidgetHostImpl::TickActiveSmoothScrollGesture() {
- if (!active_smooth_scroll_gesture_.get())
+ if (active_smooth_scroll_gestures_.size() == 0)
return;
TimeTicks now = TimeTicks::HighResNow();
@@ -1589,11 +1591,27 @@ void RenderWidgetHostImpl::TickActiveSmoothScrollGesture() {
weak_factory_.GetWeakPtr()),
base::TimeDelta::FromMilliseconds(kSyntheticScrollMessageIntervalMs));
+ // Separate ticking of gestures from sending their completion messages.
+ std::vector<int> ids_that_are_done;
+ for (SmoothScrollGestureMap::iterator it =
+ active_smooth_scroll_gestures_.begin();
+ it != active_smooth_scroll_gestures_.end();
+ ++it) {
- bool active = active_smooth_scroll_gesture_->ForwardInputEvents(now, this);
- if (!active) {
- active_smooth_scroll_gesture_.reset();
- // TODO(nduca): send "smooth scroll done" event to RenderWidget.
+ bool active = it->second->ForwardInputEvents(now, this);
+ if (!active)
+ ids_that_are_done.push_back(it->first);
+ }
+
+ // Delete completed gestures and send their completion event.
+ for(size_t i = 0; i < ids_that_are_done.size(); i++) {
+ int id = ids_that_are_done[i];
+ SmoothScrollGestureMap::iterator it =
+ active_smooth_scroll_gestures_.find(id);
+ DCHECK(it != active_smooth_scroll_gestures_.end());
+ active_smooth_scroll_gestures_.erase(it);
+
+ Send(new ViewMsg_SmoothScrollCompleted(routing_id_, id));
}
}
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | content/browser/renderer_host/render_widget_host_view_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698