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

Side by Side Diff: content/renderer/render_widget.cc

Issue 1176353002: Showing Gloweffect correctly during fling on mainthread. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: addressed review comments Created 5 years, 6 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 | « no previous file | 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/renderer/render_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 // the BeginMainFrame interval. 159 // the BeginMainFrame interval.
160 // 4166us will allow 1/4 of a 60Hz interval or 1/2 of a 120Hz interval to 160 // 4166us will allow 1/4 of a 60Hz interval or 1/2 of a 120Hz interval to
161 // be spent in input hanlders before input starts getting throttled. 161 // be spent in input hanlders before input starts getting throttled.
162 const int kInputHandlingTimeThrottlingThresholdMicroseconds = 4166; 162 const int kInputHandlingTimeThrottlingThresholdMicroseconds = 4166;
163 163
164 int64 GetEventLatencyMicros(const WebInputEvent& event, base::TimeTicks now) { 164 int64 GetEventLatencyMicros(const WebInputEvent& event, base::TimeTicks now) {
165 return (now - base::TimeDelta::FromSecondsD(event.timeStampSeconds)) 165 return (now - base::TimeDelta::FromSecondsD(event.timeStampSeconds))
166 .ToInternalValue(); 166 .ToInternalValue();
167 } 167 }
168 168
169 // TODO(sataya.m): Remove this api once http://crbug.com/499743 is fixed.
170 gfx::Vector2dF ToClientScrollIncrement(const blink::WebFloatSize& increment) {
jdduke (slow) 2015/06/12 14:53:16 Let's just inline this function and the comment, I
MuVen 2015/06/12 15:08:04 Done.
171 return gfx::Vector2dF(-increment.width, -increment.height);
172 }
173
169 void LogInputEventLatencyUma(const WebInputEvent& event, base::TimeTicks now) { 174 void LogInputEventLatencyUma(const WebInputEvent& event, base::TimeTicks now) {
170 UMA_HISTOGRAM_CUSTOM_COUNTS( 175 UMA_HISTOGRAM_CUSTOM_COUNTS(
171 "Event.AggregatedLatency.Renderer2", 176 "Event.AggregatedLatency.Renderer2",
172 GetEventLatencyMicros(event, now), 177 GetEventLatencyMicros(event, now),
173 1, 178 1,
174 10000000, 179 10000000,
175 100); 180 100);
176 181
177 #define CASE_TYPE(t) \ 182 #define CASE_TYPE(t) \
178 case WebInputEvent::t: \ 183 case WebInputEvent::t: \
(...skipping 2042 matching lines...) Expand 10 before | Expand all | Expand 10 after
2221 const blink::WebFloatSize& accumulatedRootOverScroll, 2226 const blink::WebFloatSize& accumulatedRootOverScroll,
2222 const blink::WebFloatPoint& position, 2227 const blink::WebFloatPoint& position,
2223 const blink::WebFloatSize& velocity) { 2228 const blink::WebFloatSize& velocity) {
2224 DidOverscrollParams params; 2229 DidOverscrollParams params;
2225 // TODO(jdduke): Consider bundling the overscroll with the input event ack to 2230 // TODO(jdduke): Consider bundling the overscroll with the input event ack to
2226 // save an IPC. 2231 // save an IPC.
2227 params.accumulated_overscroll = gfx::Vector2dF( 2232 params.accumulated_overscroll = gfx::Vector2dF(
2228 accumulatedRootOverScroll.width, accumulatedRootOverScroll.height); 2233 accumulatedRootOverScroll.width, accumulatedRootOverScroll.height);
2229 params.latest_overscroll_delta = 2234 params.latest_overscroll_delta =
2230 gfx::Vector2dF(unusedDelta.width, unusedDelta.height); 2235 gfx::Vector2dF(unusedDelta.width, unusedDelta.height);
2231 params.current_fling_velocity = 2236 params.current_fling_velocity = ToClientScrollIncrement(velocity);
2232 gfx::Vector2dF(velocity.width, velocity.height);
2233 params.causal_event_viewport_point = gfx::PointF(position.x, position.y); 2237 params.causal_event_viewport_point = gfx::PointF(position.x, position.y);
2234 Send(new InputHostMsg_DidOverscroll(routing_id_, params)); 2238 Send(new InputHostMsg_DidOverscroll(routing_id_, params));
2235 } 2239 }
2236 2240
2237 void RenderWidget::StartCompositor() { 2241 void RenderWidget::StartCompositor() {
2238 // For widgets that are never visible, we don't need the compositor to run 2242 // For widgets that are never visible, we don't need the compositor to run
2239 // at all. 2243 // at all.
2240 if (never_visible_) 2244 if (never_visible_)
2241 return; 2245 return;
2242 // In tests without a RenderThreadImpl, don't set ready as this kicks 2246 // In tests without a RenderThreadImpl, don't set ready as this kicks
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
2454 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { 2458 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) {
2455 video_hole_frames_.AddObserver(frame); 2459 video_hole_frames_.AddObserver(frame);
2456 } 2460 }
2457 2461
2458 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { 2462 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) {
2459 video_hole_frames_.RemoveObserver(frame); 2463 video_hole_frames_.RemoveObserver(frame);
2460 } 2464 }
2461 #endif // defined(VIDEO_HOLE) 2465 #endif // defined(VIDEO_HOLE)
2462 2466
2463 } // namespace content 2467 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698