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

Unified Diff: src/JsValue.cpp

Issue 29451722: Issue 4907 - Update v8 to 5.7.278 in libadblockplus (Closed) Base URL: https://github.com/adblockplus/libadblockplus.git
Patch Set: add Xcode into readme Created June 2, 2017, 2:24 p.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
« src/JsEngine.cpp ('K') | « src/JsEngine.cpp ('k') | src/Utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/JsValue.cpp
diff --git a/src/JsValue.cpp b/src/JsValue.cpp
index ce08b5cae2a59b55f7d96f47f3a53d437a84ed3e..daff97a902e014a91b8f245232d087dfcdb9556e 100644
--- a/src/JsValue.cpp
+++ b/src/JsValue.cpp
@@ -27,7 +27,7 @@ using namespace AdblockPlus;
AdblockPlus::JsValue::JsValue(AdblockPlus::JsEnginePtr jsEngine,
v8::Handle<v8::Value> value)
: jsEngine(jsEngine),
- value(new v8::Persistent<v8::Value>(jsEngine->GetIsolate(), value))
+ value(new v8::Global<v8::Value>(jsEngine->GetIsolate(), value))
{
}
@@ -41,7 +41,7 @@ AdblockPlus::JsValue::JsValue(const JsValue& src)
: jsEngine(src.jsEngine)
{
const JsContext context(*src.jsEngine);
- value.reset(new v8::Persistent<v8::Value>(src.jsEngine->GetIsolate(), *src.value));
+ value.reset(new v8::Global<v8::Value>(src.jsEngine->GetIsolate(), *src.value));
}
AdblockPlus::JsValue::~JsValue()
@@ -49,7 +49,6 @@ AdblockPlus::JsValue::~JsValue()
if (value)
{
const JsContext context(*jsEngine);
- value->Dispose();
value.reset();
}
}
@@ -57,10 +56,16 @@ AdblockPlus::JsValue::~JsValue()
JsValue& AdblockPlus::JsValue::operator=(const JsValue& src)
{
const JsContext context(*src.jsEngine);
- if (value)
- value->Dispose();
jsEngine = src.jsEngine;
- value.reset(new v8::Persistent<v8::Value>(src.jsEngine->GetIsolate(), *src.value));
+ value.reset(new v8::Global<v8::Value>(src.jsEngine->GetIsolate(), *src.value));
+
+ return *this;
+}
+
+JsValue& AdblockPlus::JsValue::operator=(JsValue&& src)
+{
+ jsEngine = std::move(src.jsEngine);
+ value = std::move(src.value);
return *this;
}
@@ -213,7 +218,7 @@ void AdblockPlus::JsValue::SetProperty(const std::string& name, const JsValue& v
void AdblockPlus::JsValue::SetProperty(const std::string& name, bool val)
{
const JsContext context(*jsEngine);
- SetProperty(name, v8::Boolean::New(val));
+ SetProperty(name, v8::Boolean::New(jsEngine->GetIsolate(), val));
}
std::string AdblockPlus::JsValue::GetClass() const
« src/JsEngine.cpp ('K') | « src/JsEngine.cpp ('k') | src/Utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld