1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "gin/object_template_builder.h"
6 #include "gin/public/wrapper_info.h"
10 ObjectTemplateBuilder::ObjectTemplateBuilder(v8::Isolate
* isolate
)
11 : isolate_(isolate
), template_(v8::ObjectTemplate::New(isolate
)) {
12 template_
->SetInternalFieldCount(kNumberOfInternalFields
);
15 ObjectTemplateBuilder::~ObjectTemplateBuilder() {
18 ObjectTemplateBuilder
& ObjectTemplateBuilder::SetImpl(
19 const base::StringPiece
& name
, v8::Handle
<v8::Data
> val
) {
20 template_
->Set(StringToSymbol(isolate_
, name
), val
);
24 ObjectTemplateBuilder
& ObjectTemplateBuilder::SetPropertyImpl(
25 const base::StringPiece
& name
, v8::Handle
<v8::FunctionTemplate
> getter
,
26 v8::Handle
<v8::FunctionTemplate
> setter
) {
27 template_
->SetAccessorProperty(StringToSymbol(isolate_
, name
), getter
,
32 v8::Local
<v8::ObjectTemplate
> ObjectTemplateBuilder::Build() {
33 v8::Local
<v8::ObjectTemplate
> result
= template_
;