Closed Bug 1542064 Opened 6 years ago Closed 6 years ago

Add MOZ_DBG support for RawServoAnimationValue (or AnimationValue)

Categories

(Core :: DOM: Animation, enhancement, P5)

enhancement

Tracking

()

RESOLVED FIXED
mozilla69
Tracking Status
firefox68 --- wontfix
firefox69 --- fixed

People

(Reporter: boris, Assigned: boris)

References

Details

Attachments

(1 file, 1 obsolete file)

In C++, it's pretty hard to dump the servo animation value for now. We may use cbindgen to generate RawServoAnimationValue in the future, but it's still worth to add an operator<< for AnimationValue, so it'd be easier to dump the animation value on the gecko side.

If we do that, we could probably drop DumpAnimationProperties too (which I made some tweaks to here: https://github.com/birtles/gecko-dev/commit/c8d47602c819bb1512ddeb6d8cd515258ae93095)

At some point I also found myself wanting to dump the specified versions too like we get in Keyframe/PropertyValuePair objects: https://github.com/birtles/gecko-dev/commit/6a061e690b4539cf6a8c35199fb12e0b00a33828

See Also: → 1543304
See Also: → 1266321
Assignee: nobody → boris.chiou

I would like to debug animations for OMTA, so maybe it's time to implement this.

I also recall wanting this recently and at that point I thought it would more convenient if we added support for RawServoAnimationValue rather than requiring the AnimationValue wrapper. (And I think somewhere I commented about a possible place to add support for RawServoAnimationValue but I don't recall where that was.)

(In reply to Brian Birtles (:birtles) from comment #3)

I also recall wanting this recently and at that point I thought it would more convenient if we added support for RawServoAnimationValue rather than requiring the AnimationValue wrapper. (And I think somewhere I commented about a possible place to add support for RawServoAnimationValue but I don't recall where that was.)

I'd like to add two inline overloading functions in StyleAnimationValue.h:

inline std::ostream& operator<<(std::ostream& aOut, const AnimationValue& aValue); // This calls FFI to get the content of RawServoAnimationValue
inline std::ostream& operator<<(std::ostream& aOut, const RefPtr<RawServoAnimationValue>& aValue); // This calls FFI, too.

The first overloading function, for AnimationValue, works as I expected.

However, got a problem for the 2nd function. We have a function template for RefPtr<T> in RefPtr.h already [1]:

template <class T>
std::ostream& operator<<(std::ostream& aOut, const RefPtr<T>& aObj) {
  return mozilla::DebugValue(aOut, aObj.get());
}

It seems if I call

RefPtr<RawServoAnimationValue> value; // set from FFI.
MOZ_DBG(value);

This always outputs something like this: [MozDbg] ... value = 0x7f90cc70a188. Obviously, it uses the default behavior for non-derefed pointer. Ok, so I am struggling against this issue, and no idea how to make the non-template overloading operator work (in a different header file). Cameron, do you have any, hmm, possible way to overload the default behavior? I am a template idiot, so have no idea right now.

[1] https://searchfox.org/mozilla-central/rev/7556a400affa9eb99e522d2d17c40689fa23a729/mfbt/RefPtr.h#527-532

Flags: needinfo?(cam)
Flags: needinfo?(cam)

Still don't know why I cannot overloading the operator<<(..., const RefPtr<StyleAnimationValue>& ...) in StyleAnimationValue.h, so I only support MOZ_DBG for AnimationValue for now.

Attachment #9071491 - Attachment is obsolete: true
Pushed by boris.chiou@gmail.com: https://hg.mozilla.org/integration/autoland/rev/e84f1dd07f66 Add MOZ_DBG support for AnimationValue. r=heycam
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla69
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: