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

Side by Side Diff: src/plugin/AdblockPlusClient.cpp

Issue 29334386: Issue #2230 - Refactor filter life cycle and use
Patch Set: Created Jan. 22, 2016, 5:57 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/plugin/AdblockPlusClient.h ('k') | src/plugin/AdblockPlusDomTraverser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 m_criticalSectionCache.Lock(); 237 m_criticalSectionCache.Lock();
238 { 238 {
239 m_cacheBlockedSources[src] = isBlocked; 239 m_cacheBlockedSources[src] = isBlocked;
240 } 240 }
241 m_criticalSectionCache.Unlock(); 241 m_criticalSectionCache.Unlock();
242 } 242 }
243 } 243 }
244 return isBlocked; 244 return isBlocked;
245 } 245 }
246 246
247 bool CAdblockPlusClient::IsElementHidden(const std::wstring& tag, IHTMLElement* pEl, const std::wstring& domain, const std::wstring& indent, CPluginFilter* filt er)
248 {
249 bool isHidden;
250 m_criticalSectionFilter.Lock();
251 {
252 isHidden = filter && filter->IsElementHidden(tag, pEl, domain, indent);
253 }
254 m_criticalSectionFilter.Unlock();
255 return isHidden;
256 }
257
258 bool CAdblockPlusClient::IsWhitelistedUrl(const std::wstring& url, const std::ve ctor<std::string>& frameHierarchy) 247 bool CAdblockPlusClient::IsWhitelistedUrl(const std::wstring& url, const std::ve ctor<std::string>& frameHierarchy)
259 { 248 {
260 return !GetWhitelistingFilter(url, frameHierarchy).empty(); 249 return !GetWhitelistingFilter(url, frameHierarchy).empty();
261 } 250 }
262 251
263 std::string CAdblockPlusClient::GetWhitelistingFilter(const std::wstring& url, c onst std::vector<std::string>& frameHierarchy) 252 std::string CAdblockPlusClient::GetWhitelistingFilter(const std::wstring& url, c onst std::vector<std::string>& frameHierarchy)
264 { 253 {
265 DEBUG_GENERAL((L"IsWhitelistedUrl: " + url + L" start").c_str()); 254 DEBUG_GENERAL((L"IsWhitelistedUrl: " + url + L" start").c_str());
266 Communication::OutputBuffer request; 255 Communication::OutputBuffer request;
267 request << Communication::PROC_GET_WHITELISTING_FITER << ToUtf8String(url) << frameHierarchy; 256 request << Communication::PROC_GET_WHITELISTING_FITER << ToUtf8String(url) << frameHierarchy;
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 DEBUG_GENERAL("CompareVersions"); 553 DEBUG_GENERAL("CompareVersions");
565 Communication::OutputBuffer request; 554 Communication::OutputBuffer request;
566 request << Communication::PROC_COMPARE_VERSIONS << ToUtf8String(v1) << ToUtf8S tring(v2); 555 request << Communication::PROC_COMPARE_VERSIONS << ToUtf8String(v1) << ToUtf8S tring(v2);
567 Communication::InputBuffer response; 556 Communication::InputBuffer response;
568 if (!CallEngine(request, response)) 557 if (!CallEngine(request, response))
569 return 0; 558 return 0;
570 int result; 559 int result;
571 response >> result; 560 response >> result;
572 return result; 561 return result;
573 } 562 }
OLDNEW
« no previous file with comments | « src/plugin/AdblockPlusClient.h ('k') | src/plugin/AdblockPlusDomTraverser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld