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

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

Issue 10184021: Some refactoring of global JavaScript objects (Closed)
Patch Set: Unbitrotted patch Created April 16, 2013, 3:32 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 | « no previous file | include/AdblockPlus/JsValue.h » ('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 #include <AdblockPlus/JsValue.h> 7 #include <AdblockPlus/JsValue.h>
8 8
9 namespace AdblockPlus 9 namespace AdblockPlus
10 { 10 {
(...skipping 24 matching lines...) Expand all
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((int64_t)val);
44 } 44 }
45 JsValuePtr NewObject();
46 static JsEngine& FromArguments(const v8::Arguments& arguments);
47 JsValueList ConvertArguments(const v8::Arguments& arguments);
48
49 inline FileSystem& GetFileSystem()
50 {
51 return fileSystem;
52 }
53 inline WebRequest& GetWebRequest()
54 {
55 return webRequest;
56 }
57 inline ErrorCallback& GetErrorCallback()
58 {
59 return errorCallback;
60 }
45 61
46 class Context 62 class Context
47 { 63 {
48 public: 64 public:
49 Context(const JsEngine& jsEngine); 65 Context(const JsEngine& jsEngine);
50 virtual inline ~Context() {}; 66 virtual inline ~Context() {};
51 67
52 private: 68 private:
53 const v8::Locker locker; 69 const v8::Locker locker;
54 const v8::HandleScope handleScope; 70 const v8::HandleScope handleScope;
55 const v8::Context::Scope contextScope; 71 const v8::Context::Scope contextScope;
56 }; 72 };
57 73
58 private: 74 private:
59 const FileSystem* const fileSystem; 75 FileSystem& fileSystem;
76 WebRequest& webRequest;
77 ErrorCallback& errorCallback;
60 v8::Isolate* isolate; 78 v8::Isolate* isolate;
61 v8::Persistent<v8::Context> context; 79 v8::Persistent<v8::Context> context;
62 }; 80 };
63 } 81 }
64 82
65 #endif 83 #endif
OLDNEW
« no previous file with comments | « no previous file | include/AdblockPlus/JsValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld