OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 105 |
106 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr
opertyCallbackInfo<v8::Value>& info) | 106 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr
opertyCallbackInfo<v8::Value>& info) |
107 { | 107 { |
108 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 108 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
109 TestSpecialOperationsNotEnumerableV8Internal::namedPropertyGetter(name, info
); | 109 TestSpecialOperationsNotEnumerableV8Internal::namedPropertyGetter(name, info
); |
110 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 110 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
111 } | 111 } |
112 | 112 |
113 } // namespace TestSpecialOperationsNotEnumerableV8Internal | 113 } // namespace TestSpecialOperationsNotEnumerableV8Internal |
114 | 114 |
115 static void configureV8TestSpecialOperationsNotEnumerableTemplate(v8::Handle<v8:
:FunctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType curr
entWorldType) | 115 static void configureV8TestSpecialOperationsNotEnumerableTemplate(v8::Handle<v8:
:FunctionTemplate> functionTemplate, v8::Isolate* isolate) |
116 { | 116 { |
117 functionTemplate->ReadOnlyPrototype(); | 117 functionTemplate->ReadOnlyPrototype(); |
118 | 118 |
119 v8::Local<v8::Signature> defaultSignature; | 119 v8::Local<v8::Signature> defaultSignature; |
120 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestSpecialOperationsNotEnumerable", v8::Local<v8::FunctionTemplate>(), V8
TestSpecialOperationsNotEnumerable::internalFieldCount, | 120 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestSpecialOperationsNotEnumerable", v8::Local<v8::FunctionTemplate>(), V8
TestSpecialOperationsNotEnumerable::internalFieldCount, |
121 0, 0, | 121 0, 0, |
122 0, 0, | 122 0, 0, |
123 0, 0, | 123 0, 0, |
124 isolate, currentWorldType); | 124 isolate); |
125 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | 125 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); |
126 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | 126 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); |
127 functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestSpecialO
perationsNotEnumerableV8Internal::indexedPropertyGetterCallback, 0, 0, 0, 0); | 127 functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestSpecialO
perationsNotEnumerableV8Internal::indexedPropertyGetterCallback, 0, 0, 0, 0); |
128 functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestSpecialOpe
rationsNotEnumerableV8Internal::namedPropertyGetterCallback, 0, 0, 0, 0); | 128 functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestSpecialOpe
rationsNotEnumerableV8Internal::namedPropertyGetterCallback, 0, 0, 0, 0); |
129 | 129 |
130 // Custom toString template | 130 // Custom toString template |
131 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); | 131 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); |
132 } | 132 } |
133 | 133 |
134 v8::Handle<v8::FunctionTemplate> V8TestSpecialOperationsNotEnumerable::domTempla
te(v8::Isolate* isolate, WrapperWorldType currentWorldType) | 134 v8::Handle<v8::FunctionTemplate> V8TestSpecialOperationsNotEnumerable::domTempla
te(v8::Isolate* isolate) |
135 { | 135 { |
136 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 136 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
137 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 137 V8PerIsolateData::TemplateMap::iterator result = data->templateMap().find(&w
rapperTypeInfo); |
138 if (result != data->templateMap(currentWorldType).end()) | 138 if (result != data->templateMap().end()) |
139 return result->value.newLocal(isolate); | 139 return result->value.newLocal(isolate); |
140 | 140 |
141 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 141 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
142 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); | 142 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); |
143 configureV8TestSpecialOperationsNotEnumerableTemplate(templ, isolate, curren
tWorldType); | 143 configureV8TestSpecialOperationsNotEnumerableTemplate(templ, isolate); |
144 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 144 data->templateMap().add(&wrapperTypeInfo, UnsafePersistent<v8::FunctionTempl
ate>(isolate, templ)); |
145 return templ; | 145 return templ; |
146 } | 146 } |
147 | 147 |
148 bool V8TestSpecialOperationsNotEnumerable::hasInstance(v8::Handle<v8::Value> jsV
alue, v8::Isolate* isolate) | 148 bool V8TestSpecialOperationsNotEnumerable::hasInstance(v8::Handle<v8::Value> jsV
alue, v8::Isolate* isolate) |
149 { | 149 { |
150 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e); | 150 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e); |
151 } | 151 } |
152 | 152 |
153 v8::Handle<v8::Object> V8TestSpecialOperationsNotEnumerable::findInstanceInProto
typeChain(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate) | 153 v8::Handle<v8::Object> V8TestSpecialOperationsNotEnumerable::findInstanceInProto
typeChain(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate) |
154 { | 154 { |
(...skipping 30 matching lines...) Expand all Loading... |
185 fromInternalPointer(object)->deref(); | 185 fromInternalPointer(object)->deref(); |
186 } | 186 } |
187 | 187 |
188 template<> | 188 template<> |
189 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsNotEnumerable* impl, v8:
:Handle<v8::Object> creationContext, v8::Isolate* isolate) | 189 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsNotEnumerable* impl, v8:
:Handle<v8::Object> creationContext, v8::Isolate* isolate) |
190 { | 190 { |
191 return toV8(impl, creationContext, isolate); | 191 return toV8(impl, creationContext, isolate); |
192 } | 192 } |
193 | 193 |
194 } // namespace WebCore | 194 } // namespace WebCore |
OLD | NEW |