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

Unified Diff: src/GlobalJsObject.cpp

Issue 29416579: Issue 5034 - Part 1: Pass a JsValue directly to SetProperty() and return from GetProperty() (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Created April 18, 2017, 9:17 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.h ('k') | src/JsEngine.cpp » ('j') | src/JsEngine.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/GlobalJsObject.cpp
===================================================================
--- a/src/GlobalJsObject.cpp
+++ b/src/GlobalJsObject.cpp
@@ -63,23 +63,23 @@
}
std::string eventName = converted.front()->AsString();
converted.erase(converted.begin());
jsEngine->TriggerEvent(eventName, converted);
return v8::Undefined();
}
}
-JsValuePtr GlobalJsObject::Setup(JsEngine& jsEngine, const AppInfo& appInfo,
- const JsValuePtr& obj)
+JsValue& GlobalJsObject::Setup(JsEngine& jsEngine, const AppInfo& appInfo,
+ JsValue& obj)
{
- obj->SetProperty("setTimeout", jsEngine.NewCallback(::SetTimeoutCallback));
- obj->SetProperty("_triggerEvent", jsEngine.NewCallback(::TriggerEventCallback));
- obj->SetProperty("_fileSystem",
- FileSystemJsObject::Setup(jsEngine, jsEngine.NewObject()));
- obj->SetProperty("_webRequest",
- WebRequestJsObject::Setup(jsEngine, jsEngine.NewObject()));
- obj->SetProperty("console",
- ConsoleJsObject::Setup(jsEngine, jsEngine.NewObject()));
- obj->SetProperty("_appInfo",
- AppInfoJsObject::Setup(appInfo, jsEngine.NewObject()));
+ obj.SetProperty("setTimeout", *jsEngine.NewCallback(::SetTimeoutCallback));
+ obj.SetProperty("_triggerEvent", *jsEngine.NewCallback(::TriggerEventCallback));
+ obj.SetProperty("_fileSystem",
+ FileSystemJsObject::Setup(jsEngine, *jsEngine.NewObject()));
+ obj.SetProperty("_webRequest",
+ WebRequestJsObject::Setup(jsEngine, *jsEngine.NewObject()));
+ obj.SetProperty("console",
+ ConsoleJsObject::Setup(jsEngine, *jsEngine.NewObject()));
+ obj.SetProperty("_appInfo",
+ AppInfoJsObject::Setup(appInfo, *jsEngine.NewObject()));
return obj;
}
« no previous file with comments | « src/GlobalJsObject.h ('k') | src/JsEngine.cpp » ('j') | src/JsEngine.cpp » ('J')

Powered by Google App Engine
This is Rietveld