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

Unified Diff: src/JsValue.cpp

Issue 5598762307158016: Issue 1550 - Get rid of V8ValueHolder.h (Closed)
Patch Set: Created Nov. 10, 2014, 9:18 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
« no previous file with comments | « src/JsEngine.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/JsValue.cpp
===================================================================
--- a/src/JsValue.cpp
+++ b/src/JsValue.cpp
@@ -25,18 +25,22 @@
AdblockPlus::JsValue::JsValue(AdblockPlus::JsEnginePtr jsEngine,
v8::Handle<v8::Value> value)
: jsEngine(jsEngine),
- value(jsEngine->isolate, value)
+ value(new v8::Persistent<v8::Value>(jsEngine->isolate, value))
{
}
-AdblockPlus::JsValue::JsValue(AdblockPlus::JsValuePtr value)
- : jsEngine(value->jsEngine),
- value(value->value)
+AdblockPlus::JsValue::JsValue(AdblockPlus::JsValue&& src)
+ : jsEngine(src.jsEngine),
+ value(std::move(src.value))
{
}
AdblockPlus::JsValue::~JsValue()
{
+ if (value)
+ {
+ value->Dispose();
+ }
}
bool AdblockPlus::JsValue::IsUndefined() const
@@ -163,7 +167,7 @@
v8::Local<v8::Value> AdblockPlus::JsValue::UnwrapValue() const
{
- return v8::Local<v8::Value>::New(jsEngine->isolate, value);
+ return v8::Local<v8::Value>::New(jsEngine->isolate, *value);
}
void AdblockPlus::JsValue::SetProperty(const std::string& name, const std::string& val)
@@ -208,7 +212,8 @@
const JsContext context(jsEngine);
if (!thisPtr)
{
- v8::Local<v8::Context> localContext = v8::Local<v8::Context>::New(jsEngine->isolate, jsEngine->context);
+ v8::Local<v8::Context> localContext = v8::Local<v8::Context>::New(
+ jsEngine->isolate, *jsEngine->context);
thisPtr = JsValuePtr(new JsValue(jsEngine, localContext->Global()));
}
if (!thisPtr->IsObject())
« no previous file with comments | « src/JsEngine.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld