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

Unified Diff: test/BaseJsTest.cpp

Issue 29508591: Issue 5450 - don't expose std::shared_ptr<FilterEngine> (Closed) Base URL: https://github.com/adblockplus/libadblockplus.git
Patch Set: Created Aug. 7, 2017, 8:46 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 | « test/BaseJsTest.h ('k') | test/FilterEngine.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/BaseJsTest.cpp
diff --git a/test/BaseJsTest.cpp b/test/BaseJsTest.cpp
index f45e2b9274adba9aeb986de73635a226e07ffc45..35cdbcaa03a6df8151913d13b7908e484a9ee7c7 100644
--- a/test/BaseJsTest.cpp
+++ b/test/BaseJsTest.cpp
@@ -35,8 +35,8 @@ void DelayedTimer::ProcessImmediateTimers(DelayedTimer::SharedTasks& timerTasks)
}
}
-FilterEnginePtr CreateFilterEngine(LazyFileSystem& fileSystem,
- Platform& paltform,
+FilterEngine& CreateFilterEngine(LazyFileSystem& fileSystem,
+ Platform& platform,
const FilterEngine::CreationParameters& creationParams)
{
std::list<LazyFileSystem::Task> fileSystemTasks;
@@ -44,18 +44,18 @@ FilterEnginePtr CreateFilterEngine(LazyFileSystem& fileSystem,
{
fileSystemTasks.emplace_back(task);
};
- FilterEnginePtr retValue;
- paltform.CreateFilterEngineAsync(creationParams, [&retValue, &fileSystem](const FilterEnginePtr& filterEngine)
+ bool isFilterEngineReady = false;
+ platform.CreateFilterEngineAsync(creationParams, [&isFilterEngineReady, &fileSystem](const FilterEngine& filterEngine)
{
- retValue = filterEngine;
fileSystem.scheduler = LazyFileSystem::ExecuteImmediately;
+ isFilterEngineReady = true;
});
- while (!retValue && !fileSystemTasks.empty())
+ while (!isFilterEngineReady && !fileSystemTasks.empty())
{
(*fileSystemTasks.begin())();
fileSystemTasks.pop_front();
}
- return retValue;
+ return platform.GetFilterEngine();
}
ThrowingPlatformCreationParameters::ThrowingPlatformCreationParameters()
« no previous file with comments | « test/BaseJsTest.h ('k') | test/FilterEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld