-
Notifications
You must be signed in to change notification settings - Fork 869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix adblock default ruleset reparsing on startup #20585
Conversation
@@ -286,13 +307,30 @@ void AdBlockEngine::OnListSourceLoaded(const DATFileDataBuffer& filters, | |||
|
|||
void AdBlockEngine::OnDATLoaded(const DATFileDataBuffer& dat_buf, | |||
const std::string& resources_json) { | |||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That will prevent us from ocasionally calling deserializing from UI thread.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the OnDATLoaded
method was actually removed in @antonok-edm's PR. I don't think we load dat files anymore
// Currently, the extra engine depends on the default, so we expect an extra | ||
// unnecessary update. | ||
// TODO(matuchin): remove that dependency and change 3 => 2. | ||
histogram_tester_.ExpectTotalCount( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To clarify the expectations in format: {default engine updates, additional engine updates} in the begin of the test => the same of the end of the test
- (before the PR) {1, 1} => {3, 3}
- (after the PR) {1, 1} => {2, 2}
- (what we actually want in a long term perspective) {0, 0} => {1, 1}
UPD: changed the comment to match the latest changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks ok, but I'd wait on @antonok-edm to merge
Verification PASSED on
Basically ensured that adblocking as working when running through #20137 (comment). QA will also run through some spot checks when we run through manual passes via |
Resolves brave/brave-browser#33718
Resolves brave/brave-browser#33532
The root of the issue is
AdBlockFiltersProviderManager
singleton. It subscribes to all the providers (inAdBlockFiltersProviderManager::AddProvider
) => it gets notifications about an update in every provider.Also,
AdBlockFiltersProviderManager
implements bothAdBlockFiltersProvider
andAdBlockFiltersProvider::Observer
interfaces, acting like a decorator and proxying all theOnChanged
to the listeners. The listeners are instances ofSourceProviderObserver
for the both engines (the manager is passed asAdBlockFiltersProvider*
hereAs a result, both engine observers get notifications about all the updates and rebuild the combined list of every update.
The PR fixes it in safe and straightforward way: adding to
Observer::OnChange()
extra information about what kind of source was updated. This allows us to filter out unnecessary notifications.The PR:
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
wikinpm run lint
,npm run presubmit
wiki,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan: