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

Side by Side Diff: shell/src/Main.cpp

Issue 9763002: Add command to initiate garbage collection (Closed)
Patch Set: Created March 11, 2013, 11:07 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « shell/src/GcCommand.cpp ('k') | src/JsEngine.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include <AdblockPlus.h> 1 #include <AdblockPlus.h>
2 #include <fstream> 2 #include <fstream>
3 #include <iostream> 3 #include <iostream>
4 #include <sstream> 4 #include <sstream>
5 5
6 #include "GcCommand.h"
6 #include "HelpCommand.h" 7 #include "HelpCommand.h"
7 #include "SubscriptionsCommand.h" 8 #include "SubscriptionsCommand.h"
8 #include "MatchesCommand.h" 9 #include "MatchesCommand.h"
9 10
10 namespace 11 namespace
11 { 12 {
12 class LibFileReader : public AdblockPlus::FileReader 13 class LibFileReader : public AdblockPlus::FileReader
13 { 14 {
14 public: 15 public:
15 std::auto_ptr<std::istream> Read(const std::string& path) const 16 std::auto_ptr<std::istream> Read(const std::string& path) const
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 { 57 {
57 try 58 try
58 { 59 {
59 LibFileReader fileReader; 60 LibFileReader fileReader;
60 CerrErrorCallback errorCallback; 61 CerrErrorCallback errorCallback;
61 AdblockPlus::JsEngine jsEngine(&fileReader, 0); 62 AdblockPlus::JsEngine jsEngine(&fileReader, 0);
62 jsEngine.Load("adblockplus_compat.js"); 63 jsEngine.Load("adblockplus_compat.js");
63 jsEngine.Load("adblockplus.js"); 64 jsEngine.Load("adblockplus.js");
64 65
65 CommandMap commands; 66 CommandMap commands;
67 Add(commands, new GcCommand(jsEngine));
66 Add(commands, new HelpCommand(commands)); 68 Add(commands, new HelpCommand(commands));
67 Add(commands, new SubscriptionsCommand(jsEngine)); 69 Add(commands, new SubscriptionsCommand(jsEngine));
68 Add(commands, new MatchesCommand()); 70 Add(commands, new MatchesCommand());
69 71
70 std::string commandLine; 72 std::string commandLine;
71 while (ReadCommandLine(commandLine)) 73 while (ReadCommandLine(commandLine))
72 { 74 {
73 std::string commandName; 75 std::string commandName;
74 std::string arguments; 76 std::string arguments;
75 ParseCommandLine(commandLine, commandName, arguments); 77 ParseCommandLine(commandLine, commandName, arguments);
(...skipping 10 matching lines...) Expand all
86 std::cout << error.what() << std::endl; 88 std::cout << error.what() << std::endl;
87 } 89 }
88 } 90 }
89 } 91 }
90 catch (const std::exception& e) 92 catch (const std::exception& e)
91 { 93 {
92 std::cerr << "Exception: " << e.what() << std::endl; 94 std::cerr << "Exception: " << e.what() << std::endl;
93 } 95 }
94 return 0; 96 return 0;
95 } 97 }
OLDNEW
« no previous file with comments | « shell/src/GcCommand.cpp ('k') | src/JsEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld