Left: | ||
Right: |
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 #include <AdblockPlus/JsValue.h> |
8 | 8 |
9 namespace AdblockPlus | 9 namespace AdblockPlus |
10 { | 10 { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
52 } | 52 } |
53 inline WebRequest& GetWebRequest() | 53 inline WebRequest& GetWebRequest() |
54 { | 54 { |
55 return webRequest; | 55 return webRequest; |
56 } | 56 } |
57 inline ErrorCallback& GetErrorCallback() | 57 inline ErrorCallback& GetErrorCallback() |
58 { | 58 { |
59 return errorCallback; | 59 return errorCallback; |
60 } | 60 } |
61 | 61 |
62 class IsolateSetter | |
Felix Dahlke
2013/04/18 12:16:11
Not entirely happy with IsolateSetter as a name, b
| |
63 { | |
64 public: | |
65 IsolateSetter(v8::Isolate* isolate); | |
66 virtual ~IsolateSetter(); | |
Felix Dahlke
2013/04/18 12:16:11
Since this is not a base class, the destructor sho
| |
67 | |
68 private: | |
69 v8::Isolate* isolate; | |
70 }; | |
71 | |
62 class Context | 72 class Context |
63 { | 73 { |
64 public: | 74 public: |
65 Context(const JsEngine& jsEngine); | 75 Context(const JsEngine& jsEngine); |
66 virtual inline ~Context() {}; | 76 virtual ~Context() {} |
Felix Dahlke
2013/04/18 12:16:11
Since Context is not being inherited from what I s
| |
67 | 77 |
68 private: | 78 private: |
69 const v8::Locker locker; | 79 const v8::Locker locker; |
80 const IsolateSetter isolateSetter; | |
70 const v8::HandleScope handleScope; | 81 const v8::HandleScope handleScope; |
71 const v8::Context::Scope contextScope; | 82 const v8::Context::Scope contextScope; |
72 }; | 83 }; |
73 | 84 |
74 private: | 85 private: |
75 FileSystem& fileSystem; | 86 FileSystem& fileSystem; |
76 WebRequest& webRequest; | 87 WebRequest& webRequest; |
77 ErrorCallback& errorCallback; | 88 ErrorCallback& errorCallback; |
78 v8::Isolate* isolate; | 89 v8::Isolate* isolate; |
79 v8::Persistent<v8::Context> context; | 90 v8::Persistent<v8::Context> context; |
80 }; | 91 }; |
81 } | 92 } |
82 | 93 |
83 #endif | 94 #endif |
OLD | NEW |