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

Unified Diff: src/FilterEngine.cpp

Issue 29419623: Issue 5165 - Remove SubscriptionPtr (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Added move constructor. Created April 24, 2017, 1:45 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/FilterEngine.cpp
===================================================================
--- a/src/FilterEngine.cpp
+++ b/src/FilterEngine.cpp
@@ -277,49 +277,49 @@
}
Filter FilterEngine::GetFilter(const std::string& text) const
{
JsValue func = jsEngine->Evaluate("API.getFilterFromText");
return Filter(func.Call(jsEngine->NewValue(text)));
}
-SubscriptionPtr FilterEngine::GetSubscription(const std::string& url) const
+Subscription FilterEngine::GetSubscription(const std::string& url) const
{
JsValue func = jsEngine->Evaluate("API.getSubscriptionFromUrl");
- return SubscriptionPtr(new Subscription(func.Call(jsEngine->NewValue(url))));
+ return Subscription(func.Call(jsEngine->NewValue(url)));
}
std::vector<Filter> FilterEngine::GetListedFilters() const
{
JsValue func = jsEngine->Evaluate("API.getListedFilters");
JsValueList values = func.Call().AsList();
std::vector<Filter> result;
for (JsValueList::iterator it = values.begin(); it != values.end(); it++)
result.push_back(Filter(std::move(*it)));
return result;
}
-std::vector<SubscriptionPtr> FilterEngine::GetListedSubscriptions() const
+std::vector<Subscription> FilterEngine::GetListedSubscriptions() const
{
JsValue func = jsEngine->Evaluate("API.getListedSubscriptions");
JsValueList values = func.Call().AsList();
- std::vector<SubscriptionPtr> result;
+ std::vector<Subscription> result;
for (JsValueList::iterator it = values.begin(); it != values.end(); it++)
- result.push_back(SubscriptionPtr(new Subscription(std::move(*it))));
+ result.push_back(Subscription(std::move(*it)));
return result;
}
-std::vector<SubscriptionPtr> FilterEngine::FetchAvailableSubscriptions() const
+std::vector<Subscription> FilterEngine::FetchAvailableSubscriptions() const
{
JsValue func = jsEngine->Evaluate("API.getRecommendedSubscriptions");
JsValueList values = func.Call().AsList();
- std::vector<SubscriptionPtr> result;
+ std::vector<Subscription> result;
for (JsValueList::iterator it = values.begin(); it != values.end(); it++)
- result.push_back(SubscriptionPtr(new Subscription(std::move(*it))));
+ result.push_back(Subscription(std::move(*it)));
return result;
}
void FilterEngine::SetAAEnabled(bool enabled)
{
jsEngine->Evaluate("API.setAASubscriptionEnabled").Call(jsEngine->NewValue(enabled));
}

Powered by Google App Engine
This is Rietveld