LEFT | RIGHT |
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 { |
(...skipping 22 matching lines...) Expand all Loading... |
33 void Gc(); | 33 void Gc(); |
34 JsValuePtr NewValue(const std::string& val); | 34 JsValuePtr NewValue(const std::string& val); |
35 JsValuePtr NewValue(int64_t val); | 35 JsValuePtr NewValue(int64_t val); |
36 JsValuePtr NewValue(bool val); | 36 JsValuePtr NewValue(bool val); |
37 inline JsValuePtr NewValue(const char* val) | 37 inline JsValuePtr NewValue(const char* val) |
38 { | 38 { |
39 return NewValue(std::string(val)); | 39 return NewValue(std::string(val)); |
40 } | 40 } |
41 inline JsValuePtr NewValue(int val) | 41 inline JsValuePtr NewValue(int val) |
42 { | 42 { |
43 return NewValue((int64_t)val); | 43 return NewValue(static_cast<int64_t>(val)); |
44 } | 44 } |
45 | 45 |
46 class Context | 46 class Context |
47 { | 47 { |
48 public: | 48 public: |
49 Context(const JsEngine& jsEngine); | 49 Context(const JsEngine& jsEngine); |
50 virtual inline ~Context() {}; | 50 virtual inline ~Context() {}; |
51 | 51 |
52 private: | 52 private: |
53 const v8::Locker locker; | 53 const v8::Locker locker; |
54 const v8::HandleScope handleScope; | 54 const v8::HandleScope handleScope; |
55 const v8::Context::Scope contextScope; | 55 const v8::Context::Scope contextScope; |
56 }; | 56 }; |
57 | 57 |
58 private: | 58 private: |
59 const FileSystem* const fileSystem; | 59 const FileSystem* const fileSystem; |
60 v8::Isolate* isolate; | 60 v8::Isolate* isolate; |
61 v8::Persistent<v8::Context> context; | 61 v8::Persistent<v8::Context> context; |
62 }; | 62 }; |
63 } | 63 } |
64 | 64 |
65 #endif | 65 #endif |
LEFT | RIGHT |