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

Unified Diff: src/engine/Main.cpp

Issue 11376067: Fix updating (Closed)
Patch Set: Created Aug. 8, 2013, 9:56 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 | « no previous file | src/engine/Updater.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/engine/Main.cpp
===================================================================
--- a/src/engine/Main.cpp
+++ b/src/engine/Main.cpp
@@ -15,6 +15,7 @@
namespace
{
std::auto_ptr<AdblockPlus::FilterEngine> filterEngine;
+ std::auto_ptr<Updater> updater;
void WriteStrings(Communication::OutputBuffer& response,
const std::vector<std::string>& strings)
@@ -288,7 +289,7 @@
return 0;
}
- void OnUpdateAvailable(AdblockPlus::JsEnginePtr jsEngine, AdblockPlus::JsValueList& params)
+ void OnUpdateAvailable(AdblockPlus::JsValueList& params)
{
updateAvailable = true;
if (params.size() < 1)
@@ -297,8 +298,8 @@
return;
}
- Updater updater(jsEngine, params[0]->AsString());
- updater.Update();
+ updater->SetUrl(params[0]->AsString());
+ updater->Update();
Wladimir Palant 2013/08/13 09:24:39 updater->Update(params[0]->AsString()) would make
}
}
@@ -320,8 +321,7 @@
#endif
AdblockPlus::JsEnginePtr jsEngine = AdblockPlus::JsEngine::New(appInfo);
- jsEngine->SetEventCallback("updateAvailable",
- std::bind(&OnUpdateAvailable, jsEngine, std::placeholders::_1));
+ jsEngine->SetEventCallback("updateAvailable", &OnUpdateAvailable);
std::string dataPath = ToUtf8String(GetAppDataPath());
dynamic_cast<AdblockPlus::DefaultFileSystem*>(jsEngine->GetFileSystem().get())->SetBasePath(dataPath);
@@ -350,6 +350,7 @@
LocalFree(argv);
Dictionary::Create(locale);
filterEngine = CreateFilterEngine(locale);
+ updater.reset(new Updater(filterEngine->GetJsEngine()));
for (;;)
{
« no previous file with comments | « no previous file | src/engine/Updater.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld