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

Side by Side Diff: compiled/filter/Filter.cpp

Issue 29385742: Issue 4127 - [emscripten] Convert subscription classes to C++ - Part 2 (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Patch Set: Rebased Created April 13, 2017, 1:01 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 | « compiled/filter/Filter.h ('k') | compiled/intrusive_ptr.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-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 if (knownFilter) 116 if (knownFilter)
117 { 117 {
118 knownFilter->second->AddRef(); 118 knownFilter->second->AddRef();
119 return knownFilter->second; 119 return knownFilter->second;
120 } 120 }
121 121
122 FilterPtr filter; 122 FilterPtr filter;
123 switch (type) 123 switch (type)
124 { 124 {
125 case Filter::Type::COMMENT: 125 case Filter::Type::COMMENT:
126 filter = new CommentFilter(text); 126 filter = FilterPtr(new CommentFilter(text), false);
127 break; 127 break;
128 case Filter::Type::INVALID: 128 case Filter::Type::INVALID:
129 filter = new InvalidFilter(text, error); 129 filter = FilterPtr(new InvalidFilter(text, error), false);
130 break; 130 break;
131 case Filter::Type::BLOCKING: 131 case Filter::Type::BLOCKING:
132 filter = new BlockingFilter(text, data.regexp); 132 filter = FilterPtr(new BlockingFilter(text, data.regexp), false);
133 break; 133 break;
134 case Filter::Type::WHITELIST: 134 case Filter::Type::WHITELIST:
135 filter = new WhitelistFilter(text, data.regexp); 135 filter = FilterPtr(new WhitelistFilter(text, data.regexp), false);
136 break; 136 break;
137 case Filter::Type::ELEMHIDE: 137 case Filter::Type::ELEMHIDE:
138 filter = new ElemHideFilter(text, data.elemhide); 138 filter = FilterPtr(new ElemHideFilter(text, data.elemhide), false);
139 break; 139 break;
140 case Filter::Type::ELEMHIDEEXCEPTION: 140 case Filter::Type::ELEMHIDEEXCEPTION:
141 filter = new ElemHideException(text, data.elemhide); 141 filter = FilterPtr(new ElemHideException(text, data.elemhide), false);
142 break; 142 break;
143 case Filter::Type::ELEMHIDEEMULATION: 143 case Filter::Type::ELEMHIDEEMULATION:
144 filter = new ElemHideEmulationFilter(text, data.elemhide); 144 filter = FilterPtr(new ElemHideEmulationFilter(text, data.elemhide), false );
145 if (static_cast<ElemHideEmulationFilter*>(filter.get())->IsGeneric()) 145 if (static_cast<ElemHideEmulationFilter*>(filter.get())->IsGeneric())
146 filter = new InvalidFilter(text, u"filter_elemhideemulation_nodomain"_st r); 146 filter = FilterPtr(new InvalidFilter(text, u"filter_elemhideemulation_no domain"_str), false);
147 break; 147 break;
148 default: 148 default:
149 // This should never happen but just in case 149 // This should never happen but just in case
150 return nullptr; 150 return nullptr;
151 } 151 }
152 152
153 // This is a hack: we looked up the entry using text but create it using 153 // This is a hack: we looked up the entry using text but create it using
154 // filter->mText. This works because both are equal at this point. However, 154 // filter->mText. This works because both are equal at this point. However,
155 // text refers to a temporary buffer which will go away. 155 // text refers to a temporary buffer which will go away.
156 enter_context("Adding to known filters"); 156 enter_context("Adding to known filters");
157 knownFilter.assign(filter->mText, filter.get()); 157 knownFilter.assign(filter->mText, filter.get());
158 exit_context(); 158 exit_context();
159 159
160 return filter.release(); 160 return filter.release();
161 } 161 }
OLDNEW
« no previous file with comments | « compiled/filter/Filter.h ('k') | compiled/intrusive_ptr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld