Revert of https://codereview.chromium.org/94133003/
[chromium-blink-merge.git] / gin / object_template_builder.cc
blob3a148e77818b363445a4dcf2aae72c6b988bd76a
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"
7 namespace gin {
9 ObjectTemplateBuilder::ObjectTemplateBuilder(v8::Isolate* isolate)
10 : isolate_(isolate), template_(v8::ObjectTemplate::New(isolate)) {
13 ObjectTemplateBuilder::~ObjectTemplateBuilder() {
16 ObjectTemplateBuilder& ObjectTemplateBuilder::SetImpl(
17 const base::StringPiece& name, v8::Handle<v8::Data> val) {
18 template_->Set(StringToSymbol(isolate_, name), val);
19 return *this;
22 v8::Local<v8::ObjectTemplate> ObjectTemplateBuilder::Build() {
23 v8::Local<v8::ObjectTemplate> result = template_;
24 template_.Clear();
25 return result;
28 } // namespace gin