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

Side by Side Diff: gin/object_template_builder.cc

Issue 1161053002: Revert of gin: Use V8 Maybe APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@maybe-gin-converter
Patch Set: Created 5 years, 6 months 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
« no previous file with comments | « gin/modules/module_registry.cc ('k') | gin/shell/gin_main.cc » ('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 6
7 #include "gin/interceptor.h" 7 #include "gin/interceptor.h"
8 #include "gin/per_isolate_data.h" 8 #include "gin/per_isolate_data.h"
9 #include "gin/public/wrapper_info.h" 9 #include "gin/public/wrapper_info.h"
10 10
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 return; 86 return;
87 info.GetReturnValue().Set(0); 87 info.GetReturnValue().Set(0);
88 } 88 }
89 89
90 void NamedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info) { 90 void NamedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info) {
91 v8::Isolate* isolate = info.GetIsolate(); 91 v8::Isolate* isolate = info.GetIsolate();
92 NamedPropertyInterceptor* interceptor = 92 NamedPropertyInterceptor* interceptor =
93 NamedInterceptorFromV8(isolate, info.Holder()); 93 NamedInterceptorFromV8(isolate, info.Holder());
94 if (!interceptor) 94 if (!interceptor)
95 return; 95 return;
96 v8::Local<v8::Value> properties; 96 info.GetReturnValue().Set(v8::Local<v8::Array>::Cast(
97 if (!TryConvertToV8(isolate, interceptor->EnumerateNamedProperties(isolate), 97 ConvertToV8(isolate, interceptor->EnumerateNamedProperties(isolate))));
98 &properties))
99 return;
100 info.GetReturnValue().Set(v8::Local<v8::Array>::Cast(properties));
101 } 98 }
102 99
103 void IndexedPropertyGetter(uint32_t index, 100 void IndexedPropertyGetter(uint32_t index,
104 const v8::PropertyCallbackInfo<v8::Value>& info) { 101 const v8::PropertyCallbackInfo<v8::Value>& info) {
105 v8::Isolate* isolate = info.GetIsolate(); 102 v8::Isolate* isolate = info.GetIsolate();
106 IndexedPropertyInterceptor* interceptor = 103 IndexedPropertyInterceptor* interceptor =
107 IndexedInterceptorFromV8(isolate, info.Holder()); 104 IndexedInterceptorFromV8(isolate, info.Holder());
108 if (!interceptor) 105 if (!interceptor)
109 return; 106 return;
110 info.GetReturnValue().Set(interceptor->GetIndexedProperty(isolate, index)); 107 info.GetReturnValue().Set(interceptor->GetIndexedProperty(isolate, index));
(...skipping 11 matching lines...) Expand all
122 info.GetReturnValue().Set(value); 119 info.GetReturnValue().Set(value);
123 } 120 }
124 121
125 void IndexedPropertyEnumerator( 122 void IndexedPropertyEnumerator(
126 const v8::PropertyCallbackInfo<v8::Array>& info) { 123 const v8::PropertyCallbackInfo<v8::Array>& info) {
127 v8::Isolate* isolate = info.GetIsolate(); 124 v8::Isolate* isolate = info.GetIsolate();
128 IndexedPropertyInterceptor* interceptor = 125 IndexedPropertyInterceptor* interceptor =
129 IndexedInterceptorFromV8(isolate, info.Holder()); 126 IndexedInterceptorFromV8(isolate, info.Holder());
130 if (!interceptor) 127 if (!interceptor)
131 return; 128 return;
132 v8::Local<v8::Value> properties; 129 info.GetReturnValue().Set(v8::Local<v8::Array>::Cast(
133 if (!TryConvertToV8(isolate, interceptor->EnumerateIndexedProperties(isolate), 130 ConvertToV8(isolate, interceptor->EnumerateIndexedProperties(isolate))));
134 &properties))
135 return;
136 info.GetReturnValue().Set(v8::Local<v8::Array>::Cast(properties));
137 } 131 }
138 132
139 } // namespace 133 } // namespace
140 134
141 ObjectTemplateBuilder::ObjectTemplateBuilder(v8::Isolate* isolate) 135 ObjectTemplateBuilder::ObjectTemplateBuilder(v8::Isolate* isolate)
142 : isolate_(isolate), template_(v8::ObjectTemplate::New(isolate)) { 136 : isolate_(isolate), template_(v8::ObjectTemplate::New(isolate)) {
143 template_->SetInternalFieldCount(kNumberOfInternalFields); 137 template_->SetInternalFieldCount(kNumberOfInternalFields);
144 } 138 }
145 139
146 ObjectTemplateBuilder::~ObjectTemplateBuilder() { 140 ObjectTemplateBuilder::~ObjectTemplateBuilder() {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 return *this; 172 return *this;
179 } 173 }
180 174
181 v8::Local<v8::ObjectTemplate> ObjectTemplateBuilder::Build() { 175 v8::Local<v8::ObjectTemplate> ObjectTemplateBuilder::Build() {
182 v8::Local<v8::ObjectTemplate> result = template_; 176 v8::Local<v8::ObjectTemplate> result = template_;
183 template_.Clear(); 177 template_.Clear();
184 return result; 178 return result;
185 } 179 }
186 180
187 } // namespace gin 181 } // namespace gin
OLDNEW
« no previous file with comments | « gin/modules/module_registry.cc ('k') | gin/shell/gin_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698