Opened 13 months ago

Last modified 6 months ago

#5258 reviewing change

[emscripten] Make filters and subscriptions easier to use from C++

Reported by: trev Assignee:
Priority: P2 Milestone:
Module: Core Keywords:
Cc: Blocked By:
Blocking: #4122, #5141, #5259 Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29574591/
https://codereview.adblockplus.org/29581588/

Description

Background

We made filter and subscription classes easy to use from JavaScript, yet from C++ it is rather awkward. There is no easy way to convert a Filter instance to something like ActiveFilter safely, and only Filter references can be kept easily (no ActiveFilterPtr). Same issues apply to subscription, and one more: iterating over subscription's filters in C++ is quite complicated.

What to change

  • Implement Filter::As<FilterSubClass>() that will either cast the filter to FilterSubClass or return nullptr if the instance is incompatible. Similarly, implement Subscription::As<SubscriptionSubClass().
  • Define ActiveFilterPtr and the like in addition to FilterPtr.
  • Expose begin() and end() methods on Subscription forwarding the corresponding methods from Subscription.mFilters.

Change History (6)

comment:1 Changed 8 months ago by trev

  • Blocking 5259 added; 5137 removed

comment:2 Changed 8 months ago by trev

  • Blocking 5141 added

comment:3 Changed 8 months ago by trev

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:4 Changed 8 months ago by trev

  • Review URL(s) modified (diff)

comment:6 Changed 6 months ago by trev

  • Owner trev deleted
Note: See TracTickets for help on using tickets.