Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 #include <AdblockPlus.h> | 1 #include <AdblockPlus.h> |
2 #include <sstream> | 2 #include <sstream> |
3 | 3 |
4 #include "GlobalJsObject.h" | 4 #include "GlobalJsObject.h" |
5 #include "Utils.h" | 5 #include "Utils.h" |
6 | 6 |
7 namespace | 7 namespace |
8 { | 8 { |
9 v8::Handle<v8::Context> CreateContext( | 9 v8::Handle<v8::Context> CreateContext( |
10 AdblockPlus::FileSystem& fileSystem, | 10 AdblockPlus::FileSystem& fileSystem, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 const v8::Handle<v8::Script> script = CompileScript(source, filename); | 77 const v8::Handle<v8::Script> script = CompileScript(source, filename); |
78 CheckTryCatch(tryCatch); | 78 CheckTryCatch(tryCatch); |
79 v8::Local<v8::Value> result = script->Run(); | 79 v8::Local<v8::Value> result = script->Run(); |
80 CheckTryCatch(tryCatch); | 80 CheckTryCatch(tryCatch); |
81 v8::String::Utf8Value resultString(result); | 81 v8::String::Utf8Value resultString(result); |
82 return std::string(*resultString); | 82 return std::string(*resultString); |
83 } | 83 } |
84 | 84 |
85 void AdblockPlus::JsEngine::Load(const std::string& scriptPath) | 85 void AdblockPlus::JsEngine::Load(const std::string& scriptPath) |
86 { | 86 { |
87 const std::auto_ptr<std::istream> file = fileSystem->Read(scriptPath); | 87 const std::tr1::shared_ptr<std::istream> file = fileSystem->Read(scriptPath); |
88 if (!file.get() || !*file) | 88 if (!file || !*file) |
Wladimir Palant
2013/04/12 16:10:35
I would suspect that !file.get() is the same as !f
Felix Dahlke
2013/04/15 03:43:34
No, auto_ptr doesn't. Surprised me as well.
| |
89 throw std::runtime_error("Unable to load script " + scriptPath); | 89 throw std::runtime_error("Unable to load script " + scriptPath); |
90 Evaluate(Utils::Slurp(*file)); | 90 Evaluate(Utils::Slurp(*file)); |
91 } | 91 } |
92 | 92 |
93 void AdblockPlus::JsEngine::Gc() | 93 void AdblockPlus::JsEngine::Gc() |
94 { | 94 { |
95 while (!v8::V8::IdleNotification()); | 95 while (!v8::V8::IdleNotification()); |
96 } | 96 } |
LEFT | RIGHT |