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

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

Issue 10274013: Simplified JsEngine API, Call() and GetVariable() aren`t reallynecessary if Evaluate() returns a v… (Closed)
Patch Set: Slight improvement Created April 11, 2013, 5:44 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 | src/JsEngine.cpp » ('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 7
8 namespace AdblockPlus 8 namespace AdblockPlus
9 { 9 {
10 class ErrorCallback; 10 class ErrorCallback;
11 class FileReader; 11 class FileReader;
12 class WebRequest; 12 class WebRequest;
13 13
14 class JsError : public std::runtime_error 14 class JsError : public std::runtime_error
15 { 15 {
16 public: 16 public:
17 explicit JsError(const v8::Handle<v8::Value> exception, 17 explicit JsError(const v8::Handle<v8::Value> exception,
18 const v8::Handle<v8::Message> message); 18 const v8::Handle<v8::Message> message);
19 }; 19 };
20 20
21 class JsEngine 21 class JsEngine
22 { 22 {
23 public: 23 public:
24 JsEngine(const FileReader* const fileReader, 24 JsEngine(const FileReader* const fileReader,
25 WebRequest* const webRequest, 25 WebRequest* const webRequest,
26 ErrorCallback* const errorCallback); 26 ErrorCallback* const errorCallback);
27 std::string Evaluate(const char* source, const char* filename = NULL);
28 std::string Evaluate(const std::string& source, 27 std::string Evaluate(const std::string& source,
29 const std::string& filename = ""); 28 const std::string& filename = "");
30 void Load(const std::string& scriptPath); 29 void Load(const std::string& scriptPath);
31 std::string Call(const std::string& functionName);
32 std::string GetVariable(const std::string& name);
33 void Gc(); 30 void Gc();
34 31
35 private: 32 private:
36 const FileReader* const fileReader; 33 const FileReader* const fileReader;
37 v8::Persistent<v8::Context> context; 34 v8::Persistent<v8::Context> context;
38 }; 35 };
39 } 36 }
40 37
41 #endif 38 #endif
OLDNEW
« no previous file with comments | « no previous file | src/JsEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld