OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project 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 #ifndef V8_API_NATIVES_H_ | 5 #ifndef V8_API_NATIVES_H_ |
6 #define V8_API_NATIVES_H_ | 6 #define V8_API_NATIVES_H_ |
7 | 7 |
8 #include "src/handles.h" | 8 #include "src/handles.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
11 namespace internal { | 11 namespace internal { |
12 | 12 |
13 class ApiNatives { | 13 class ApiNatives { |
14 public: | 14 public: |
15 MUST_USE_RESULT static MaybeHandle<JSFunction> InstantiateFunction( | 15 MUST_USE_RESULT static MaybeHandle<JSFunction> InstantiateFunction( |
16 Handle<FunctionTemplateInfo> data); | 16 Handle<FunctionTemplateInfo> data); |
| 17 |
17 MUST_USE_RESULT static MaybeHandle<JSObject> InstantiateObject( | 18 MUST_USE_RESULT static MaybeHandle<JSObject> InstantiateObject( |
18 Handle<ObjectTemplateInfo> data); | 19 Handle<ObjectTemplateInfo> data); |
| 20 |
19 MUST_USE_RESULT static MaybeHandle<FunctionTemplateInfo> ConfigureInstance( | 21 MUST_USE_RESULT static MaybeHandle<FunctionTemplateInfo> ConfigureInstance( |
20 Isolate* isolate, Handle<FunctionTemplateInfo> instance, | 22 Isolate* isolate, Handle<FunctionTemplateInfo> instance, |
21 Handle<JSObject> data); | 23 Handle<JSObject> data); |
22 | 24 |
23 enum ApiInstanceType { | 25 enum ApiInstanceType { |
24 JavaScriptObjectType, | 26 JavaScriptObjectType, |
25 GlobalObjectType, | 27 GlobalObjectType, |
26 GlobalProxyType | 28 GlobalProxyType |
27 }; | 29 }; |
28 | 30 |
29 static Handle<JSFunction> CreateApiFunction(Isolate* isolate, | 31 static Handle<JSFunction> CreateApiFunction(Isolate* isolate, |
30 Handle<FunctionTemplateInfo> obj, | 32 Handle<FunctionTemplateInfo> obj, |
31 Handle<Object> prototype, | 33 Handle<Object> prototype, |
32 ApiInstanceType instance_type); | 34 ApiInstanceType instance_type); |
| 35 |
| 36 static void AddDataProperty(Isolate* isolate, Handle<TemplateInfo> info, |
| 37 Handle<Name> name, Handle<Object> value, |
| 38 PropertyAttributes attributes); |
| 39 |
| 40 static void AddAccessorProperty(Isolate* isolate, Handle<TemplateInfo> info, |
| 41 Handle<Name> name, |
| 42 Handle<FunctionTemplateInfo> getter, |
| 43 Handle<FunctionTemplateInfo> setter, |
| 44 PropertyAttributes attributes); |
| 45 |
| 46 static void AddNativeDataProperty(Isolate* isolate, Handle<TemplateInfo> info, |
| 47 Handle<AccessorInfo> property); |
33 }; | 48 }; |
34 | 49 |
35 } // namespace internal | 50 } // namespace internal |
36 } // namespace v8 | 51 } // namespace v8 |
37 | 52 |
38 #endif | 53 #endif |
OLD | NEW |