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

Unified Diff: src/FilterEngine.cpp

Issue 5598762307158016: Issue 1550 - Get rid of V8ValueHolder.h (Closed)
Patch Set: update Created June 11, 2015, 1:02 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
« no previous file with comments | « include/AdblockPlus/V8ValueHolder.h ('k') | src/JsContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/FilterEngine.cpp
diff --git a/src/FilterEngine.cpp b/src/FilterEngine.cpp
index 96c4571fbf593f47041bd3415fc44d73f55da7f1..d9d3f4398aef04cc68733e08f7c9384b2ba57c0d 100644
--- a/src/FilterEngine.cpp
+++ b/src/FilterEngine.cpp
@@ -28,8 +28,8 @@ using namespace AdblockPlus;
extern std::string jsSources[];
-Filter::Filter(JsValuePtr value)
- : JsValue(value)
+Filter::Filter(JsValue&& value)
+ : JsValue(std::move(value))
{
if (!IsObject())
throw std::runtime_error("JavaScript value is not an object");
@@ -81,8 +81,8 @@ bool Filter::operator==(const Filter& filter) const
return GetProperty("text")->AsString() == filter.GetProperty("text")->AsString();
}
-Subscription::Subscription(JsValuePtr value)
- : JsValue(value)
+Subscription::Subscription(JsValue&& value)
+ : JsValue(std::move(value))
{
if (!IsObject())
throw std::runtime_error("JavaScript value is not an object");
@@ -216,7 +216,7 @@ FilterPtr FilterEngine::GetFilter(const std::string& text)
JsValuePtr func = jsEngine->Evaluate("API.getFilterFromText");
JsValueList params;
params.push_back(jsEngine->NewValue(text));
- return FilterPtr(new Filter(func->Call(params)));
+ return FilterPtr(new Filter(std::move(*func->Call(params))));
}
SubscriptionPtr FilterEngine::GetSubscription(const std::string& url)
@@ -224,7 +224,7 @@ SubscriptionPtr FilterEngine::GetSubscription(const std::string& url)
JsValuePtr func = jsEngine->Evaluate("API.getSubscriptionFromUrl");
JsValueList params;
params.push_back(jsEngine->NewValue(url));
- return SubscriptionPtr(new Subscription(func->Call(params)));
+ return SubscriptionPtr(new Subscription(std::move(*func->Call(params))));
}
std::vector<FilterPtr> FilterEngine::GetListedFilters() const
@@ -233,7 +233,7 @@ std::vector<FilterPtr> FilterEngine::GetListedFilters() const
JsValueList values = func->Call()->AsList();
std::vector<FilterPtr> result;
for (JsValueList::iterator it = values.begin(); it != values.end(); it++)
- result.push_back(FilterPtr(new Filter(*it)));
+ result.push_back(FilterPtr(new Filter(std::move(**it))));
return result;
}
@@ -243,7 +243,7 @@ std::vector<SubscriptionPtr> FilterEngine::GetListedSubscriptions() const
JsValueList values = func->Call()->AsList();
std::vector<SubscriptionPtr> result;
for (JsValueList::iterator it = values.begin(); it != values.end(); it++)
- result.push_back(SubscriptionPtr(new Subscription(*it)));
+ result.push_back(SubscriptionPtr(new Subscription(std::move(**it))));
return result;
}
@@ -253,7 +253,7 @@ std::vector<SubscriptionPtr> FilterEngine::FetchAvailableSubscriptions() const
JsValueList values = func->Call()->AsList();
std::vector<SubscriptionPtr> result;
for (JsValueList::iterator it = values.begin(); it != values.end(); it++)
- result.push_back(SubscriptionPtr(new Subscription(*it)));
+ result.push_back(SubscriptionPtr(new Subscription(std::move(**it))));
return result;
}
@@ -265,7 +265,7 @@ NotificationPtr FilterEngine::GetNextNotificationToShow(const std::string& url)
{
params.push_back(jsEngine->NewValue(url));
}
- return Notification::JsValueToNotification(func->Call(params));
+ return Notification::JsValueToNotification(std::move(*func->Call(params)));
}
AdblockPlus::FilterPtr FilterEngine::Matches(const std::string& url,
@@ -310,7 +310,7 @@ AdblockPlus::FilterPtr FilterEngine::CheckFilterMatch(const std::string& url,
params.push_back(jsEngine->NewValue(documentUrl));
JsValuePtr result = func->Call(params);
if (!result->IsNull())
- return FilterPtr(new Filter(result));
+ return FilterPtr(new Filter(std::move(*result)));
else
return FilterPtr();
}
« no previous file with comments | « include/AdblockPlus/V8ValueHolder.h ('k') | src/JsContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld