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

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

Issue 10305024: Simplify context setup, set properties on the global object directly instead of using templates (Closed)
Patch Set: Created April 18, 2013, 6:26 a.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 | src/ConsoleJsObject.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 25 matching lines...) Expand all
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(static_cast<int64_t>(val)); 43 return NewValue(static_cast<int64_t>(val));
44 } 44 }
45 JsValuePtr NewObject(); 45 JsValuePtr NewObject();
46 JsValuePtr NewCallback(v8::InvocationCallback callback);
46 static JsEngine& FromArguments(const v8::Arguments& arguments); 47 static JsEngine& FromArguments(const v8::Arguments& arguments);
47 JsValueList ConvertArguments(const v8::Arguments& arguments); 48 JsValueList ConvertArguments(const v8::Arguments& arguments);
48 49
49 inline FileSystem& GetFileSystem() 50 inline FileSystem& GetFileSystem()
50 { 51 {
51 return fileSystem; 52 return fileSystem;
52 } 53 }
53 inline WebRequest& GetWebRequest() 54 inline WebRequest& GetWebRequest()
54 { 55 {
55 return webRequest; 56 return webRequest;
(...skipping 18 matching lines...) Expand all
74 private: 75 private:
75 FileSystem& fileSystem; 76 FileSystem& fileSystem;
76 WebRequest& webRequest; 77 WebRequest& webRequest;
77 ErrorCallback& errorCallback; 78 ErrorCallback& errorCallback;
78 v8::Isolate* isolate; 79 v8::Isolate* isolate;
79 v8::Persistent<v8::Context> context; 80 v8::Persistent<v8::Context> context;
80 }; 81 };
81 } 82 }
82 83
83 #endif 84 #endif
OLDNEW
« no previous file with comments | « no previous file | src/ConsoleJsObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld