| OLD | NEW |
| 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 | 8 |
| 8 namespace AdblockPlus | 9 namespace AdblockPlus |
| 9 { | 10 { |
| 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 FileReader* const fileReader, |
| 25 WebRequest* const webRequest, | 26 WebRequest* const webRequest, |
| 26 ErrorCallback* const errorCallback); | 27 ErrorCallback* const errorCallback); |
| 27 std::string Evaluate(const std::string& source, | 28 JsValuePtr Evaluate(const std::string& source, |
| 28 const std::string& filename = ""); | 29 const std::string& filename = ""); |
| 29 void Load(const std::string& scriptPath); | 30 void Load(const std::string& scriptPath); |
| 30 void Gc(); | 31 void Gc(); |
| 31 | 32 |
| 32 private: | 33 private: |
| 33 const FileReader* const fileReader; | 34 const FileReader* const fileReader; |
| 34 v8::Persistent<v8::Context> context; | 35 v8::Persistent<v8::Context> context; |
| 35 }; | 36 }; |
| 36 } | 37 } |
| 37 | 38 |
| 38 #endif | 39 #endif |
| OLD | NEW |