| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 isolate, currentWorldType); | 161 isolate, currentWorldType); |
| 162 UNUSED_PARAM(defaultSignature); | 162 UNUSED_PARAM(defaultSignature); |
| 163 functionTemplate->SetCallHandler(V8TestEventConstructor::constructorCallback
); | 163 functionTemplate->SetCallHandler(V8TestEventConstructor::constructorCallback
); |
| 164 functionTemplate->SetLength(1); | 164 functionTemplate->SetLength(1); |
| 165 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); | 165 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); |
| 166 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); | 166 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); |
| 167 UNUSED_PARAM(instanceTemplate); | 167 UNUSED_PARAM(instanceTemplate); |
| 168 UNUSED_PARAM(prototypeTemplate); | 168 UNUSED_PARAM(prototypeTemplate); |
| 169 | 169 |
| 170 // Custom toString template | 170 // Custom toString template |
| 171 functionTemplate->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::c
urrent()->toStringTemplate()); | 171 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); |
| 172 return functionTemplate; | 172 return functionTemplate; |
| 173 } | 173 } |
| 174 | 174 |
| 175 v8::Handle<v8::FunctionTemplate> V8TestEventConstructor::GetTemplate(v8::Isolate
* isolate, WrapperWorldType currentWorldType) | 175 v8::Handle<v8::FunctionTemplate> V8TestEventConstructor::GetTemplate(v8::Isolate
* isolate, WrapperWorldType currentWorldType) |
| 176 { | 176 { |
| 177 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 177 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 178 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 178 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
| 179 if (result != data->templateMap(currentWorldType).end()) | 179 if (result != data->templateMap(currentWorldType).end()) |
| 180 return result->value.newLocal(isolate); | 180 return result->value.newLocal(isolate); |
| 181 | 181 |
| 182 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 182 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 183 v8::HandleScope handleScope(isolate); | 183 v8::EscapableHandleScope handleScope(isolate); |
| 184 v8::Handle<v8::FunctionTemplate> templ = | 184 v8::Local<v8::FunctionTemplate> templ = |
| 185 ConfigureV8TestEventConstructorTemplate(data->rawTemplate(&wrapperTypeIn
fo, currentWorldType), isolate, currentWorldType); | 185 ConfigureV8TestEventConstructorTemplate(data->rawTemplate(&wrapperTypeIn
fo, currentWorldType), isolate, currentWorldType); |
| 186 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 186 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 187 return handleScope.Close(templ); | 187 return handleScope.Escape(templ); |
| 188 } | 188 } |
| 189 | 189 |
| 190 bool V8TestEventConstructor::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isol
ate* isolate, WrapperWorldType currentWorldType) | 190 bool V8TestEventConstructor::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isol
ate* isolate, WrapperWorldType currentWorldType) |
| 191 { | 191 { |
| 192 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); | 192 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); |
| 193 } | 193 } |
| 194 | 194 |
| 195 bool V8TestEventConstructor::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue
, v8::Isolate* isolate) | 195 bool V8TestEventConstructor::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue
, v8::Isolate* isolate) |
| 196 { | 196 { |
| 197 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) | 197 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 224 fromInternalPointer(object)->deref(); | 224 fromInternalPointer(object)->deref(); |
| 225 } | 225 } |
| 226 | 226 |
| 227 template<> | 227 template<> |
| 228 v8::Handle<v8::Value> toV8NoInline(TestEventConstructor* impl, v8::Handle<v8::Ob
ject> creationContext, v8::Isolate* isolate) | 228 v8::Handle<v8::Value> toV8NoInline(TestEventConstructor* impl, v8::Handle<v8::Ob
ject> creationContext, v8::Isolate* isolate) |
| 229 { | 229 { |
| 230 return toV8(impl, creationContext, isolate); | 230 return toV8(impl, creationContext, isolate); |
| 231 } | 231 } |
| 232 | 232 |
| 233 } // namespace WebCore | 233 } // namespace WebCore |
| OLD | NEW |