| OLD | NEW |
| 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 "platform/scheduler/renderer/renderer_scheduler_impl.h" | 5 #include "platform/scheduler/renderer/renderer_scheduler_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/stack_trace.h" | 8 #include "base/debug/stack_trace.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 | 587 |
| 588 bool RendererSchedulerImpl::PolicyNeedsUpdateForTesting() { | 588 bool RendererSchedulerImpl::PolicyNeedsUpdateForTesting() { |
| 589 return policy_may_need_update_.IsSet(); | 589 return policy_may_need_update_.IsSet(); |
| 590 } | 590 } |
| 591 | 591 |
| 592 // static | 592 // static |
| 593 bool RendererSchedulerImpl::ShouldPrioritizeInputEvent( | 593 bool RendererSchedulerImpl::ShouldPrioritizeInputEvent( |
| 594 const blink::WebInputEvent& web_input_event) { | 594 const blink::WebInputEvent& web_input_event) { |
| 595 // We regard MouseMove events with the left mouse button down as a signal | 595 // We regard MouseMove events with the left mouse button down as a signal |
| 596 // that the user is doing something requiring a smooth frame rate. | 596 // that the user is doing something requiring a smooth frame rate. |
| 597 if ((web_input_event.type == blink::WebInputEvent::MouseDown || | 597 if ((web_input_event.type() == blink::WebInputEvent::MouseDown || |
| 598 web_input_event.type == blink::WebInputEvent::MouseMove) && | 598 web_input_event.type() == blink::WebInputEvent::MouseMove) && |
| 599 (web_input_event.modifiers & blink::WebInputEvent::LeftButtonDown)) { | 599 (web_input_event.modifiers() & blink::WebInputEvent::LeftButtonDown)) { |
| 600 return true; | 600 return true; |
| 601 } | 601 } |
| 602 // Ignore all other mouse events because they probably don't signal user | 602 // Ignore all other mouse events because they probably don't signal user |
| 603 // interaction needing a smooth framerate. NOTE isMouseEventType returns false | 603 // interaction needing a smooth framerate. NOTE isMouseEventType returns false |
| 604 // for mouse wheel events, hence we regard them as user input. | 604 // for mouse wheel events, hence we regard them as user input. |
| 605 // Ignore keyboard events because it doesn't really make sense to enter | 605 // Ignore keyboard events because it doesn't really make sense to enter |
| 606 // compositor priority for them. | 606 // compositor priority for them. |
| 607 if (blink::WebInputEvent::isMouseEventType(web_input_event.type) || | 607 if (blink::WebInputEvent::isMouseEventType(web_input_event.type()) || |
| 608 blink::WebInputEvent::isKeyboardEventType(web_input_event.type)) { | 608 blink::WebInputEvent::isKeyboardEventType(web_input_event.type())) { |
| 609 return false; | 609 return false; |
| 610 } | 610 } |
| 611 return true; | 611 return true; |
| 612 } | 612 } |
| 613 | 613 |
| 614 void RendererSchedulerImpl::DidHandleInputEventOnCompositorThread( | 614 void RendererSchedulerImpl::DidHandleInputEventOnCompositorThread( |
| 615 const blink::WebInputEvent& web_input_event, | 615 const blink::WebInputEvent& web_input_event, |
| 616 InputEventState event_state) { | 616 InputEventState event_state) { |
| 617 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), | 617 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), |
| 618 "RendererSchedulerImpl::DidHandleInputEventOnCompositorThread"); | 618 "RendererSchedulerImpl::DidHandleInputEventOnCompositorThread"); |
| 619 if (!ShouldPrioritizeInputEvent(web_input_event)) | 619 if (!ShouldPrioritizeInputEvent(web_input_event)) |
| 620 return; | 620 return; |
| 621 | 621 |
| 622 UpdateForInputEventOnCompositorThread(web_input_event.type, event_state); | 622 UpdateForInputEventOnCompositorThread(web_input_event.type(), event_state); |
| 623 } | 623 } |
| 624 | 624 |
| 625 void RendererSchedulerImpl::DidAnimateForInputOnCompositorThread() { | 625 void RendererSchedulerImpl::DidAnimateForInputOnCompositorThread() { |
| 626 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), | 626 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), |
| 627 "RendererSchedulerImpl::DidAnimateForInputOnCompositorThread"); | 627 "RendererSchedulerImpl::DidAnimateForInputOnCompositorThread"); |
| 628 base::AutoLock lock(any_thread_lock_); | 628 base::AutoLock lock(any_thread_lock_); |
| 629 AnyThread().fling_compositor_escalation_deadline = | 629 AnyThread().fling_compositor_escalation_deadline = |
| 630 helper_.scheduler_tqm_delegate()->NowTicks() + | 630 helper_.scheduler_tqm_delegate()->NowTicks() + |
| 631 base::TimeDelta::FromMilliseconds(kFlingEscalationLimitMillis); | 631 base::TimeDelta::FromMilliseconds(kFlingEscalationLimitMillis); |
| 632 } | 632 } |
| (...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1817 case TimeDomainType::VIRTUAL: | 1817 case TimeDomainType::VIRTUAL: |
| 1818 return "virtual"; | 1818 return "virtual"; |
| 1819 default: | 1819 default: |
| 1820 NOTREACHED(); | 1820 NOTREACHED(); |
| 1821 return nullptr; | 1821 return nullptr; |
| 1822 } | 1822 } |
| 1823 } | 1823 } |
| 1824 | 1824 |
| 1825 } // namespace scheduler | 1825 } // namespace scheduler |
| 1826 } // namespace blink | 1826 } // namespace blink |
| OLD | NEW |