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

Side by Side Diff: compiled/storage/FilterStorage.cpp

Issue 29606600: Issue 5146 - Implement DownloadableSubscription parsing in C++ (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Removed Md5sum and associated code Created Aug. 14, 2018, 12:38 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/storage/FilterStorage.h ('k') | compiled/subscription/DownloadableSubscription.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-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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 } 103 }
104 subscription.SetListed(false); 104 subscription.SetListed(false);
105 105
106 FilterNotifier::SubscriptionChange( 106 FilterNotifier::SubscriptionChange(
107 FilterNotifier::Topic::SUBSCRIPTION_REMOVED, 107 FilterNotifier::Topic::SUBSCRIPTION_REMOVED,
108 subscription 108 subscription
109 ); 109 );
110 return true; 110 return true;
111 } 111 }
112 112
113 void FilterStorage::ClearSubscriptionFilters(Subscription& subscription)
114 {
115 subscription.ClearFilters();
116
117 FilterNotifier::SubscriptionChange(
118 FilterNotifier::Topic::SUBSCRIPTION_FILTERS_REPLACED,
119 subscription
120 );
121 }
122
113 bool FilterStorage::MoveSubscription(Subscription& subscription, 123 bool FilterStorage::MoveSubscription(Subscription& subscription,
114 const Subscription* insertBefore) 124 const Subscription* insertBefore)
115 { 125 {
116 int oldPos = IndexOfSubscription(subscription); 126 int oldPos = IndexOfSubscription(subscription);
117 assert2(oldPos >= 0, ABP_TEXT("Attempt to move a subscription that is not in t he list"_str)); 127 assert2(oldPos >= 0, ABP_TEXT("Attempt to move a subscription that is not in t he list"_str));
118 if (oldPos == -1) 128 if (oldPos == -1)
119 return false; 129 return false;
120 130
121 int newPos = -1; 131 int newPos = -1;
122 if (insertBefore) 132 if (insertBefore)
123 newPos = IndexOfSubscription(*insertBefore); 133 newPos = IndexOfSubscription(*insertBefore);
124 if (newPos == -1) 134 if (newPos == -1)
125 newPos = mSubscriptions.size(); 135 newPos = mSubscriptions.size();
126 136
127 if (newPos > oldPos) 137 if (newPos > oldPos)
128 newPos--; 138 newPos--;
129 139
130 if (newPos == oldPos) 140 if (newPos == oldPos)
131 return false; 141 return false;
132 142
133 mSubscriptions.erase(mSubscriptions.begin() + oldPos); 143 mSubscriptions.erase(mSubscriptions.begin() + oldPos);
134 mSubscriptions.emplace(mSubscriptions.begin() + newPos, &subscription); 144 mSubscriptions.emplace(mSubscriptions.begin() + newPos, &subscription);
135 145
136 FilterNotifier::SubscriptionChange( 146 FilterNotifier::SubscriptionChange(
137 FilterNotifier::Topic::SUBSCRIPTION_MOVED, 147 FilterNotifier::Topic::SUBSCRIPTION_MOVED,
138 subscription 148 subscription
139 ); 149 );
140 return true; 150 return true;
141 } 151 }
OLDNEW
« no previous file with comments | « compiled/storage/FilterStorage.h ('k') | compiled/subscription/DownloadableSubscription.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld