OMTAController.cpp (1307B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #include "mozilla/layers/OMTAController.h" 8 9 #include "mozilla/layers/CompositorBridgeParent.h" 10 #include "mozilla/layers/CompositorThread.h" 11 #include "mozilla/StaticPrefs_layout.h" 12 13 namespace mozilla { 14 namespace layers { 15 16 void OMTAController::NotifyJankedAnimations( 17 JankedAnimations&& aJankedAnimations) const { 18 if (StaticPrefs::layout_animation_prerender_partial_jank()) { 19 return; 20 } 21 22 if (!CompositorThread()) { 23 return; 24 } 25 26 if (!CompositorThread()->IsOnCurrentThread()) { 27 CompositorThread()->Dispatch(NewRunnableMethod<JankedAnimations&&>( 28 "layers::OMTAController::NotifyJankedAnimations", this, 29 &OMTAController::NotifyJankedAnimations, std::move(aJankedAnimations))); 30 return; 31 } 32 33 if (CompositorBridgeParent* bridge = 34 CompositorBridgeParent::GetCompositorBridgeParentFromLayersId( 35 mRootLayersId)) { 36 bridge->NotifyJankedAnimations(aJankedAnimations); 37 } 38 } 39 40 } // namespace layers 41 } // namespace mozilla