1071 | | == [V8EnabledAtRuntime](i,m,a) == #V8EnabledAtRuntime |
1072 | | |
1073 | | Summary: In Chromium/V8, you can enable or disable a flag at runtime. |
1074 | | |
1075 | | Usage: The possible usage is [V8EnabledAtRuntime] or [V8EnabledAtRuntime=X], |
1076 | | where X is an arbitrary string that you want to use for identifying the flag getter. |
1077 | | [V8EnabledAtRuntime] can be specified on interfaces, methods or attributes: |
1078 | | {{{ |
1079 | | interface [ |
1080 | | V8EnabledAtRuntime |
1081 | | ] XXX { |
1082 | | }; |
1083 | | }}} |
1084 | | {{{ |
1085 | | interface XXX { |
1086 | | attribute [V8EnabledAtRuntime] DOMString str1; |
1087 | | attribute [V8EnabledAtRuntime=foo] DOMString str2; |
1088 | | [V8EnabledAtRuntime] void open1(); |
1089 | | [V8EnabledAtRuntime=foo] void open2(); |
1090 | | }; |
1091 | | }}} |
1092 | | |
1093 | | To make interfaces, methods or attributes enabled or disabled through the about:flags page of Chromium/V8, you can specify [V8EnabledAtRuntime]. |
1094 | | |
1095 | | If you specify [V8EnabledAtRuntime], you need to write "flag-binding" code |
1096 | | in WebCore/bindings/generic/RuntimeEnabledFeatures.h, WebCore/bindings/generic/RuntimeEnabledFeatures.cpp |
1097 | | and WebKit/chromium/src/WebRuntimeFeatures.cpp. |
1098 | | |
1099 | | The method names of a "flag-binding" code in WebCore/bindings/generic/RuntimeEnabledFeatures.h |
1100 | | are determined by the name of interfaces, methods or attributes by default. |
1101 | | You can change the method names by using [V8EnabledAtRuntime=X], where X becomes the method name base. |
1102 | | Refer to WebCore/bindings/generic/RuntimeEnabledFeatures.h, WebCore/bindings/generic/RuntimeEnabledFeatures.cpp |
1103 | | and WebKit/chromium/src/WebRuntimeFeatures.cpp for more details. |
1104 | | |
1105 | | If [V8EnabledAtRuntime] is specified on an interface, |
1106 | | it means that [V8EnabledAtRuntime] is specified on all the attributes and methods of the interface, |
1107 | | |
1108 | | == [V8EnabledPerContext](i,m,a) == #V8EnabledAtRuntime |
1109 | | |
1110 | | Summary: In Chromium/V8, you can enable or disable a flag per execution context (that is DOMWindow). |
1111 | | |
1112 | | If you specify [V8EnabledPerContext], you need to write "flag-binding" code |
1113 | | in WebCore/bindings/generic/ContextEnabledFeatures.h, WebCore/bindings/generic/ContextEnabledFeatures.cpp |
1114 | | The implementation can choose arbitrary decision logic. A typical approach is to ask FrameLoaderClient about its availability. |
1115 | | |
1116 | | Currently, V8EnabledPerContext is only effective for attributes on DOMWindow. |
1117 | | |
1118 | | == [CustomToJSObject](i), [JSCustomToJSObject](i), [V8CustomToJSObject](i), [SuppressToJSObject](i) == #CustomToJSObject |
1119 | | |
1120 | | Summary: They allow you to write custom toJS() or toV8(). |
1121 | | |
1122 | | Usage: They can be specified on interfaces: |
1123 | | {{{ |
1124 | | interface [ |
1125 | | CustomToJSObject |
1126 | | ] XXX { |
1127 | | }; |
1128 | | }}} |
1129 | | |
1130 | | * [JSCustomToJSObject] on an interface indicates that you can write custom toJS(). |
1131 | | * [V8CustomToJSObject] on an interface indicates that you can write custom toV8(). |
1132 | | * [CustomToJSObject] is equivalent to [JSCustomToJSObject, V8CustomToJSObject]. |
1133 | | |
1134 | | By default (i.e. without [*CustomToJSObject]), toJS() and toV8() are generated automatically. |
1135 | | |
1136 | | * With [CustomToJSObject] or [JSCustomToJSObject], you can write custom toJS() in WebCore/bindings/js/JSXXXCustom.cpp: |
1137 | | |
1138 | | {{{ |
1139 | | JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, XXX* impl) |
1140 | | { |
1141 | | ...; |
1142 | | } |
1143 | | }}} |
1144 | | * With [CustomToJSObject] or [V8CustomToJSObject], you can write custom toV8() in WebCore/bindings/v8/custom/V8XXXCustom.cpp: |
1145 | | |
1146 | | {{{ |
1147 | | v8::Handle<v8::Value> toV8(XXX* impl, bool forceNewObject) |
1148 | | { |
1149 | | ...; |
1150 | | } |
1151 | | }}} |
1152 | | * With [SuppressToJSObject], even the declarations of toJS()/toV8() are not generated. If you want to make sure that someone never calls toJS()/toV8(), you can use [SuppressToJSObject]. You might want to use [SuppressToJSObject] for mixins, where toJS()/toV8() won't work as expected. |
1153 | | |