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

Side by Side Diff: trunk/src/content/renderer/input/input_handler_proxy.cc

Issue 254883004: Revert 266624 "cc: Split animating and drawing into separate act..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 7 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/input/input_handler_proxy.h" 5 #include "content/renderer/input/input_handler_proxy.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 kBadTimestampDeltaFromNowInS); 331 kBadTimestampDeltaFromNowInS);
332 } 332 }
333 fling_parameters_.delta = 333 fling_parameters_.delta =
334 WebFloatPoint(gesture_event.data.flingStart.velocityX, 334 WebFloatPoint(gesture_event.data.flingStart.velocityX,
335 gesture_event.data.flingStart.velocityY); 335 gesture_event.data.flingStart.velocityY);
336 fling_parameters_.point = WebPoint(gesture_event.x, gesture_event.y); 336 fling_parameters_.point = WebPoint(gesture_event.x, gesture_event.y);
337 fling_parameters_.globalPoint = 337 fling_parameters_.globalPoint =
338 WebPoint(gesture_event.globalX, gesture_event.globalY); 338 WebPoint(gesture_event.globalX, gesture_event.globalY);
339 fling_parameters_.modifiers = gesture_event.modifiers; 339 fling_parameters_.modifiers = gesture_event.modifiers;
340 fling_parameters_.sourceDevice = gesture_event.sourceDevice; 340 fling_parameters_.sourceDevice = gesture_event.sourceDevice;
341 input_handler_->SetNeedsAnimate(); 341 input_handler_->ScheduleAnimation();
342 return DID_HANDLE; 342 return DID_HANDLE;
343 } 343 }
344 case cc::InputHandler::ScrollUnknown: 344 case cc::InputHandler::ScrollUnknown:
345 case cc::InputHandler::ScrollOnMainThread: { 345 case cc::InputHandler::ScrollOnMainThread: {
346 TRACE_EVENT_INSTANT0("input", 346 TRACE_EVENT_INSTANT0("input",
347 "InputHandlerProxy::HandleGestureFling::" 347 "InputHandlerProxy::HandleGestureFling::"
348 "scroll_on_main_thread", 348 "scroll_on_main_thread",
349 TRACE_EVENT_SCOPE_THREAD); 349 TRACE_EVENT_SCOPE_THREAD);
350 fling_may_be_active_on_main_thread_ = true; 350 fling_may_be_active_on_main_thread_ = true;
351 return DID_NOT_HANDLE; 351 return DID_NOT_HANDLE;
(...skipping 19 matching lines...) Expand all
371 } 371 }
372 372
373 void InputHandlerProxy::Animate(base::TimeTicks time) { 373 void InputHandlerProxy::Animate(base::TimeTicks time) {
374 if (!fling_curve_) 374 if (!fling_curve_)
375 return; 375 return;
376 376
377 double monotonic_time_sec = InSecondsF(time); 377 double monotonic_time_sec = InSecondsF(time);
378 if (!fling_parameters_.startTime || 378 if (!fling_parameters_.startTime ||
379 monotonic_time_sec <= fling_parameters_.startTime) { 379 monotonic_time_sec <= fling_parameters_.startTime) {
380 fling_parameters_.startTime = monotonic_time_sec; 380 fling_parameters_.startTime = monotonic_time_sec;
381 input_handler_->SetNeedsAnimate(); 381 input_handler_->ScheduleAnimation();
382 return; 382 return;
383 } 383 }
384 384
385 bool fling_is_active = 385 bool fling_is_active =
386 fling_curve_->apply(monotonic_time_sec - fling_parameters_.startTime, 386 fling_curve_->apply(monotonic_time_sec - fling_parameters_.startTime,
387 this); 387 this);
388 388
389 if (disallow_vertical_fling_scroll_ && disallow_horizontal_fling_scroll_) 389 if (disallow_vertical_fling_scroll_ && disallow_horizontal_fling_scroll_)
390 fling_is_active = false; 390 fling_is_active = false;
391 391
392 if (fling_is_active) { 392 if (fling_is_active) {
393 input_handler_->SetNeedsAnimate(); 393 input_handler_->ScheduleAnimation();
394 } else { 394 } else {
395 TRACE_EVENT_INSTANT0("input", 395 TRACE_EVENT_INSTANT0("input",
396 "InputHandlerProxy::animate::flingOver", 396 "InputHandlerProxy::animate::flingOver",
397 TRACE_EVENT_SCOPE_THREAD); 397 TRACE_EVENT_SCOPE_THREAD);
398 CancelCurrentFling(true); 398 CancelCurrentFling(true);
399 } 399 }
400 } 400 }
401 401
402 void InputHandlerProxy::MainThreadHasStoppedFlinging() { 402 void InputHandlerProxy::MainThreadHasStoppedFlinging() {
403 fling_may_be_active_on_main_thread_ = false; 403 fling_may_be_active_on_main_thread_ = false;
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 // trigger a scroll, e.g., with a trivial time delta between fling updates. 552 // trigger a scroll, e.g., with a trivial time delta between fling updates.
553 // Return true in this case to prevent early fling termination. 553 // Return true in this case to prevent early fling termination.
554 if (std::abs(clipped_increment.width) < kScrollEpsilon && 554 if (std::abs(clipped_increment.width) < kScrollEpsilon &&
555 std::abs(clipped_increment.height) < kScrollEpsilon) 555 std::abs(clipped_increment.height) < kScrollEpsilon)
556 return true; 556 return true;
557 557
558 return did_scroll; 558 return did_scroll;
559 } 559 }
560 560
561 } // namespace content 561 } // namespace content
OLDNEW
« no previous file with comments | « trunk/src/cc/trees/thread_proxy.cc ('k') | trunk/src/content/renderer/input/input_handler_proxy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698