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

Side by Side Diff: Shared/PluginFilter.cpp

Issue 10540013: Proof of concept: Use a single FilterEngine instance (Closed)
Patch Set: Created May 3, 2013, 3:58 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 | « Shared/AdblockPlusClient.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 2
3 #include "PluginFilter.h" 3 #include "PluginFilter.h"
4 4
5 #if (defined PRODUCT_ADBLOCKPLUS) 5 #if (defined PRODUCT_ADBLOCKPLUS)
6 #include "PluginSettings.h" 6 #include "PluginSettings.h"
7 #include "PluginClient.h" 7 #include "PluginClient.h"
8 #include "PluginClientFactory.h" 8 #include "PluginClientFactory.h"
9 #endif 9 #endif
10 10
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 type = "???"; 796 type = "???";
797 797
798 std::map<int,CString>::const_iterator it = m_contentMapText.find(contentType ); 798 std::map<int,CString>::const_iterator it = m_contentMapText.find(contentType );
799 if (it != m_contentMapText.end()) 799 if (it != m_contentMapText.end())
800 { 800 {
801 type = it->second; 801 type = it->second;
802 } 802 }
803 } 803 }
804 804
805 CPluginClient* client = CPluginClient::GetInstance(); 805 CPluginClient* client = CPluginClient::GetInstance();
806 AdblockPlus::FilterEngine* filterEngine = client->GetFilterEngine();
807 806
808 //TODO: Make sure if the content type names are in sync with libadblockplus 807 //TODO: Make sure if the content type names are in sync with libadblockplus
809 std::string contentTypeString = CT2A(type, CP_UTF8); 808 std::string contentTypeString = CT2A(type, CP_UTF8);
810 809
811 CT2CA srcMb(src, CP_UTF8); 810 CT2CA srcMb(src, CP_UTF8);
812 std::string url(srcMb); 811 std::string url(srcMb);
813 812
814 std::string domainMb = CT2CA(domain); 813 std::string domainMb = CT2CA(domain);
815 814
816 if (filterEngine->Matches(url, contentTypeString, domainMb)) 815 if (client->Matches(url, contentTypeString, domainMb))
817 { 816 {
818 if (addDebug) 817 if (addDebug)
819 { 818 {
820 DEBUG_FILTER("Filter::ShouldBlock " + type + " YES") 819 DEBUG_FILTER("Filter::ShouldBlock " + type + " YES")
821 820
822 #ifdef ENABLE_DEBUG_RESULT 821 #ifdef ENABLE_DEBUG_RESULT
823 CPluginDebug::DebugResultBlocking(type, src); 822 CPluginDebug::DebugResultBlocking(type, src);
824 #endif 823 #endif
825 } 824 }
826 return true; 825 return true;
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 if (pos > 0 && domain.GetLength() + pos == subdomain.GetLength()) 971 if (pos > 0 && domain.GetLength() + pos == subdomain.GetLength())
973 { 972 {
974 if (subdomain.GetAt(pos - 1) == '.') 973 if (subdomain.GetAt(pos - 1) == '.')
975 { 974 {
976 return true; 975 return true;
977 } 976 }
978 } 977 }
979 978
980 return false; 979 return false;
981 } 980 }
OLDNEW
« no previous file with comments | « Shared/AdblockPlusClient.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld