-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathactive_info.cpp
More file actions
64 lines (55 loc) · 2.3 KB
/
active_info.cpp
File metadata and controls
64 lines (55 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "active_info.hpp"
#include <v8.h>
namespace endor
{
namespace script_bindings
{
namespace webgl_bindings
{
using namespace std;
using namespace v8;
void WebGLActiveInfo::ConfigureFunctionTemplate(Isolate *isolate, Local<FunctionTemplate> tpl)
{
HandleScope scope(isolate);
Local<Context> context = isolate->GetCurrentContext();
Local<ObjectTemplate> instance = tpl->InstanceTemplate();
// Set up property accessors
InstanceReadonlyAccessor(isolate, instance, "name", &WebGLActiveInfo::NameGetter);
InstanceReadonlyAccessor(isolate, instance, "type", &WebGLActiveInfo::TypeGetter);
InstanceReadonlyAccessor(isolate, instance, "size", &WebGLActiveInfo::SizeGetter);
}
Local<Object> WebGLActiveInfo::NewInstance(Isolate *isolate,
const client_graphics::WebGLActiveInfo &activeInfo)
{
EscapableHandleScope scope(isolate);
return scope.Escape(WebGLActiveInfoBase::NewInstance(isolate,
make_shared<client_graphics::WebGLActiveInfo>(activeInfo))
.As<Object>());
}
WebGLActiveInfo::WebGLActiveInfo(Isolate *isolate, const FunctionCallbackInfo<Value> &args)
: ObjectWrap(isolate, args)
{
}
void WebGLActiveInfo::NameGetter(const PropertyCallbackInfo<Value> &info)
{
Isolate *isolate = info.GetIsolate();
HandleScope scope(isolate);
info.GetReturnValue().Set(String::NewFromUtf8(isolate,
handle()->name.c_str())
.ToLocalChecked());
}
void WebGLActiveInfo::TypeGetter(const PropertyCallbackInfo<Value> &info)
{
Isolate *isolate = info.GetIsolate();
HandleScope scope(isolate);
info.GetReturnValue().Set(Integer::New(isolate, handle()->type));
}
void WebGLActiveInfo::SizeGetter(const PropertyCallbackInfo<Value> &info)
{
Isolate *isolate = info.GetIsolate();
HandleScope scope(isolate);
info.GetReturnValue().Set(Integer::New(isolate, handle()->size));
}
} // namespace webgl
} // namespace script_bindings
} // namespace endor