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

Delta Between Two Patch Sets: src/AppInfoJsObject.cpp

Issue 10305024: Simplify context setup, set properties on the global object directly instead of using templates (Closed)
Left Patch Set: Created April 18, 2013, 6:26 a.m.
Right Patch Set: Unbitrotted patch Created April 18, 2013, 11:44 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
LEFTRIGHT
(no file at all)
1 #include <AdblockPlus/AppInfo.h> 1 #include <AdblockPlus/AppInfo.h>
2 #include <AdblockPlus/JsValue.h>
2 3
3 #include "AppInfoJsObject.h" 4 #include "AppInfoJsObject.h"
4 #include "Utils.h" 5 #include "Utils.h"
5 6
6 using namespace AdblockPlus; 7 using namespace AdblockPlus;
7 8
8 v8::Handle<v8::ObjectTemplate> AppInfoJsObject::Create(const AppInfo& appInfo) 9 JsValuePtr AppInfoJsObject::Setup(JsEngine& jsEngine, const AppInfo& appInfo,
10 JsValuePtr obj)
9 { 11 {
10 v8::HandleScope handleScope; 12 obj->SetProperty("id", appInfo.id);
11 const v8::Handle<v8::ObjectTemplate> infoObject = v8::ObjectTemplate::New(); 13 obj->SetProperty("version", appInfo.version);
12 infoObject->Set(v8::String::New("id"), Utils::ToV8String(appInfo.id)); 14 obj->SetProperty("name", appInfo.name);
13 infoObject->Set(v8::String::New("version"), 15 obj->SetProperty("platform", appInfo.platform);
14 Utils::ToV8String(appInfo.version)); 16 return obj;
15 infoObject->Set(v8::String::New("name"), Utils::ToV8String(appInfo.name));
16 infoObject->Set(v8::String::New("platform"),
17 Utils::ToV8String(appInfo.platform));
18 return handleScope.Close(infoObject);
19 } 17 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld