Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Issue 29426559: Issue 5137 - [emscripten] Added basic filter storage implementation (Closed)

Created:
May 1, 2017, 2:36 p.m. by Wladimir Palant
Modified:
Aug. 31, 2017, 1:31 p.m.
Reviewers:
sergei, hub
CC:
Felix Dahlke
Base URL:
https://hg.adblockplus.org/adblockpluscore
Visibility:
Public.

Description

Issue 5137 - [emscripten] Added basic filter storage implementation

Patch Set 1 #

Total comments: 16

Patch Set 2 : Fixed some inconsistencies #

Total comments: 6

Patch Set 3 : Improved type names and added finally block #

Patch Set 4 : Rebased #

Patch Set 5 : Turned FilterStorage into a singleton class #

Total comments: 1

Patch Set 6 : Rebased, updated copyright year #

Total comments: 21

Patch Set 7 : Addressed comments and linting issues #

Patch Set 8 : Fixed bogus assert #

Unified diffs Side-by-side diffs Delta from patch set Stats (+764 lines, -784 lines) Patch
M compiled/FilterNotifier.h View 1 chunk +13 lines, -2 lines 0 comments Download
M compiled/bindings/generator.h View 1 2 3 4 2 chunks +51 lines, -4 lines 0 comments Download
M compiled/bindings/generator.cpp View 1 2 3 4 5 6 5 chunks +35 lines, -18 lines 0 comments Download
M compiled/bindings/main.cpp View 1 2 3 4 3 chunks +12 lines, -0 lines 0 comments Download
M compiled/library.h View 1 chunk +2 lines, -1 line 0 comments Download
M compiled/library.js View 1 chunk +4 lines, -2 lines 0 comments Download
A compiled/storage/FilterStorage.h View 1 2 3 4 5 6 1 chunk +48 lines, -0 lines 0 comments Download
A compiled/storage/FilterStorage.cpp View 1 2 3 4 5 6 7 1 chunk +145 lines, -0 lines 0 comments Download
M compiled/subscription/DownloadableSubscription.h View 1 2 1 chunk +9 lines, -0 lines 0 comments Download
M compiled/subscription/Subscription.h View 1 2 3 4 5 6 2 chunks +10 lines, -3 lines 0 comments Download
M compiled/subscription/Subscription.cpp View 1 2 3 4 5 6 1 chunk +2 lines, -2 lines 0 comments Download
M compiled/subscription/UserDefinedSubscription.h View 1 2 1 chunk +13 lines, -0 lines 0 comments Download
M compiled/subscription/UserDefinedSubscription.cpp View 2 chunks +19 lines, -6 lines 0 comments Download
M lib/filterStorage.js View 1 2 3 4 5 6 1 chunk +55 lines, -736 lines 0 comments Download
M lib/subscriptionClasses.js View 1 1 chunk +37 lines, -7 lines 0 comments Download
A test/filterStorage.js View 1 2 3 4 5 6 1 chunk +303 lines, -0 lines 0 comments Download
M test/subscriptionClasses.js View 1 1 chunk +6 lines, -3 lines 0 comments Download

Messages

