| 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 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 | 750 |
| 751 if (use_case != previous_use_case || | 751 if (use_case != previous_use_case || |
| 752 was_awaiting_touch_start_response != | 752 was_awaiting_touch_start_response != |
| 753 AnyThread().awaiting_touch_start_response) { | 753 AnyThread().awaiting_touch_start_response) { |
| 754 EnsureUrgentPolicyUpdatePostedOnMainThread(FROM_HERE); | 754 EnsureUrgentPolicyUpdatePostedOnMainThread(FROM_HERE); |
| 755 } | 755 } |
| 756 CompositorThreadOnly().last_input_type = type; | 756 CompositorThreadOnly().last_input_type = type; |
| 757 } | 757 } |
| 758 | 758 |
| 759 void RendererSchedulerImpl::DidHandleInputEventOnMainThread( | 759 void RendererSchedulerImpl::DidHandleInputEventOnMainThread( |
| 760 const blink::WebInputEvent& web_input_event) { | 760 const WebInputEvent& web_input_event, |
| 761 WebInputEventResult result) { |
| 761 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), | 762 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), |
| 762 "RendererSchedulerImpl::DidHandleInputEventOnMainThread"); | 763 "RendererSchedulerImpl::DidHandleInputEventOnMainThread"); |
| 763 helper_.CheckOnValidThread(); | 764 helper_.CheckOnValidThread(); |
| 764 if (ShouldPrioritizeInputEvent(web_input_event)) { | 765 if (ShouldPrioritizeInputEvent(web_input_event)) { |
| 765 base::AutoLock lock(any_thread_lock_); | 766 base::AutoLock lock(any_thread_lock_); |
| 766 AnyThread().user_model.DidFinishProcessingInputEvent( | 767 AnyThread().user_model.DidFinishProcessingInputEvent( |
| 767 helper_.scheduler_tqm_delegate()->NowTicks()); | 768 helper_.scheduler_tqm_delegate()->NowTicks()); |
| 769 |
| 770 // If we were waiting for a touchstart response and the main thread has |
| 771 // prevented the default gesture, consider the gesture established. This |
| 772 // ensures single-event gestures such as button presses are promptly |
| 773 // detected. |
| 774 if (AnyThread().awaiting_touch_start_response && |
| 775 result == WebInputEventResult::HandledApplication) { |
| 776 AnyThread().awaiting_touch_start_response = false; |
| 777 AnyThread().default_gesture_prevented = true; |
| 778 UpdatePolicyLocked(UpdateType::MAY_EARLY_OUT_IF_POLICY_UNCHANGED); |
| 779 } |
| 768 } | 780 } |
| 769 } | 781 } |
| 770 | 782 |
| 771 bool RendererSchedulerImpl::IsHighPriorityWorkAnticipated() { | 783 bool RendererSchedulerImpl::IsHighPriorityWorkAnticipated() { |
| 772 helper_.CheckOnValidThread(); | 784 helper_.CheckOnValidThread(); |
| 773 if (helper_.IsShutdown()) | 785 if (helper_.IsShutdown()) |
| 774 return false; | 786 return false; |
| 775 | 787 |
| 776 MaybeUpdatePolicy(); | 788 MaybeUpdatePolicy(); |
| 777 // The touchstart, synchronized gesture and main-thread gesture use cases | 789 // The touchstart, synchronized gesture and main-thread gesture use cases |
| (...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1874 case TimeDomainType::VIRTUAL: | 1886 case TimeDomainType::VIRTUAL: |
| 1875 return "virtual"; | 1887 return "virtual"; |
| 1876 default: | 1888 default: |
| 1877 NOTREACHED(); | 1889 NOTREACHED(); |
| 1878 return nullptr; | 1890 return nullptr; |
| 1879 } | 1891 } |
| 1880 } | 1892 } |
| 1881 | 1893 |
| 1882 } // namespace scheduler | 1894 } // namespace scheduler |
| 1883 } // namespace blink | 1895 } // namespace blink |
| OLD | NEW |