| 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 isolate, currentWorldType); | 173 isolate, currentWorldType); |
| 174 UNUSED_PARAM(defaultSignature); | 174 UNUSED_PARAM(defaultSignature); |
| 175 functionTemplate->SetCallHandler(V8TestExtendedEvent::constructorCallback); | 175 functionTemplate->SetCallHandler(V8TestExtendedEvent::constructorCallback); |
| 176 functionTemplate->SetLength(1); | 176 functionTemplate->SetLength(1); |
| 177 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); | 177 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); |
| 178 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); | 178 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); |
| 179 UNUSED_PARAM(instanceTemplate); | 179 UNUSED_PARAM(instanceTemplate); |
| 180 UNUSED_PARAM(prototypeTemplate); | 180 UNUSED_PARAM(prototypeTemplate); |
| 181 | 181 |
| 182 // Custom toString template | 182 // Custom toString template |
| 183 functionTemplate->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::c
urrent()->toStringTemplate()); | 183 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); |
| 184 return functionTemplate; | 184 return functionTemplate; |
| 185 } | 185 } |
| 186 | 186 |
| 187 v8::Handle<v8::FunctionTemplate> V8TestExtendedEvent::GetTemplate(v8::Isolate* i
solate, WrapperWorldType currentWorldType) | 187 v8::Handle<v8::FunctionTemplate> V8TestExtendedEvent::GetTemplate(v8::Isolate* i
solate, WrapperWorldType currentWorldType) |
| 188 { | 188 { |
| 189 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 189 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 190 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 190 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
| 191 if (result != data->templateMap(currentWorldType).end()) | 191 if (result != data->templateMap(currentWorldType).end()) |
| 192 return result->value.newLocal(isolate); | 192 return result->value.newLocal(isolate); |
| 193 | 193 |
| 194 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 194 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 195 v8::HandleScope handleScope(isolate); | 195 v8::EscapableHandleScope handleScope(isolate); |
| 196 v8::Handle<v8::FunctionTemplate> templ = | 196 v8::Local<v8::FunctionTemplate> templ = |
| 197 ConfigureV8TestExtendedEventTemplate(data->rawTemplate(&wrapperTypeInfo,
currentWorldType), isolate, currentWorldType); | 197 ConfigureV8TestExtendedEventTemplate(data->rawTemplate(&wrapperTypeInfo,
currentWorldType), isolate, currentWorldType); |
| 198 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 198 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 199 return handleScope.Close(templ); | 199 return handleScope.Escape(templ); |
| 200 } | 200 } |
| 201 | 201 |
| 202 bool V8TestExtendedEvent::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate
* isolate, WrapperWorldType currentWorldType) | 202 bool V8TestExtendedEvent::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate
* isolate, WrapperWorldType currentWorldType) |
| 203 { | 203 { |
| 204 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); | 204 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); |
| 205 } | 205 } |
| 206 | 206 |
| 207 bool V8TestExtendedEvent::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v
8::Isolate* isolate) | 207 bool V8TestExtendedEvent::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v
8::Isolate* isolate) |
| 208 { | 208 { |
| 209 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) | 209 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 237 } | 237 } |
| 238 | 238 |
| 239 template<> | 239 template<> |
| 240 v8::Handle<v8::Value> toV8NoInline(Event* impl, v8::Handle<v8::Object> creationC
ontext, v8::Isolate* isolate) | 240 v8::Handle<v8::Value> toV8NoInline(Event* impl, v8::Handle<v8::Object> creationC
ontext, v8::Isolate* isolate) |
| 241 { | 241 { |
| 242 return toV8(impl, creationContext, isolate); | 242 return toV8(impl, creationContext, isolate); |
| 243 } | 243 } |
| 244 | 244 |
| 245 } // namespace WebCore | 245 } // namespace WebCore |
| 246 #endif // ENABLE(TEST) | 246 #endif // ENABLE(TEST) |
| OLD | NEW |