Total messages: 12
Wladimir Palant
May 1, 2017, 2:36 p.m. (2017-05-01 14:36:54 UTC) #1
Wladimir Palant
Note that this doesn't implement everything required in https://issues.adblockplus.org/ticket/5137 - moving filters and managing hit ...
May 1, 2017, 2:47 p.m. (2017-05-01 14:47:25 UTC) #2
Wladimir Palant
Patch Set 2 removes the bogus ArrayLike imports. It also adjusts subscription classes unit tests ...
May 3, 2017, 8:27 a.m. (2017-05-03 08:27:47 UTC) #3
sergei
https://codereview.adblockplus.org/29426559/diff/29426560/compiled/bindings/generator.cpp File compiled/bindings/generator.cpp (right): https://codereview.adblockplus.org/29426559/diff/29426560/compiled/bindings/generator.cpp#newcode329 compiled/bindings/generator.cpp:329: } On 2017/05/01 14:47:25, Wladimir Palant wrote: > I'm ...
May 8, 2017, 10:54 a.m. (2017-05-08 10:54:39 UTC) #4
Wladimir Palant
Patch Set 3 has been rebased, so the interdiffs are slightly bogus. The only real ...
May 8, 2017, 12:55 p.m. (2017-05-08 12:55:42 UTC) #5
Wladimir Palant
Patch Set 4 has been rebased on top of bindings generator changes already in the ...
May 10, 2017, 12:38 p.m. (2017-05-10 12:38:22 UTC) #6
Wladimir Palant
In Patch Set 5 I've turned FilterStorage into a singleton class since this appears to ...
May 10, 2017, 2:11 p.m. (2017-05-10 14:11:05 UTC) #7
Wladimir Palant
Patch Set 6 has been rebased (copyright year update)
Aug. 22, 2017, 11:04 a.m. (2017-08-22 11:04:55 UTC) #8
hub
https://codereview.adblockplus.org/29426559/diff/29523629/compiled/storage/FilterStorage.h File compiled/storage/FilterStorage.h (right): https://codereview.adblockplus.org/29426559/diff/29523629/compiled/storage/FilterStorage.h#newcode34 compiled/storage/FilterStorage.h:34: unsigned int BINDINGS_EXPORTED GetSubscriptionCount() const; Line 30 you put ...
Aug. 22, 2017, 1:14 p.m. (2017-08-22 13:14:15 UTC) #9
sergei
My main concerns is only about changes lib/filterStorage.js, removing of the parsing code does not ...
Aug. 24, 2017, 1:32 p.m. (2017-08-24 13:32:07 UTC) #10
Wladimir Palant
https://codereview.adblockplus.org/29426559/diff/29426560/compiled/bindings/generator.cpp File compiled/bindings/generator.cpp (right): https://codereview.adblockplus.org/29426559/diff/29426560/compiled/bindings/generator.cpp#newcode424 compiled/bindings/generator.cpp:424: params.push_back(argName + " ? " + argName + "._pointer ...
Aug. 31, 2017, 11:32 a.m. (2017-08-31 11:32:37 UTC) #11
sergei
Aug. 31, 2017, 12:43 p.m. (2017-08-31 12:43:40 UTC) #12
LGTM

https://codereview.adblockplus.org/29426559/diff/29523629/compiled/storage/Fi...
File compiled/storage/FilterStorage.cpp (right):

https://codereview.adblockplus.org/29426559/diff/29523629/compiled/storage/Fi...
compiled/storage/FilterStorage.cpp:49: Subscription*
FilterStorage::GetSubscriptionForFilter(const Filter* filter)
On 2017/08/31 11:32:36, Wladimir Palant wrote:
> On 2017/08/24 13:32:05, sergei wrote:
> > It seems that this method should be const.
> 
> Managed to do this with somewhat counterintuitive changes.

Yeah, sorry, maybe it was a bad idea to turn it into a const method,
`SubscriptionAt` should not be const either because it allows to modify
internals of constant FilterStorage.

https://codereview.adblockplus.org/29426559/diff/29523629/compiled/storage/Fi...
compiled/storage/FilterStorage.cpp:90: bool
FilterStorage::RemoveSubscription(Subscription* subscription)
On 2017/08/31 11:32:35, Wladimir Palant wrote:
> On 2017/08/24 13:32:06, sergei wrote:
> > It seems so far there is no way to make the argument a constant pointer here
> and
> > in the adding method above.
> 
> For AddSubscription() the argument shouldn't be constant - we store a
non-const
> pointer, and callers of SubscriptionAt() might modify the instance later. Here
> the issue is smaller, but we are still calling SetListed(), changing reference
> counter and notifying listeners with a non-const instance.

Acknowledged.

https://codereview.adblockplus.org/29426559/diff/29523629/compiled/storage/Fi...
compiled/storage/FilterStorage.cpp:114: bool
FilterStorage::MoveSubscription(Subscription* subscription,
On 2017/08/31 11:32:35, Wladimir Palant wrote:
> On 2017/08/24 13:32:05, sergei wrote:
> > should `subscription` argument be a const pointer?
> 
> It cannot be. Even if we make changes to the reference count possible on const
> instances or manage to move the instance without touching the reference count,
> the FilterNotifier call below requires a non-const instance. JavaScript
> listeners might decide to modify the subscription.

Acknowledged.

Powered by Google App Engine
This is Rietveld