| 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/AppInfo.h> | 7 #include <AdblockPlus/AppInfo.h> |
| 8 #include <AdblockPlus/ErrorCallback.h> | 8 #include <AdblockPlus/ErrorCallback.h> |
| 9 #include <AdblockPlus/FileSystem.h> | 9 #include <AdblockPlus/FileSystem.h> |
| 10 #include <AdblockPlus/JsValue.h> | 10 #include <AdblockPlus/JsValue.h> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 typedef std::tr1::shared_ptr<JsEngine> JsEnginePtr; | 24 typedef std::tr1::shared_ptr<JsEngine> JsEnginePtr; |
| 25 | 25 |
| 26 class JsEngine | 26 class JsEngine |
| 27 { | 27 { |
| 28 friend class JsValue; | 28 friend class JsValue; |
| 29 | 29 |
| 30 public: | 30 public: |
| 31 JsEngine(const AppInfo& appInfo = AppInfo()); | 31 JsEngine(const AppInfo& appInfo = AppInfo()); |
| 32 JsValuePtr Evaluate(const std::string& source, | 32 JsValuePtr Evaluate(const std::string& source, |
| 33 const std::string& filename = ""); | 33 const std::string& filename = ""); |
| 34 void Load(const std::string& scriptPath); | |
| 35 void Gc(); | 34 void Gc(); |
| 36 JsValuePtr NewValue(const std::string& val); | 35 JsValuePtr NewValue(const std::string& val); |
| 37 JsValuePtr NewValue(int64_t val); | 36 JsValuePtr NewValue(int64_t val); |
| 38 JsValuePtr NewValue(bool val); | 37 JsValuePtr NewValue(bool val); |
| 39 inline JsValuePtr NewValue(const char* val) | 38 inline JsValuePtr NewValue(const char* val) |
| 40 { | 39 { |
| 41 return NewValue(std::string(val)); | 40 return NewValue(std::string(val)); |
| 42 } | 41 } |
| 43 inline JsValuePtr NewValue(int val) | 42 inline JsValuePtr NewValue(int val) |
| 44 { | 43 { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 71 private: | 70 private: |
| 72 FileSystemPtr fileSystem; | 71 FileSystemPtr fileSystem; |
| 73 WebRequestPtr webRequest; | 72 WebRequestPtr webRequest; |
| 74 ErrorCallbackPtr errorCallback; | 73 ErrorCallbackPtr errorCallback; |
| 75 v8::Isolate* isolate; | 74 v8::Isolate* isolate; |
| 76 v8::Persistent<v8::Context> context; | 75 v8::Persistent<v8::Context> context; |
| 77 }; | 76 }; |
| 78 } | 77 } |
| 79 | 78 |
| 80 #endif | 79 #endif |
| OLD | NEW |