Opened on 04/15/2017 at 07:55:02 AM

Closed on 08/29/2019 at 05:43:52 PM

#5144 closed change (rejected)

[emscripten] Move FilterListener functionality into FilterNotifier

Reported by: trev Assignee:
Priority: P3 Milestone:
Module: Core Keywords: closed-in-favor-of-gitlab
Cc: Blocked By: #5063, #5137, #5141, #5142, #5143
Blocking: #4122 Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

Description

Background

In order to reduce the number of calls from Emscripten to JavaScript, it would be beneficial to avoid calling JavaScript FilterNotifier callbacks. Most of the time, all callbacks come from FilterListener, these can be moved into C++.

What to change

  • Add ActiveFilter.listedSubscriptionCount property, initially 0.
  • Handle some notification topics within FilterNotifier:
    • FILTER_ADDED: if the filter is added to a listed subscription, perform filter addition checks.
    • FILTER_REMOVED: if the filter is removed from a listed subscription, perform filter removal checks.
    • FILTER_DISABLED: if filter type is deriving from ActiveFilter and listedSubscriptionCount is non-zero:
      • For enabled filters, perform filter addition.
      • For disabled filters, perform filter removal.
    • SUBSCRIPTION_ADDED: if the subscription is enabled, perform filter addition checks for all subscription filters.
    • SUBSCRIPTION_REMOVED: if the subscription is enabled, perform filter removal checks for all subscription filters.
  • Filter addition checks:
    • Ignore filter types not deriving from ActiveFilter.
    • Increase ActiveFilter.listedSubscriptionCount.
    • If filter is enabled and listedSubscriptionCount is 1, perform filter addition.
  • Filter addition:
    • Add filter to Matcher, ElemHide or ElemHideEmulation depending on type.
  • Filter removal checks:
    • Ignore filter types not deriving from ActiveFilter.
    • Decrease ActiveFilter.listedSubscriptionCount.
    • If filter is enabled and listedSubscriptionCount is 0, perform filter removal.
  • Filter removal:
    • Remove filter from Matcher, ElemHide or ElemHideEmulation depending on type.
  • Once the other changes are implemented, notifying JavaScript will become unnecessary most of the time. Expose FilterNotifier as a namespace with the methods _enableCallbacks and _disableCallbacks. The existing lib/filterNotifier.js should extend that namespace and call _enableCallbacks when a first callback is added for a topic and _disableCallbacks when the last callback is removed for a topic (CATCH_ALL being a "topic" as well). FilterNotifier should then only call into JavaScript if callbacks are enabled for the respective topic or CATCH_ALL.

Attachments (0)

Change History (3)

comment:1 Changed on 04/15/2017 at 08:25:56 AM by trev

  • Blocked By 5137, 5141, 5142, 5143 added

comment:2 Changed on 04/15/2017 at 08:27:25 AM by trev

  • Blocked By 5063 added

comment:3 Changed on 08/29/2019 at 05:43:52 PM by sebastian

  • Keywords closed-in-favor-of-gitlab added
  • Resolution set to rejected
  • Status changed from new to closed

Sorry, but we switched to GitLab. If this issue is still relevant, please file it again in the new issue tracker.

Add Comment

Modify Ticket

Change Properties
Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none).
 
Note: See TracTickets for help on using tickets.