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

Delta Between Two Patch Sets: compiled/filter/Filter.cpp

Issue 29613616: Issue 6064 - Put C++ code into a configurable namespace (Closed) Base URL: https://github.com/adblockplus/adblockpluscore.git
Left Patch Set: Fix debug.h to be aligned with assert2 (define vs function) and get rid of a warning in generator.cpp Created Nov. 21, 2017, 2:53 p.m.
Right Patch Set: rebase Created Feb. 6, 2018, 9:54 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
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-present eyeo GmbH 3 * Copyright (C) 2006-present 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 auto knownFilter = knownFilters.find(text); 117 auto knownFilter = knownFilters.find(text);
118 if (knownFilter) 118 if (knownFilter)
119 { 119 {
120 knownFilter->second->AddRef(); 120 knownFilter->second->AddRef();
121 return knownFilter->second; 121 return knownFilter->second;
122 } 122 }
123 123
124 FilterPtr filter; 124 FilterPtr filter;
125 switch (type) 125 switch (type)
126 { 126 {
127 case Filter::Type::COMMENT: 127 case CommentFilter::classType:
128 filter = FilterPtr(new CommentFilter(text), false); 128 filter = FilterPtr(new CommentFilter(text), false);
129 break; 129 break;
130 case Filter::Type::INVALID: 130 case InvalidFilter::classType:
131 filter = FilterPtr(new InvalidFilter(text, error), false); 131 filter = FilterPtr(new InvalidFilter(text, error), false);
132 break; 132 break;
133 case Filter::Type::BLOCKING: 133 case BlockingFilter::classType:
134 filter = FilterPtr(new BlockingFilter(text, data.regexp), false); 134 filter = FilterPtr(new BlockingFilter(text, data.regexp), false);
135 break; 135 break;
136 case Filter::Type::WHITELIST: 136 case WhitelistFilter::classType:
137 filter = FilterPtr(new WhitelistFilter(text, data.regexp), false); 137 filter = FilterPtr(new WhitelistFilter(text, data.regexp), false);
138 break; 138 break;
139 case Filter::Type::ELEMHIDE: 139 case ElemHideFilter::classType:
140 filter = FilterPtr(new ElemHideFilter(text, data.elemhide), false); 140 filter = FilterPtr(new ElemHideFilter(text, data.elemhide), false);
141 break; 141 break;
142 case Filter::Type::ELEMHIDEEXCEPTION: 142 case ElemHideException::classType:
143 filter = FilterPtr(new ElemHideException(text, data.elemhide), false); 143 filter = FilterPtr(new ElemHideException(text, data.elemhide), false);
144 break; 144 break;
145 case Filter::Type::ELEMHIDEEMULATION: 145 case ElemHideEmulationFilter::classType:
146 filter = FilterPtr(new ElemHideEmulationFilter(text, data.elemhide), false ); 146 filter = FilterPtr(new ElemHideEmulationFilter(text, data.elemhide), false );
147 if (static_cast<ElemHideEmulationFilter*>(filter.get())->IsGeneric()) 147 if (static_cast<ElemHideEmulationFilter*>(filter.get())->IsGeneric())
148 filter = FilterPtr(new InvalidFilter(text, u"filter_elemhideemulation_no domain"_str), false); 148 filter = FilterPtr(new InvalidFilter(text, u"filter_elemhideemulation_no domain"_str), false);
149 break; 149 break;
150 default: 150 default:
151 // This should never happen but just in case 151 // This should never happen but just in case
152 return nullptr; 152 return nullptr;
153 } 153 }
154 154
155 // This is a hack: we looked up the entry using text but create it using 155 // This is a hack: we looked up the entry using text but create it using
156 // filter->mText. This works because both are equal at this point. However, 156 // filter->mText. This works because both are equal at this point. However,
157 // text refers to a temporary buffer which will go away. 157 // text refers to a temporary buffer which will go away.
158 enter_context("Adding to known filters"); 158 enter_context("Adding to known filters");
159 knownFilter.assign(filter->mText, filter.get()); 159 knownFilter.assign(filter->mText, filter.get());
160 exit_context(); 160 exit_context();
161 161
162 return filter.release(); 162 return filter.release();
163 } 163 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld