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: Merged upstream, addressed issues, renamed AppInfo fields Created April 17, 2013, 2:47 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 #include <AdblockPlus/JsValue.h> 7 #include <AdblockPlus/JsValue.h>
8 8
9 namespace AdblockPlus 9 namespace AdblockPlus
10 { 10 {
11 struct AppInfo;
11 class FileSystem; 12 class FileSystem;
12 class WebRequest; 13 class WebRequest;
13 class ErrorCallback; 14 class ErrorCallback;
14 15
15 class JsError : public std::runtime_error 16 class JsError : public std::runtime_error
16 { 17 {
17 public: 18 public:
18 explicit JsError(const v8::Handle<v8::Value> exception, 19 explicit JsError(const v8::Handle<v8::Value> exception,
19 const v8::Handle<v8::Message> message); 20 const v8::Handle<v8::Message> message);
20 }; 21 };
21 22
22 class JsEngine 23 class JsEngine
23 { 24 {
24 friend class JsValue; 25 friend class JsValue;
25 26
26 public: 27 public:
27 JsEngine(FileSystem* const fileReader, 28 JsEngine(const AppInfo& appInfo,
29 FileSystem* const fileReader,
28 WebRequest* const webRequest, 30 WebRequest* const webRequest,
29 ErrorCallback* const errorCallback); 31 ErrorCallback* const errorCallback);
30 JsValuePtr Evaluate(const std::string& source, 32 JsValuePtr Evaluate(const std::string& source,
31 const std::string& filename = ""); 33 const std::string& filename = "");
32 void Load(const std::string& scriptPath); 34 void Load(const std::string& scriptPath);
33 void Gc(); 35 void Gc();
34 JsValuePtr NewValue(const std::string& val); 36 JsValuePtr NewValue(const std::string& val);
35 JsValuePtr NewValue(int64_t val); 37 JsValuePtr NewValue(int64_t val);
36 JsValuePtr NewValue(bool val); 38 JsValuePtr NewValue(bool val);
37 inline JsValuePtr NewValue(const char* val) 39 inline JsValuePtr NewValue(const char* val)
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 private: 76 private:
75 FileSystem& fileSystem; 77 FileSystem& fileSystem;
76 WebRequest& webRequest; 78 WebRequest& webRequest;
77 ErrorCallback& errorCallback; 79 ErrorCallback& errorCallback;
78 v8::Isolate* isolate; 80 v8::Isolate* isolate;
79 v8::Persistent<v8::Context> context; 81 v8::Persistent<v8::Context> context;
80 }; 82 };
81 } 83 }
82 84
83 #endif 85 #endif
OLDNEW
« no previous file with comments | « include/AdblockPlus/AppInfo.h ('k') | lib/info.js » ('j') | src/AppInfoJsObject.cpp » ('J')

Powered by Google App Engine
This is Rietveld