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

Unified Diff: src/JsEngine.cpp

Issue 29416603: Issue 5034 - Part 2: Have NewCallback() return a plain JsValue (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Created April 18, 2017, 9:18 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
« no previous file with comments | « src/GlobalJsObject.cpp ('k') | src/WebRequestJsObject.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/JsEngine.cpp
===================================================================
--- a/src/JsEngine.cpp
+++ b/src/JsEngine.cpp
@@ -226,28 +226,28 @@
}
AdblockPlus::JsValuePtr AdblockPlus::JsEngine::NewObject()
{
const JsContext context(shared_from_this());
return JsValuePtr(new JsValue(shared_from_this(), v8::Object::New()));
}
-AdblockPlus::JsValuePtr AdblockPlus::JsEngine::NewCallback(
+AdblockPlus::JsValue AdblockPlus::JsEngine::NewCallback(
const v8::InvocationCallback& callback)
{
const JsContext context(shared_from_this());
// Note: we are leaking this weak pointer, no obvious way to destroy it when
// it's no longer used
std::weak_ptr<JsEngine>* data =
new std::weak_ptr<JsEngine>(shared_from_this());
v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(callback,
v8::External::New(data));
- return JsValuePtr(new JsValue(shared_from_this(), templ->GetFunction()));
+ return JsValue(shared_from_this(), templ->GetFunction());
}
AdblockPlus::JsEnginePtr AdblockPlus::JsEngine::FromArguments(const v8::Arguments& arguments)
{
const v8::Local<const v8::External> external =
v8::Local<const v8::External>::Cast(arguments.Data());
std::weak_ptr<JsEngine>* data =
static_cast<std::weak_ptr<JsEngine>*>(external->Value());
« no previous file with comments | « src/GlobalJsObject.cpp ('k') | src/WebRequestJsObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld