Index: include/AdblockPlus/JsEngine.h |
=================================================================== |
--- a/include/AdblockPlus/JsEngine.h |
+++ b/include/AdblockPlus/JsEngine.h |
@@ -16,20 +16,29 @@ namespace AdblockPlus |
JsError(const v8::Handle<v8::Value> exception); |
}; |
class JsEngine |
{ |
public: |
JsEngine(const FileReader* const fileReader, |
ErrorCallback* const errorCallback); |
- void Evaluate(const std::string& source); |
+ void Evaluate(const char* source, const char* filename = NULL); |
Felix Dahlke
2013/03/15 15:18:36
Have you considered having just one Evaluate funct
Wladimir Palant
2013/03/15 16:00:41
I would rather use char* for the main function - w
Felix Dahlke
2013/03/15 17:10:47
It's up to you. std::string is obviously more C++-
|
+ void Evaluate(const std::string& source) |
Felix Dahlke
2013/03/15 15:18:36
I prefer to have all implementations in the .cpp f
Wladimir Palant
2013/03/15 16:00:41
Yes, I tend to be a bit sloppy about that - fair p
|
+ { |
+ Evaluate(source.c_str()); |
+ } |
+ void Evaluate(const std::string& source, const std::string& filename) |
+ { |
+ Evaluate(filename.c_str(), source.c_str()); |
+ } |
void Load(const std::string& scriptPath); |
std::string Call(const std::string& functionName); |
void Gc(); |
private: |
const FileReader* const fileReader; |
v8::Persistent<v8::Context> context; |
+ inline v8::Handle<v8::Script> CompileScript(const char* source, const char* filename); |
Felix Dahlke
2013/03/15 15:18:36
You probably don't want to declare this inline. It
|
}; |
} |
#endif |