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

Unified Diff: src/FilterEngine.cpp

Issue 29508569: Issue 5450 - don't expose std::shared_ptr<JsEngine> (Closed) Base URL: https://github.com/adblockplus/libadblockplus.git
Patch Set: Created Aug. 7, 2017, 8:39 a.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 | « shell/src/PrefsCommand.cpp ('k') | src/Platform.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 06e126235e141f63ac71f2a6a50b8499b2db8ec9..5d2082d79aa7cc36f1b42a6b2041c96ee16d526e 100644
--- a/src/FilterEngine.cpp
+++ b/src/FilterEngine.cpp
@@ -199,7 +199,7 @@ void FilterEngine::CreateAsync(const JsEnginePtr& jsEngine,
auto filterEngine = weakFilterEngine.lock();
if (!filterEngine)
return;
- auto jsEngine = filterEngine->GetJsEngine();
+ auto& jsEngine = filterEngine->GetJsEngine();
// param[0] - nullable string Prefs.allowed_connection_type
// param[1] - function(Boolean)
@@ -209,18 +209,18 @@ void FilterEngine::CreateAsync(const JsEnginePtr& jsEngine,
return;
if (!isSubscriptionDownloadAllowedCallback)
{
- params[1].Call(jsEngine->NewValue(true));
+ params[1].Call(jsEngine.NewValue(true));
return;
}
- auto valuesID = jsEngine->StoreJsValues(params);
+ auto valuesID = jsEngine.StoreJsValues(params);
auto callJsCallback = [weakFilterEngine, valuesID](bool isAllowed)
{
auto filterEngine = weakFilterEngine.lock();
if (!filterEngine)
return;
- auto jsEngine = filterEngine->GetJsEngine();
- auto jsParams = jsEngine->TakeJsValues(valuesID);
- jsParams[1].Call(jsEngine->NewValue(isAllowed));
+ auto& jsEngine = filterEngine->GetJsEngine();
+ auto jsParams = jsEngine.TakeJsValues(valuesID);
+ jsParams[1].Call(jsEngine.NewValue(isAllowed));
};
std::string allowedConnectionType = params[0].IsString() ? params[0].AsString() : std::string();
isSubscriptionDownloadAllowedCallback(params[0].IsString() ? &allowedConnectionType : nullptr, callJsCallback);
@@ -241,7 +241,7 @@ void FilterEngine::CreateAsync(const JsEnginePtr& jsEngine,
if (!filterEngine)
return;
if (reason == "save")
- filterEngine->GetJsEngine()->NotifyLowMemory();
+ filterEngine->GetJsEngine().NotifyLowMemory();
});
// Lock the JS engine while we are loading scripts, no timeouts should fire
« no previous file with comments | « shell/src/PrefsCommand.cpp ('k') | src/Platform.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld