OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 v8::AccessorNameSetterCallback setter = attribute.setter; | 66 v8::AccessorNameSetterCallback setter = attribute.setter; |
67 v8::Local<v8::Value> data = | 67 v8::Local<v8::Value> data = |
68 v8::External::New(isolate, const_cast<WrapperTypeInfo*>(attribute.data)); | 68 v8::External::New(isolate, const_cast<WrapperTypeInfo*>(attribute.data)); |
69 | 69 |
70 DCHECK(attribute.property_location_configuration); | 70 DCHECK(attribute.property_location_configuration); |
71 if (attribute.property_location_configuration & | 71 if (attribute.property_location_configuration & |
72 V8DOMConfiguration::kOnInstance) { | 72 V8DOMConfiguration::kOnInstance) { |
73 instance_template->SetNativeDataProperty( | 73 instance_template->SetNativeDataProperty( |
74 name, getter, setter, data, | 74 name, getter, setter, data, |
75 static_cast<v8::PropertyAttribute>(attribute.attribute), | 75 static_cast<v8::PropertyAttribute>(attribute.attribute), |
76 v8::Local<v8::AccessorSignature>(), v8::DEFAULT); | 76 v8::Local<v8::AccessorSignature>()); |
77 } | 77 } |
78 if (attribute.property_location_configuration & | 78 if (attribute.property_location_configuration & |
79 V8DOMConfiguration::kOnPrototype) { | 79 V8DOMConfiguration::kOnPrototype) { |
80 prototype_template->SetNativeDataProperty( | 80 prototype_template->SetNativeDataProperty( |
81 name, getter, setter, data, | 81 name, getter, setter, data, |
82 static_cast<v8::PropertyAttribute>(attribute.attribute), | 82 static_cast<v8::PropertyAttribute>(attribute.attribute), |
83 v8::Local<v8::AccessorSignature>(), v8::DEFAULT); | 83 v8::Local<v8::AccessorSignature>()); |
84 } | 84 } |
85 if (attribute.property_location_configuration & | 85 if (attribute.property_location_configuration & |
86 V8DOMConfiguration::kOnInterface) | 86 V8DOMConfiguration::kOnInterface) |
87 NOTREACHED(); | 87 NOTREACHED(); |
88 } | 88 } |
89 | 89 |
90 void InstallAttributeInternal( | 90 void InstallAttributeInternal( |
91 v8::Isolate* isolate, | 91 v8::Isolate* isolate, |
92 v8::Local<v8::Object> instance, | 92 v8::Local<v8::Object> instance, |
93 v8::Local<v8::Object> prototype, | 93 v8::Local<v8::Object> prototype, |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 v8::Local<FunctionOrTemplate> getter = | 247 v8::Local<FunctionOrTemplate> getter = |
248 CreateAccessorFunctionOrTemplate<FunctionOrTemplate>( | 248 CreateAccessorFunctionOrTemplate<FunctionOrTemplate>( |
249 isolate, getter_callback, cached_property_key, data, signature, 0); | 249 isolate, getter_callback, cached_property_key, data, signature, 0); |
250 v8::Local<FunctionOrTemplate> setter = | 250 v8::Local<FunctionOrTemplate> setter = |
251 CreateAccessorFunctionOrTemplate<FunctionOrTemplate>( | 251 CreateAccessorFunctionOrTemplate<FunctionOrTemplate>( |
252 isolate, setter_callback, nullptr, data, signature, 1); | 252 isolate, setter_callback, nullptr, data, signature, 1); |
253 if (accessor.property_location_configuration & | 253 if (accessor.property_location_configuration & |
254 V8DOMConfiguration::kOnInstance) { | 254 V8DOMConfiguration::kOnInstance) { |
255 instance_or_template->SetAccessorProperty( | 255 instance_or_template->SetAccessorProperty( |
256 name, getter, setter, | 256 name, getter, setter, |
257 static_cast<v8::PropertyAttribute>(accessor.attribute), v8::DEFAULT); | 257 static_cast<v8::PropertyAttribute>(accessor.attribute)); |
258 } | 258 } |
259 if (accessor.property_location_configuration & | 259 if (accessor.property_location_configuration & |
260 V8DOMConfiguration::kOnPrototype) { | 260 V8DOMConfiguration::kOnPrototype) { |
261 prototype_or_template->SetAccessorProperty( | 261 prototype_or_template->SetAccessorProperty( |
262 name, getter, setter, | 262 name, getter, setter, |
263 static_cast<v8::PropertyAttribute>(accessor.attribute), v8::DEFAULT); | 263 static_cast<v8::PropertyAttribute>(accessor.attribute)); |
264 } | 264 } |
265 } | 265 } |
266 if (accessor.property_location_configuration & | 266 if (accessor.property_location_configuration & |
267 V8DOMConfiguration::kOnInterface) { | 267 V8DOMConfiguration::kOnInterface) { |
268 // Attributes installed on the interface object must be static | 268 // Attributes installed on the interface object must be static |
269 // attributes, so no need to specify a signature, i.e. no need to do | 269 // attributes, so no need to specify a signature, i.e. no need to do |
270 // type check against a holder. | 270 // type check against a holder. |
271 v8::Local<FunctionOrTemplate> getter = | 271 v8::Local<FunctionOrTemplate> getter = |
272 CreateAccessorFunctionOrTemplate<FunctionOrTemplate>( | 272 CreateAccessorFunctionOrTemplate<FunctionOrTemplate>( |
273 isolate, getter_callback, nullptr, data, v8::Local<v8::Signature>(), | 273 isolate, getter_callback, nullptr, data, v8::Local<v8::Signature>(), |
274 0); | 274 0); |
275 v8::Local<FunctionOrTemplate> setter = | 275 v8::Local<FunctionOrTemplate> setter = |
276 CreateAccessorFunctionOrTemplate<FunctionOrTemplate>( | 276 CreateAccessorFunctionOrTemplate<FunctionOrTemplate>( |
277 isolate, setter_callback, nullptr, data, v8::Local<v8::Signature>(), | 277 isolate, setter_callback, nullptr, data, v8::Local<v8::Signature>(), |
278 1); | 278 1); |
279 interface_or_template->SetAccessorProperty( | 279 interface_or_template->SetAccessorProperty( |
280 name, getter, setter, | 280 name, getter, setter, |
281 static_cast<v8::PropertyAttribute>(accessor.attribute), v8::DEFAULT); | 281 static_cast<v8::PropertyAttribute>(accessor.attribute)); |
282 } | 282 } |
283 } | 283 } |
284 | 284 |
285 v8::Local<v8::Primitive> ValueForConstant( | 285 v8::Local<v8::Primitive> ValueForConstant( |
286 v8::Isolate* isolate, | 286 v8::Isolate* isolate, |
287 const V8DOMConfiguration::ConstantConfiguration& constant) { | 287 const V8DOMConfiguration::ConstantConfiguration& constant) { |
288 v8::Local<v8::Primitive> value; | 288 v8::Local<v8::Primitive> value; |
289 switch (constant.type) { | 289 switch (constant.type) { |
290 case V8DOMConfiguration::kConstantTypeShort: | 290 case V8DOMConfiguration::kConstantTypeShort: |
291 case V8DOMConfiguration::kConstantTypeLong: | 291 case V8DOMConfiguration::kConstantTypeLong: |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 v8::Isolate* isolate, | 694 v8::Isolate* isolate, |
695 v8::Local<v8::ObjectTemplate> object_template, | 695 v8::Local<v8::ObjectTemplate> object_template, |
696 const char* class_string) { | 696 const char* class_string) { |
697 object_template->Set( | 697 object_template->Set( |
698 v8::Symbol::GetToStringTag(isolate), | 698 v8::Symbol::GetToStringTag(isolate), |
699 V8AtomicString(isolate, class_string), | 699 V8AtomicString(isolate, class_string), |
700 static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); | 700 static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); |
701 } | 701 } |
702 | 702 |
703 } // namespace blink | 703 } // namespace blink |
OLD | NEW |