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

Unified Diff: include/AdblockPlus/FilterEngine.h

Issue 29409580: Issue 5013 - Make parameter const ref when applicable. (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Created April 11, 2017, 1:58 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: include/AdblockPlus/FilterEngine.h
===================================================================
--- a/include/AdblockPlus/FilterEngine.h
+++ b/include/AdblockPlus/FilterEngine.h
@@ -201,17 +201,17 @@
/**
* Callback type invoked when the filters change.
* The first parameter is the action event code (see
* [FilterNotifier.triggerListeners](https://adblockplus.org/jsdoc/adblockpluscore/FilterNotifier.html#.triggerListeners)
* for the full list).
* The second parameter is the filter/subscription object affected, if any.
*/
- typedef std::function<void(const std::string&, const JsValuePtr)> FilterChangeCallback;
+ typedef std::function<void(const std::string&, const JsValuePtr&)> FilterChangeCallback;
/**
* Container of name-value pairs representing a set of preferences.
*/
typedef std::map<std::string, AdblockPlus::JsValuePtr> Prefs;
/**
* Callback type invoked when a new notification should be shown.
@@ -430,30 +430,30 @@
*/
JsValuePtr GetPref(const std::string& pref) const;
/**
* Sets a preference value.
* @param pref Preference name.
* @param value New value of the preference.
*/
- void SetPref(const std::string& pref, JsValuePtr value);
+ void SetPref(const std::string& pref, const JsValuePtr& value);
/**
* Extracts the host from a URL.
* @param url URL to extract the host from.
* @return Extracted host.
*/
std::string GetHostFromURL(const std::string& url) const;
/**
* Sets the callback invoked when an application update becomes available.
* @param callback Callback to invoke.
*/
- void SetUpdateAvailableCallback(UpdateAvailableCallback callback);
+ void SetUpdateAvailableCallback(const UpdateAvailableCallback& callback);
/**
* Removes the callback invoked when an application update becomes
* available.
*/
void RemoveUpdateAvailableCallback();
/**
@@ -469,17 +469,17 @@
* `FilterEngine::SetUpdateAvailableCallback()`.
*/
void ForceUpdateCheck(const UpdateCheckDoneCallback& callback = UpdateCheckDoneCallback());
/**
* Sets the callback invoked when the filters change.
* @param callback Callback to invoke.
*/
- void SetFilterChangeCallback(FilterChangeCallback callback);
+ void SetFilterChangeCallback(const FilterChangeCallback& callback);
/**
* Removes the callback invoked when the filters change.
*/
void RemoveFilterChangeCallback();
/**
* Stores the value indicating what connection types are allowed, it is
@@ -529,20 +529,20 @@
int updateCheckId;
static const std::map<ContentType, std::string> contentTypes;
explicit FilterEngine(const JsEnginePtr& jsEngine);
FilterPtr CheckFilterMatch(const std::string& url,
ContentTypeMask contentTypeMask,
const std::string& documentUrl) const;
- void UpdateAvailable(UpdateAvailableCallback callback, JsValueList& params) const;
+ void UpdateAvailable(const UpdateAvailableCallback& callback, const JsValueList& params) const;
void UpdateCheckDone(const std::string& eventName,
- UpdateCheckDoneCallback callback, JsValueList& params);
- void FilterChanged(FilterChangeCallback callback, JsValueList& params) const;
+ const UpdateCheckDoneCallback& callback, const JsValueList& params);
+ void FilterChanged(const FilterChangeCallback& callback, const JsValueList& params) const;
void ShowNotification(const ShowNotificationCallback& callback,
const JsValueList& params) const;
FilterPtr GetWhitelistingFilter(const std::string& url,
ContentTypeMask contentTypeMask, const std::string& documentUrl) const;
FilterPtr GetWhitelistingFilter(const std::string& url,
ContentTypeMask contentTypeMask,
const std::vector<std::string>& documentUrls) const;
};

Powered by Google App Engine
This is Rietveld