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

Unified Diff: src/AppInfoJsObject.cpp

Issue 10305024: Simplify context setup, set properties on the global object directly instead of using templates (Closed)
Patch Set: Unbitrotted patch Created April 18, 2013, 11:44 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/AppInfoJsObject.cpp
===================================================================
--- a/src/AppInfoJsObject.cpp
+++ b/src/AppInfoJsObject.cpp
@@ -1,19 +1,17 @@
#include <AdblockPlus/AppInfo.h>
+#include <AdblockPlus/JsValue.h>
#include "AppInfoJsObject.h"
#include "Utils.h"
using namespace AdblockPlus;
-v8::Handle<v8::ObjectTemplate> AppInfoJsObject::Create(const AppInfo& appInfo)
+JsValuePtr AppInfoJsObject::Setup(JsEngine& jsEngine, const AppInfo& appInfo,
+ JsValuePtr obj)
{
- v8::HandleScope handleScope;
- const v8::Handle<v8::ObjectTemplate> infoObject = v8::ObjectTemplate::New();
- infoObject->Set(v8::String::New("id"), Utils::ToV8String(appInfo.id));
- infoObject->Set(v8::String::New("version"),
- Utils::ToV8String(appInfo.version));
- infoObject->Set(v8::String::New("name"), Utils::ToV8String(appInfo.name));
- infoObject->Set(v8::String::New("platform"),
- Utils::ToV8String(appInfo.platform));
- return handleScope.Close(infoObject);
+ obj->SetProperty("id", appInfo.id);
+ obj->SetProperty("version", appInfo.version);
+ obj->SetProperty("name", appInfo.name);
+ obj->SetProperty("platform", appInfo.platform);
+ return obj;
}
« no previous file with comments | « src/AppInfoJsObject.h ('k') | src/ConsoleJsObject.h » ('j') | src/GlobalJsObject.cpp » ('J')

Powered by Google App Engine
This is Rietveld