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

Unified Diff: shell/src/Main.cpp

Issue 10310030: Convert references to FileSystem & Co. into shared pointers (avoid use after free) (Closed)
Patch Set: Created April 18, 2013, 11:59 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 | « libadblockplus.gyp ('k') | src/ConsoleJsObject.cpp » ('j') | src/JsEngine.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: shell/src/Main.cpp
===================================================================
--- a/shell/src/Main.cpp
+++ b/shell/src/Main.cpp
@@ -5,25 +5,16 @@
#include "GcCommand.h"
#include "HelpCommand.h"
#include "FiltersCommand.h"
#include "SubscriptionsCommand.h"
#include "MatchesCommand.h"
namespace
{
- class CerrErrorCallback : public AdblockPlus::ErrorCallback
- {
- public:
- void operator()(const std::string& message)
- {
- std::cerr << "Error: " << message << std::endl;
- }
- };
-
void Add(CommandMap& commands, Command* command)
{
commands[command->name] = command;
}
bool ReadCommandLine(std::string& commandLine)
{
std::cout << "> ";
@@ -41,24 +32,20 @@ namespace
std::getline(lineStream, arguments);
}
}
int main()
{
try
{
- AdblockPlus::DefaultFileSystem fileSystem;
- AdblockPlus::DefaultWebRequest webRequest;
- CerrErrorCallback errorCallback;
AdblockPlus::AppInfo appInfo;
appInfo.version = "1.0";
appInfo.name = "Adblock Plus Shell";
- AdblockPlus::JsEngine jsEngine(appInfo, &fileSystem, &webRequest,
- &errorCallback);
+ AdblockPlus::JsEngine jsEngine(appInfo);
AdblockPlus::FilterEngine filterEngine(jsEngine);
CommandMap commands;
Add(commands, new GcCommand(jsEngine));
Add(commands, new HelpCommand(commands));
Add(commands, new FiltersCommand(filterEngine));
Add(commands, new SubscriptionsCommand(filterEngine));
Add(commands, new MatchesCommand(filterEngine));
« no previous file with comments | « libadblockplus.gyp ('k') | src/ConsoleJsObject.cpp » ('j') | src/JsEngine.cpp » ('J')

Powered by Google App Engine
This is Rietveld