| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 114 |
| 115 v8::Local<v8::ObjectTemplate> instanceTemplate = result->InstanceTemplate(); | 115 v8::Local<v8::ObjectTemplate> instanceTemplate = result->InstanceTemplate(); |
| 116 instanceTemplate->SetInternalFieldCount(V8TestInterfaceEventTarget::internal
FieldCount); | 116 instanceTemplate->SetInternalFieldCount(V8TestInterfaceEventTarget::internal
FieldCount); |
| 117 result->SetClassName(v8::String::NewFromUtf8(isolate, "TestInterfaceEventTar
get", v8::String::kInternalizedString)); | 117 result->SetClassName(v8::String::NewFromUtf8(isolate, "TestInterfaceEventTar
get", v8::String::kInternalizedString)); |
| 118 result->Inherit(V8TestInterfaceEventTarget::domTemplate(isolate, currentWorl
dType)); | 118 result->Inherit(V8TestInterfaceEventTarget::domTemplate(isolate, currentWorl
dType)); |
| 119 data->setPrivateTemplate(currentWorldType, &privateTemplateUniqueKey, result
); | 119 data->setPrivateTemplate(currentWorldType, &privateTemplateUniqueKey, result
); |
| 120 | 120 |
| 121 return scope.Escape(result); | 121 return scope.Escape(result); |
| 122 } | 122 } |
| 123 | 123 |
| 124 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfaceEventTargetTempl
ate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, Wra
pperWorldType currentWorldType) | 124 static void configureV8TestInterfaceEventTargetTemplate(v8::Handle<v8::FunctionT
emplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldTy
pe) |
| 125 { | 125 { |
| 126 functionTemplate->ReadOnlyPrototype(); | 126 functionTemplate->ReadOnlyPrototype(); |
| 127 | 127 |
| 128 v8::Local<v8::Signature> defaultSignature; | 128 v8::Local<v8::Signature> defaultSignature; |
| 129 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceEventTarget", V8EventTarget::domTemplate(isolate, currentWorl
dType), V8TestInterfaceEventTarget::internalFieldCount, | 129 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceEventTarget", V8EventTarget::domTemplate(isolate, currentWorl
dType), V8TestInterfaceEventTarget::internalFieldCount, |
| 130 0, 0, | 130 0, 0, |
| 131 0, 0, | 131 0, 0, |
| 132 0, 0, | 132 0, 0, |
| 133 isolate, currentWorldType); | 133 isolate, currentWorldType); |
| 134 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | 134 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); |
| 135 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | 135 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); |
| 136 | 136 |
| 137 // Custom toString template | 137 // Custom toString template |
| 138 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); | 138 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); |
| 139 return functionTemplate; | |
| 140 } | 139 } |
| 141 | 140 |
| 142 v8::Handle<v8::FunctionTemplate> V8TestInterfaceEventTarget::domTemplate(v8::Iso
late* isolate, WrapperWorldType currentWorldType) | 141 v8::Handle<v8::FunctionTemplate> V8TestInterfaceEventTarget::domTemplate(v8::Iso
late* isolate, WrapperWorldType currentWorldType) |
| 143 { | 142 { |
| 144 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 143 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 145 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 144 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
| 146 if (result != data->templateMap(currentWorldType).end()) | 145 if (result != data->templateMap(currentWorldType).end()) |
| 147 return result->value.newLocal(isolate); | 146 return result->value.newLocal(isolate); |
| 148 | 147 |
| 149 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 148 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 150 v8::EscapableHandleScope handleScope(isolate); | 149 v8::EscapableHandleScope handleScope(isolate); |
| 151 v8::Local<v8::FunctionTemplate> templ = | 150 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); |
| 152 ConfigureV8TestInterfaceEventTargetTemplate(data->rawDOMTemplate(&wrappe
rTypeInfo, currentWorldType), isolate, currentWorldType); | 151 configureV8TestInterfaceEventTargetTemplate(templ, isolate, currentWorldType
); |
| 153 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 152 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 154 return handleScope.Escape(templ); | 153 return handleScope.Escape(templ); |
| 155 } | 154 } |
| 156 | 155 |
| 157 bool V8TestInterfaceEventTarget::hasInstance(v8::Handle<v8::Value> jsValue, v8::
Isolate* isolate, WrapperWorldType currentWorldType) | 156 bool V8TestInterfaceEventTarget::hasInstance(v8::Handle<v8::Value> jsValue, v8::
Isolate* isolate, WrapperWorldType currentWorldType) |
| 158 { | 157 { |
| 159 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); | 158 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); |
| 160 } | 159 } |
| 161 | 160 |
| 162 bool V8TestInterfaceEventTarget::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsV
alue, v8::Isolate* isolate) | 161 bool V8TestInterfaceEventTarget::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsV
alue, v8::Isolate* isolate) |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 fromInternalPointer(object)->deref(); | 195 fromInternalPointer(object)->deref(); |
| 197 } | 196 } |
| 198 | 197 |
| 199 template<> | 198 template<> |
| 200 v8::Handle<v8::Value> toV8NoInline(TestInterfaceEventTarget* impl, v8::Handle<v8
::Object> creationContext, v8::Isolate* isolate) | 199 v8::Handle<v8::Value> toV8NoInline(TestInterfaceEventTarget* impl, v8::Handle<v8
::Object> creationContext, v8::Isolate* isolate) |
| 201 { | 200 { |
| 202 return toV8(impl, creationContext, isolate); | 201 return toV8(impl, creationContext, isolate); |
| 203 } | 202 } |
| 204 | 203 |
| 205 } // namespace WebCore | 204 } // namespace WebCore |
| OLD | NEW |