/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
staticbool CanSuspendInputEvent() { // Ensure it's content process because InputTaskManager only // works in e10s. // // Input tasks will have nullptr as their task manager when the // event queue state is STATE_DISABLED, so we can't suspend // input events. return XRE_IsContentProcess() &&
StaticPrefs::dom_input_events_canSuspendInBCG_enabled() &&
InputTaskManager::Get()->State() !=
InputEventQueueState::STATE_DISABLED;
}
class InputPriorityController { public:
InputPriorityController(); // Determines whether we should use the highest input priority for input // tasks bool ShouldUseHighestPriority(InputTaskManager*);
void WillRunVsync();
// Gets called when a input task is going to run; If the current // input vsync state is `HasPendingVsync`, determines whether we // should continue running input tasks or leave the `HasPendingVsync` state // based on // 1. Whether we still have time to process input tasks // 2. Whether we have processed the max number of tasks that // we should process. void WillRunTask();
private: // Used to represents the relationship between Input and Vsync. // // HasPendingVsync: There are pending vsync tasks and we are using // InputHighest priority for inputs. // NoPendingVsync: No pending vsync tasks and no need to use InputHighest // priority. // RunVsync: Finished running input tasks and the vsync task // should be run. enumclass InputVsyncState {
HasPendingVsync,
NoPendingVsync,
RunVsync,
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.