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

Unified Diff: src/JsEngine.cpp

Issue 6112412478472192: Issue 1547 - Pass isolate to v8::API (Closed)
Patch Set: Created Nov. 10, 2014, 9:05 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/JsEngine.cpp
===================================================================
--- a/src/JsEngine.cpp
+++ b/src/JsEngine.cpp
@@ -24,12 +24,14 @@
namespace
{
- v8::Handle<v8::Script> CompileScript(const std::string& source, const std::string& filename)
+ v8::Handle<v8::Script> CompileScript(v8::Isolate* isolate,
+ const std::string& source, const std::string& filename)
{
- const v8::Handle<v8::String> v8Source = v8::String::New(source.c_str());
+ using AdblockPlus::Utils::ToV8String;
+ const v8::Handle<v8::String> v8Source = ToV8String(isolate, source);
if (filename.length())
{
- const v8::Handle<v8::String> v8Filename = v8::String::New(filename.c_str());
+ const v8::Handle<v8::String> v8Filename = ToV8String(isolate, filename);
return v8::Script::Compile(v8Source, v8Filename);
}
else
@@ -68,7 +70,8 @@
{
const JsContext context(shared_from_this());
const v8::TryCatch tryCatch;
- const v8::Handle<v8::Script> script = CompileScript(source, filename);
+ const v8::Handle<v8::Script> script = CompileScript(isolate, source,
+ filename);
CheckTryCatch(tryCatch);
v8::Local<v8::Value> result = script->Run();
CheckTryCatch(tryCatch);
@@ -102,13 +105,14 @@
{
const JsContext context(shared_from_this());
return JsValuePtr(new JsValue(shared_from_this(),
- v8::String::New(val.c_str(), val.length())));
+ Utils::ToV8String(isolate, val)));
}
AdblockPlus::JsValuePtr AdblockPlus::JsEngine::NewValue(int64_t val)
{
const JsContext context(shared_from_this());
- return JsValuePtr(new JsValue(shared_from_this(), v8::Number::New(val)));
+ return JsValuePtr(new JsValue(shared_from_this(),
+ v8::Number::New(isolate, val)));
}
AdblockPlus::JsValuePtr AdblockPlus::JsEngine::NewValue(bool val)

Powered by Google App Engine
This is Rietveld