Closed Bug 1245979 Opened 8 years ago Closed 8 years ago

mfbt Function lacks functionality needed for interoperating with Skia

Categories

(Core :: MFBT, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla47
Tracking Status
firefox47 --- fixed

People

(Reporter: lsalzman, Assigned: lsalzman)

References

Details

Attachments

(1 file)

When trying to shim mfbt Function in place of std::function inside Skia, I ran into the following deficiencies:

1) Skia copies std::function by value in several places, and we need a default copy constructor
2) Skia converts it to bool and we have no bool conversion operator
3) Skia initializes it with nullptr and we had no constructor for that
Component: Graphics → MFBT
This patch addresses all the listed issues and makes Skia compile cleanly.
Attachment #8716021 - Flags: review?(nfroyd)
Comment on attachment 8716021 [details] [diff] [review]
make mfbt Function reference-counted so that it can be cheaply copied for compatibility with Skia

Review of attachment 8716021 [details] [diff] [review]:
-----------------------------------------------------------------

r=me  It's not great that we're making Function have higher overhead; OTOH, Function should be going away soonish and it's not widely used in the first place.

::: mfbt/Function.h
@@ +45,3 @@
>  {
>  public:
> +  MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(FunctionImplBase)

Does this need to be virtual?  I guess it doesn't matter that much for debug builds...
Attachment #8716021 - Flags: review?(nfroyd) → review+
https://hg.mozilla.org/mozilla-central/rev/915eba505316
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
See Also: → 1263342
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: