зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1636731 - Use FunctionRef for animation generation enumeration. r=hiro
I see the allocation and deallocation of the std::function show up in profiles. Differential Revision: https://phabricator.services.mozilla.com/D74551
This commit is contained in:
Родитель
a9633edb83
Коммит
5e7fe01b59
|
@ -182,7 +182,7 @@ Maybe<uint64_t> AnimationInfo::GetGenerationFromFrame(
|
|||
void AnimationInfo::EnumerateGenerationOnFrame(
|
||||
const nsIFrame* aFrame, const nsIContent* aContent,
|
||||
const CompositorAnimatableDisplayItemTypes& aDisplayItemTypes,
|
||||
const AnimationGenerationCallback& aCallback) {
|
||||
AnimationGenerationCallback aCallback) {
|
||||
if (XRE_IsContentProcess()) {
|
||||
if (nsIWidget* widget = nsContentUtils::WidgetForContent(aContent)) {
|
||||
// In case of child processes, we might not have yet created the layer
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "nsDisplayItemTypes.h"
|
||||
#include "mozilla/Array.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/FunctionRef.h"
|
||||
#include "mozilla/layers/LayersMessages.h" // for TransformData
|
||||
|
||||
struct RawServoAnimationValue;
|
||||
|
@ -102,7 +103,7 @@ class AnimationInfo final {
|
|||
using CompositorAnimatableDisplayItemTypes =
|
||||
Array<DisplayItemType,
|
||||
nsCSSPropertyIDSet::CompositorAnimatableDisplayItemCount()>;
|
||||
using AnimationGenerationCallback = std::function<bool(
|
||||
using AnimationGenerationCallback = FunctionRef<bool(
|
||||
const Maybe<uint64_t>& aGeneration, DisplayItemType aDisplayItemType)>;
|
||||
// Enumerates animation generations on |aFrame| for the given display item
|
||||
// types and calls |aCallback| with the animation generation.
|
||||
|
@ -111,7 +112,7 @@ class AnimationInfo final {
|
|||
static void EnumerateGenerationOnFrame(
|
||||
const nsIFrame* aFrame, const nsIContent* aContent,
|
||||
const CompositorAnimatableDisplayItemTypes& aDisplayItemTypes,
|
||||
const AnimationGenerationCallback& aCallback);
|
||||
AnimationGenerationCallback);
|
||||
|
||||
void AddAnimationsForDisplayItem(nsIFrame* aFrame,
|
||||
nsDisplayListBuilder* aBuilder,
|
||||
|
|
|
@ -6420,7 +6420,7 @@ Layer* FrameLayerBuilder::GetDedicatedLayer(nsIFrame* aFrame,
|
|||
|
||||
/* static */
|
||||
void FrameLayerBuilder::EnumerateGenerationForDedicatedLayers(
|
||||
const nsIFrame* aFrame, const AnimationGenerationCallback& aCallback) {
|
||||
const nsIFrame* aFrame, AnimationGenerationCallback aCallback) {
|
||||
std::bitset<static_cast<uint32_t>(DisplayItemType::TYPE_MAX)> notFoundTypes;
|
||||
for (auto displayItemType : LayerAnimationInfo::sDisplayItemTypes) {
|
||||
notFoundTypes.set(static_cast<uint32_t>(displayItemType));
|
||||
|
|
|
@ -500,7 +500,7 @@ class FrameLayerBuilder : public layers::LayerUserData {
|
|||
static Layer* GetDedicatedLayer(nsIFrame* aFrame,
|
||||
DisplayItemType aDisplayItemType);
|
||||
|
||||
using AnimationGenerationCallback = std::function<bool(
|
||||
using AnimationGenerationCallback = FunctionRef<bool(
|
||||
const Maybe<uint64_t>& aGeneration, DisplayItemType aDisplayItemType)>;
|
||||
/**
|
||||
* Enumerates layers for the all display item types that correspond to
|
||||
|
@ -512,7 +512,7 @@ class FrameLayerBuilder : public layers::LayerUserData {
|
|||
* The enumeration stops if |aCallback| returns false.
|
||||
*/
|
||||
static void EnumerateGenerationForDedicatedLayers(
|
||||
const nsIFrame* aFrame, const AnimationGenerationCallback& aCallback);
|
||||
const nsIFrame* aFrame, AnimationGenerationCallback);
|
||||
|
||||
/**
|
||||
* This callback must be provided to EndTransaction. The callback data
|
||||
|
|
Загрузка…
Ссылка в новой задаче