See: the Content Blocer system on iOS. The interface is a rules specification, and the implementation is delegated to the OS/hardware manufacturer to save power and performance.
Right, too bad the entire architecture is useless because blockers are not allowed to use JS. Filter expressions are not enough anymore.