Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: gin/object_template_builder.cc

Issue 113893005: [gin] Introduce Wrappable::GetObjectTemplate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gin/isolate_holder.cc ('k') | gin/wrappable.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gin/object_template_builder.h" 5 #include "gin/object_template_builder.h"
6 #include "gin/public/wrapper_info.h"
6 7
7 namespace gin { 8 namespace gin {
8 9
9 ObjectTemplateBuilder::ObjectTemplateBuilder(v8::Isolate* isolate) 10 ObjectTemplateBuilder::ObjectTemplateBuilder(v8::Isolate* isolate)
10 : isolate_(isolate), template_(v8::ObjectTemplate::New(isolate)) { 11 : isolate_(isolate), template_(v8::ObjectTemplate::New(isolate)) {
12 template_->SetInternalFieldCount(kNumberOfInternalFields);
11 } 13 }
12 14
13 ObjectTemplateBuilder::~ObjectTemplateBuilder() { 15 ObjectTemplateBuilder::~ObjectTemplateBuilder() {
14 } 16 }
15 17
16 ObjectTemplateBuilder& ObjectTemplateBuilder::SetImpl( 18 ObjectTemplateBuilder& ObjectTemplateBuilder::SetImpl(
17 const base::StringPiece& name, v8::Handle<v8::Data> val) { 19 const base::StringPiece& name, v8::Handle<v8::Data> val) {
18 template_->Set(StringToSymbol(isolate_, name), val); 20 template_->Set(StringToSymbol(isolate_, name), val);
19 return *this; 21 return *this;
20 } 22 }
21 23
22 ObjectTemplateBuilder& ObjectTemplateBuilder::SetPropertyImpl( 24 ObjectTemplateBuilder& ObjectTemplateBuilder::SetPropertyImpl(
23 const base::StringPiece& name, v8::Handle<v8::FunctionTemplate> getter, 25 const base::StringPiece& name, v8::Handle<v8::FunctionTemplate> getter,
24 v8::Handle<v8::FunctionTemplate> setter) { 26 v8::Handle<v8::FunctionTemplate> setter) {
25 template_->SetAccessorProperty(StringToSymbol(isolate_, name), getter, 27 template_->SetAccessorProperty(StringToSymbol(isolate_, name), getter,
26 setter); 28 setter);
27 return *this; 29 return *this;
28 } 30 }
29 31
30 v8::Local<v8::ObjectTemplate> ObjectTemplateBuilder::Build() { 32 v8::Local<v8::ObjectTemplate> ObjectTemplateBuilder::Build() {
31 v8::Local<v8::ObjectTemplate> result = template_; 33 v8::Local<v8::ObjectTemplate> result = template_;
32 template_.Clear(); 34 template_.Clear();
33 return result; 35 return result;
34 } 36 }
35 37
36 } // namespace gin 38 } // namespace gin
OLDNEW
« no previous file with comments | « gin/isolate_holder.cc ('k') | gin/wrappable.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698