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

Side by Side Diff: content/renderer/scheduler/renderer_scheduler_impl.cc

Issue 902783003: MouseMove when the mouse is down to signal compositor priority (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Really fix it Created 5 years, 10 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/scheduler/renderer_scheduler_impl.h" 5 #include "content/renderer/scheduler/renderer_scheduler_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop_proxy.h" 8 #include "base/message_loop/message_loop_proxy.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "base/trace_event/trace_event_argument.h" 10 #include "base/trace_event/trace_event_argument.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 base::TimeTicks now(Now()); 113 base::TimeTicks now(Now());
114 if (now < estimated_next_frame_begin_) { 114 if (now < estimated_next_frame_begin_) {
115 StartIdlePeriod(); 115 StartIdlePeriod();
116 control_task_runner_->PostDelayedTask(FROM_HERE, 116 control_task_runner_->PostDelayedTask(FROM_HERE,
117 end_idle_period_closure_.callback(), 117 end_idle_period_closure_.callback(),
118 estimated_next_frame_begin_ - now); 118 estimated_next_frame_begin_ - now);
119 } 119 }
120 } 120 }
121 121
122 void RendererSchedulerImpl::DidReceiveInputEventOnCompositorThread( 122 void RendererSchedulerImpl::DidReceiveInputEventOnCompositorThread(
123 blink::WebInputEvent::Type type) { 123 const blink::WebInputEvent& web_input_event) {
124 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), 124 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"),
125 "RendererSchedulerImpl::DidReceiveInputEventOnCompositorThread"); 125 "RendererSchedulerImpl::DidReceiveInputEventOnCompositorThread");
126 // Ignore mouse events because on windows these can very frequent. 126 // We regard MouseMove events with the left mouse button down as a signsal
127 // that the user is doing something requiring a smooth frame rate.
128 if (web_input_event.type == blink::WebInputEvent::MouseMove &&
129 web_input_event.modifiers & blink::WebInputEvent::LeftButtonDown) {
picksi 2015/02/06 09:23:47 nit: Should we add blink::WebInputEvent::isLeftMou
alex clarke (OOO till 29th) 2015/02/06 10:12:21 I can't change WebInputEvent in this patch since t
130 UpdateForInputEvent();
131 return;
132 }
133 // Ignore all other mouse events becuase they probably don't signal user
134 // interaction needing a smooth framerate. NOTE isMouseEventType returns false
135 // for mouse wheel events, hence we regard them as user input.
127 // Ignore keyboard events because it doesn't really make sense to enter 136 // Ignore keyboard events because it doesn't really make sense to enter
128 // compositor priority for them. 137 // compositor priority for them.
129 if (blink::WebInputEvent::isMouseEventType(type) || 138 if (blink::WebInputEvent::isMouseEventType(web_input_event.type) ||
130 blink::WebInputEvent::isKeyboardEventType(type)) { 139 blink::WebInputEvent::isKeyboardEventType(web_input_event.type)) {
131 return; 140 return;
132 } 141 }
133 UpdateForInputEvent(); 142 UpdateForInputEvent();
134 } 143 }
135 144
136 void RendererSchedulerImpl::DidAnimateForInputOnCompositorThread() { 145 void RendererSchedulerImpl::DidAnimateForInputOnCompositorThread() {
137 UpdateForInputEvent(); 146 UpdateForInputEvent();
138 } 147 }
139 148
140 void RendererSchedulerImpl::UpdateForInputEvent() { 149 void RendererSchedulerImpl::UpdateForInputEvent() {
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 state->SetDouble("last_input_time", 353 state->SetDouble("last_input_time",
345 (last_input_time_ - base::TimeTicks()).InMillisecondsF()); 354 (last_input_time_ - base::TimeTicks()).InMillisecondsF());
346 state->SetDouble( 355 state->SetDouble(
347 "estimated_next_frame_begin", 356 "estimated_next_frame_begin",
348 (estimated_next_frame_begin_ - base::TimeTicks()).InMillisecondsF()); 357 (estimated_next_frame_begin_ - base::TimeTicks()).InMillisecondsF());
349 358
350 return state; 359 return state;
351 } 360 }
352 361
353 } // namespace content 362 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/scheduler/renderer_scheduler_impl.h ('k') | content/renderer/scheduler/renderer_scheduler_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698