Open Bug 1272554 Opened 8 years ago Updated 1 year ago

Add lambda versions of nsIDocument::EnumerateSubDocuments

Categories

(Core :: DOM: Core & HTML, defect)

defect

Tracking

()

People

(Reporter: seth, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 1 obsolete file)

It'd be extremely natural for nsIDocument::EnumerateSubDocuments() to take a lambda function, so let's add a version that does so. (Given that EnumerateSubDocuments() is virtual and the lambda version should be a template, we actually need to add a different method that calls the original.)

While we're at it, it's a common need to apply the same function to both a document and all of its subdocuments. This is especially convenient when using lambdas. Let's add another variant of EnumerateSubDocuments() for that purpose, too.
Here's the patch. The new methods use a local captureless lambda to create a
normal function pointer which can be passed to EnumerateSubDocuments(), so the
original implementation is used under the hood.
Attachment #8752037 - Flags: review?(mrbkap)
Argh, noticed a comment typo immediately after uploading.
Attachment #8752039 - Flags: review?(mrbkap)
Attachment #8752037 - Attachment is obsolete: true
Attachment #8752037 - Flags: review?(mrbkap)
Comment on attachment 8752039 [details] [diff] [review]
Add lambda versions of nsIDocument::EnumerateSubDocuments().

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

::: dom/base/nsIDocument.h
@@ +1553,5 @@
>     */
>    typedef bool (*nsSubDocEnumFunc)(nsIDocument *aDocument, void *aData);
>    virtual void EnumerateSubDocuments(nsSubDocEnumFunc aCallback,
>                                       void *aData) = 0;
> +  /**

Nit: add a blank line before the beginning of this comment.
Attachment #8752039 - Flags: review?(mrbkap) → review+

The bug assignee didn't login in Bugzilla in the last 7 months, so the assignee is being reset.

Assignee: seth.bugzilla → nobody
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: