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

Side by Side Diff: third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc

Issue 2573073003: Collapse the API surface on WebInputEvent via accessor functions. (Closed)
Patch Set: Fix nits Created 3 years, 11 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 "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 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 594
595 bool RendererSchedulerImpl::PolicyNeedsUpdateForTesting() { 595 bool RendererSchedulerImpl::PolicyNeedsUpdateForTesting() {
596 return policy_may_need_update_.IsSet(); 596 return policy_may_need_update_.IsSet();
597 } 597 }
598 598
599 // static 599 // static
600 bool RendererSchedulerImpl::ShouldPrioritizeInputEvent( 600 bool RendererSchedulerImpl::ShouldPrioritizeInputEvent(
601 const blink::WebInputEvent& web_input_event) { 601 const blink::WebInputEvent& web_input_event) {
602 // We regard MouseMove events with the left mouse button down as a signal 602 // We regard MouseMove events with the left mouse button down as a signal
603 // that the user is doing something requiring a smooth frame rate. 603 // that the user is doing something requiring a smooth frame rate.
604 if ((web_input_event.type == blink::WebInputEvent::MouseDown || 604 if ((web_input_event.type() == blink::WebInputEvent::MouseDown ||
605 web_input_event.type == blink::WebInputEvent::MouseMove) && 605 web_input_event.type() == blink::WebInputEvent::MouseMove) &&
606 (web_input_event.modifiers & blink::WebInputEvent::LeftButtonDown)) { 606 (web_input_event.modifiers() & blink::WebInputEvent::LeftButtonDown)) {
607 return true; 607 return true;
608 } 608 }
609 // Ignore all other mouse events because they probably don't signal user 609 // Ignore all other mouse events because they probably don't signal user
610 // interaction needing a smooth framerate. NOTE isMouseEventType returns false 610 // interaction needing a smooth framerate. NOTE isMouseEventType returns false
611 // for mouse wheel events, hence we regard them as user input. 611 // for mouse wheel events, hence we regard them as user input.
612 // Ignore keyboard events because it doesn't really make sense to enter 612 // Ignore keyboard events because it doesn't really make sense to enter
613 // compositor priority for them. 613 // compositor priority for them.
614 if (blink::WebInputEvent::isMouseEventType(web_input_event.type) || 614 if (blink::WebInputEvent::isMouseEventType(web_input_event.type()) ||
615 blink::WebInputEvent::isKeyboardEventType(web_input_event.type)) { 615 blink::WebInputEvent::isKeyboardEventType(web_input_event.type())) {
616 return false; 616 return false;
617 } 617 }
618 return true; 618 return true;
619 } 619 }
620 620
621 void RendererSchedulerImpl::DidHandleInputEventOnCompositorThread( 621 void RendererSchedulerImpl::DidHandleInputEventOnCompositorThread(
622 const blink::WebInputEvent& web_input_event, 622 const blink::WebInputEvent& web_input_event,
623 InputEventState event_state) { 623 InputEventState event_state) {
624 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), 624 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"),
625 "RendererSchedulerImpl::DidHandleInputEventOnCompositorThread"); 625 "RendererSchedulerImpl::DidHandleInputEventOnCompositorThread");
626 if (!ShouldPrioritizeInputEvent(web_input_event)) 626 if (!ShouldPrioritizeInputEvent(web_input_event))
627 return; 627 return;
628 628
629 UpdateForInputEventOnCompositorThread(web_input_event.type, event_state); 629 UpdateForInputEventOnCompositorThread(web_input_event.type(), event_state);
630 } 630 }
631 631
632 void RendererSchedulerImpl::DidAnimateForInputOnCompositorThread() { 632 void RendererSchedulerImpl::DidAnimateForInputOnCompositorThread() {
633 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), 633 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"),
634 "RendererSchedulerImpl::DidAnimateForInputOnCompositorThread"); 634 "RendererSchedulerImpl::DidAnimateForInputOnCompositorThread");
635 base::AutoLock lock(any_thread_lock_); 635 base::AutoLock lock(any_thread_lock_);
636 AnyThread().fling_compositor_escalation_deadline = 636 AnyThread().fling_compositor_escalation_deadline =
637 helper_.scheduler_tqm_delegate()->NowTicks() + 637 helper_.scheduler_tqm_delegate()->NowTicks() +
638 base::TimeDelta::FromMilliseconds(kFlingEscalationLimitMillis); 638 base::TimeDelta::FromMilliseconds(kFlingEscalationLimitMillis);
639 } 639 }
(...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1871 case TimeDomainType::VIRTUAL: 1871 case TimeDomainType::VIRTUAL:
1872 return "virtual"; 1872 return "virtual";
1873 default: 1873 default:
1874 NOTREACHED(); 1874 NOTREACHED();
1875 return nullptr; 1875 return nullptr;
1876 } 1876 }
1877 } 1877 }
1878 1878
1879 } // namespace scheduler 1879 } // namespace scheduler
1880 } // namespace blink 1880 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698