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

Side by Side Diff: include/AdblockPlus/JsEngine.h

Issue 10198022: Pass application data into libadblockplus (Closed)
Patch Set: Created April 12, 2013, 1:23 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 #ifndef ADBLOCKPLUS_JS_ENGINE_H 1 #ifndef ADBLOCKPLUS_JS_ENGINE_H
2 #define ADBLOCKPLUS_JS_ENGINE_H 2 #define ADBLOCKPLUS_JS_ENGINE_H
3 3
4 #include <stdexcept> 4 #include <stdexcept>
5 #include <string> 5 #include <string>
6 #include <v8.h> 6 #include <v8.h>
7 7
8 namespace AdblockPlus 8 namespace AdblockPlus
9 { 9 {
10 struct AppInfo;
10 class ErrorCallback; 11 class ErrorCallback;
11 class FileReader; 12 class FileReader;
12 class WebRequest; 13 class WebRequest;
13 14
14 class JsError : public std::runtime_error 15 class JsError : public std::runtime_error
15 { 16 {
16 public: 17 public:
17 explicit JsError(const v8::Handle<v8::Value> exception, 18 explicit JsError(const v8::Handle<v8::Value> exception,
18 const v8::Handle<v8::Message> message); 19 const v8::Handle<v8::Message> message);
19 }; 20 };
20 21
21 class JsEngine 22 class JsEngine
22 { 23 {
23 public: 24 public:
24 JsEngine(const FileReader* const fileReader, 25 JsEngine(const AppInfo& appInfo,
26 const FileReader* const fileReader,
25 WebRequest* const webRequest, 27 WebRequest* const webRequest,
26 ErrorCallback* const errorCallback); 28 ErrorCallback* const errorCallback);
27 std::string Evaluate(const std::string& source, 29 std::string Evaluate(const std::string& source,
28 const std::string& filename = ""); 30 const std::string& filename = "");
29 void Load(const std::string& scriptPath); 31 void Load(const std::string& scriptPath);
30 void Gc(); 32 void Gc();
31 33
32 private: 34 private:
33 const FileReader* const fileReader; 35 const FileReader* const fileReader;
34 v8::Persistent<v8::Context> context; 36 v8::Persistent<v8::Context> context;
35 }; 37 };
36 } 38 }
37 39
38 #endif 40 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld