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

Issue 29334397: Issue #2230, #3391 - Load filters on "download begin" event

Created:
Jan. 22, 2016, 6:02 p.m. by Eric
Modified:
Feb. 4, 2016, 5:38 p.m.
Reviewers:
sergei, Oleksandr
CC:
Felix Dahlke
Visibility:
Public.

Description

Issue #2230, #3391 - Load filters on "download begin" event Add event handler for "download begin" event in 'CPluginClass', which acts as a facade for a parallel handler in 'CPluginTab'. Move the loading of filters from the "before navigate" event to the "download begin" event. "Download begin" is called for both ordinary page load as well as for refresh, while "before navigate" is called only on ordinary page load. This fixes #2230, because the root of that issue is that filters were not (re)loaded on refresh. Change the life cycle of 'CPluginFilter', whose initialization was the opposite of encapsulated. (For example, see the now-removed member variable 'hideFiltersLoadedEvent', which was manipulated only outside of 'CPluginFilter'.) Derive 'CPluginTab' from 'DetachedInitializer', allowing all threading and initialization to the be responsibility of 'CPluginFilter'. Perform the loading of filters in the thread spawned at construction. Add a "domain" argument to the constructor, since it was the only ultimate data dependency. Change the filter member of 'CPluginTab' to a 'unique_ptr' that's non-null only for its duration of use. Refactored 'DetachedInitializer' to work for both static and member initializations. Renamed existing class to 'DetachedInitializerStaticFunction', as it's a special case of the now-more-general version. -------- This review depends on others: Issue #2230 - Refactor filter life cycle and use https://codereview.adblockplus.org/29334386/ Issue #3391 - Add detached initialization class https://codereview.adblockplus.org/29332660/

Patch Set 1 #

Total comments: 28

Patch Set 2 : address comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+111 lines, -87 lines) Patch
M src/plugin/DetachedInitialization.h View 5 chunks +42 lines, -21 lines 0 comments Download
M src/plugin/PluginClass.h View 1 3 chunks +2 lines, -2 lines 0 comments Download
M src/plugin/PluginClass.cpp View 1 chunk +13 lines, -0 lines 0 comments Download
M src/plugin/PluginDomTraverserBase.h View 1 chunk +0 lines, -1 line 0 comments Download
M src/plugin/PluginFilter.h View 1 3 chunks +15 lines, -5 lines 0 comments Download
M src/plugin/PluginFilter.cpp View 3 chunks +2 lines, -17 lines 0 comments Download
M src/plugin/PluginTabBase.h View 2 chunks +2 lines, -1 line 0 comments Download
M src/plugin/PluginTabBase.cpp View 3 chunks +22 lines, -27 lines 0 comments Download
M test/plugin/DetachedInitializationTest.cpp View 6 chunks +13 lines, -13 lines 0 comments Download

Messages

Total messages: 8
Eric
This is the second of two change sets fixing #2230. This one depends in an ...
Jan. 22, 2016, 6:17 p.m. (2016-01-22 18:17:10 UTC) #1
sergei
1. Here are some comments regarding detached initialization class (they are part of https://codereview.adblockplus.org/29332660). 2. ...
Jan. 29, 2016, 10:03 a.m. (2016-01-29 10:03:21 UTC) #2
Eric
On 2016/01/29 10:03:21, sergei wrote: > 1. Here are some comments regarding detached initialization class ...
Jan. 29, 2016, 2:17 p.m. (2016-01-29 14:17:36 UTC) #3
Oleksandr
On 2016/01/29 14:17:36, Eric wrote: > I have tested the present code. Specifically, I've verified ...
Feb. 1, 2016, 2:12 a.m. (2016-02-01 02:12:28 UTC) #4
Eric
On 2016/02/01 02:12:28, Oleksandr wrote: > The decision to put the filter loading code into ...
Feb. 3, 2016, 6:03 p.m. (2016-02-03 18:03:19 UTC) #5
Eric
Patch set 2 addresses Sergei's comments.
Feb. 3, 2016, 6:05 p.m. (2016-02-03 18:05:16 UTC) #6
Oleksandr
On 2016/02/03 18:03:19, Eric wrote: > Would it be sufficient to call 'IsRootBrowser()' in > ...
Feb. 4, 2016, 4:40 a.m. (2016-02-04 04:40:52 UTC) #7
Eric
Feb. 4, 2016, 5:38 p.m. (2016-02-04 17:38:57 UTC) #8
On 2016/02/03 18:03:19, Eric wrote:
> Would it be sufficient to call 'IsRootBrowser()' in
> the handler for the download-begin event?

On 2016/02/04 04:40:52, Oleksandr wrote:
> It would have been, but I don't think we have a way to get the actual
> IWebBrowser2 pointer in OnDownloadBegin, only in OnBeforeNavigate.

I looked into this, and you're right. The download-begin event has no
parameters. Furthermore, I didn't find any tricks to derive a document pointer
from data that's current during the event handler.

I've looked into reload detection, and whatever mechanism we want to use, it
would be too large to put into the present review. Most of the code here remains
part of a solution to #2230, since reducing the problem to managing a single
pointer is a great improvement to the present code. I'll alter the present
change set to retain the current point where filters are loaded, but using the
new encapsulation of filter initialization present here. It won't fix #2230, but
it moves us toward there.

Powered by Google App Engine
This is Rietveld