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

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

Issue 9846017: Make JavaScript sources compile into the library; convert JavaScript files on the fly (Closed)
Patch Set: Review comments addressed Created March 15, 2013, 3:59 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
« no previous file with comments | « convert_js.py ('k') | lib/adblockplus.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 class ErrorCallback; 8 class ErrorCallback;
9 class FileReader; 9 class FileReader;
10 10
11 namespace AdblockPlus 11 namespace AdblockPlus
12 { 12 {
13 class JsError : public std::runtime_error 13 class JsError : public std::runtime_error
14 { 14 {
15 public: 15 public:
16 JsError(const v8::Handle<v8::Value> exception); 16 JsError(const v8::Handle<v8::Value> exception);
17 }; 17 };
18 18
19 class JsEngine 19 class JsEngine
20 { 20 {
21 public: 21 public:
22 JsEngine(const FileReader* const fileReader, 22 JsEngine(const FileReader* const fileReader,
23 ErrorCallback* const errorCallback); 23 ErrorCallback* const errorCallback);
24 void Evaluate(const std::string& source); 24 void Evaluate(const char* source, const char* filename = NULL);
25 void Evaluate(const std::string& source,
26 const std::string& filename = "");
25 void Load(const std::string& scriptPath); 27 void Load(const std::string& scriptPath);
26 std::string Call(const std::string& functionName); 28 std::string Call(const std::string& functionName);
27 void Gc(); 29 void Gc();
28 30
29 private: 31 private:
30 const FileReader* const fileReader; 32 const FileReader* const fileReader;
31 v8::Persistent<v8::Context> context; 33 v8::Persistent<v8::Context> context;
32 }; 34 };
33 } 35 }
34 36
35 #endif 37 #endif
OLDNEW
« no previous file with comments | « convert_js.py ('k') | lib/adblockplus.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld