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

Unified Diff: include/AdblockPlus/FilterEngine.h

Issue 10173031: Don`t use references to JsEngine to avoid use-after-free errors,switch to shared_ptr instead (Closed)
Patch Set: Created April 18, 2013, 4:15 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 | « no previous file | include/AdblockPlus/JsEngine.h » ('j') | src/JsEngine.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/AdblockPlus/FilterEngine.h
===================================================================
--- a/include/AdblockPlus/FilterEngine.h
+++ b/include/AdblockPlus/FilterEngine.h
@@ -1,21 +1,21 @@
#ifndef ADBLOCKPLUS_FILTER_ENGINE_H
#define ADBLOCKPLUS_FILTER_ENGINE_H
#include <vector>
#include <map>
#include <string>
+#include <AdblockPlus/JsEngine.h>
#include <AdblockPlus/JsValue.h>
#include "tr1_memory.h"
namespace AdblockPlus
{
- class JsEngine;
class FilterEngine;
#if FILTER_ENGINE_STUBS
class JsObject
#else
class JsObject : public JsValue
#endif
{
@@ -108,29 +108,29 @@ namespace AdblockPlus
class FilterEngine
{
#if FILTER_ENGINE_STUBS
friend class Filter;
friend class Subscription;
#endif
public:
- explicit FilterEngine(JsEngine& jsEngine);
+ explicit FilterEngine(JsEnginePtr jsEngine);
FilterPtr GetFilter(const std::string& text);
SubscriptionPtr GetSubscription(const std::string& url);
const std::vector<FilterPtr> GetListedFilters() const;
const std::vector<SubscriptionPtr> GetListedSubscriptions() const;
void FetchAvailableSubscriptions(SubscriptionsCallback callback);
FilterPtr Matches(const std::string& url,
const std::string& contentType,
const std::string& documentUrl);
std::vector<std::string> GetElementHidingSelectors(const std::string& domain) const;
private:
- JsEngine& jsEngine;
+ JsEnginePtr jsEngine;
#if FILTER_ENGINE_STUBS
std::map<std::string, FilterPtr> knownFilters;
std::vector<FilterPtr> listedFilters;
std::map<std::string, SubscriptionPtr> knownSubscriptions;
std::vector<SubscriptionPtr> listedSubscriptions;
#endif
};
}
« no previous file with comments | « no previous file | include/AdblockPlus/JsEngine.h » ('j') | src/JsEngine.cpp » ('J')

Powered by Google App Engine
This is Rietveld