| 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 isolate, currentWorldType); | 188 isolate, currentWorldType); |
| 189 UNUSED_PARAM(defaultSignature); | 189 UNUSED_PARAM(defaultSignature); |
| 190 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); | 190 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); |
| 191 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); | 191 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); |
| 192 UNUSED_PARAM(instanceTemplate); | 192 UNUSED_PARAM(instanceTemplate); |
| 193 UNUSED_PARAM(prototypeTemplate); | 193 UNUSED_PARAM(prototypeTemplate); |
| 194 | 194 |
| 195 // Custom Signature 'funcTestInterfaceImplementedAsParam' | 195 // Custom Signature 'funcTestInterfaceImplementedAsParam' |
| 196 const int funcTestInterfaceImplementedAsParamArgc = 1; | 196 const int funcTestInterfaceImplementedAsParamArgc = 1; |
| 197 v8::Handle<v8::FunctionTemplate> funcTestInterfaceImplementedAsParamArgv[fun
cTestInterfaceImplementedAsParamArgc] = { V8PerIsolateData::from(isolate)->rawTe
mplate(&V8TestInterfaceImplementedAs::wrapperTypeInfo, currentWorldType) }; | 197 v8::Handle<v8::FunctionTemplate> funcTestInterfaceImplementedAsParamArgv[fun
cTestInterfaceImplementedAsParamArgc] = { V8PerIsolateData::from(isolate)->rawTe
mplate(&V8TestInterfaceImplementedAs::wrapperTypeInfo, currentWorldType) }; |
| 198 v8::Handle<v8::Signature> funcTestInterfaceImplementedAsParamSignature = v8:
:Signature::New(functionTemplate, funcTestInterfaceImplementedAsParamArgc, funcT
estInterfaceImplementedAsParamArgv); | 198 v8::Handle<v8::Signature> funcTestInterfaceImplementedAsParamSignature = v8:
:Signature::New(isolate, functionTemplate, funcTestInterfaceImplementedAsParamAr
gc, funcTestInterfaceImplementedAsParamArgv); |
| 199 prototypeTemplate->Set(v8::String::NewSymbol("funcTestInterfaceImplementedAs
Param"), v8::FunctionTemplate::New(RealClassV8Internal::funcTestInterfaceImpleme
ntedAsParamMethodCallback, v8Undefined(), funcTestInterfaceImplementedAsParamSig
nature, 1)); | 199 prototypeTemplate->Set(v8::String::NewFromUtf8(isolate, "funcTestInterfaceIm
plementedAsParam", v8::String::kInternalizedString), v8::FunctionTemplate::New(i
solate, RealClassV8Internal::funcTestInterfaceImplementedAsParamMethodCallback,
v8Undefined(), funcTestInterfaceImplementedAsParamSignature, 1)); |
| 200 | 200 |
| 201 // Custom toString template | 201 // Custom toString template |
| 202 functionTemplate->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::c
urrent()->toStringTemplate()); | 202 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); |
| 203 return functionTemplate; | 203 return functionTemplate; |
| 204 } | 204 } |
| 205 | 205 |
| 206 v8::Handle<v8::FunctionTemplate> V8TestInterfaceImplementedAs::GetTemplate(v8::I
solate* isolate, WrapperWorldType currentWorldType) | 206 v8::Handle<v8::FunctionTemplate> V8TestInterfaceImplementedAs::GetTemplate(v8::I
solate* isolate, WrapperWorldType currentWorldType) |
| 207 { | 207 { |
| 208 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 208 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 209 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 209 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
| 210 if (result != data->templateMap(currentWorldType).end()) | 210 if (result != data->templateMap(currentWorldType).end()) |
| 211 return result->value.newLocal(isolate); | 211 return result->value.newLocal(isolate); |
| 212 | 212 |
| 213 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 213 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 214 v8::HandleScope handleScope(isolate); | 214 v8::EscapableHandleScope handleScope(isolate); |
| 215 v8::Handle<v8::FunctionTemplate> templ = | 215 v8::Local<v8::FunctionTemplate> templ = |
| 216 ConfigureV8TestInterfaceImplementedAsTemplate(data->rawTemplate(&wrapper
TypeInfo, currentWorldType), isolate, currentWorldType); | 216 ConfigureV8TestInterfaceImplementedAsTemplate(data->rawTemplate(&wrapper
TypeInfo, currentWorldType), isolate, currentWorldType); |
| 217 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 217 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 218 return handleScope.Close(templ); | 218 return handleScope.Escape(templ); |
| 219 } | 219 } |
| 220 | 220 |
| 221 bool V8TestInterfaceImplementedAs::hasInstance(v8::Handle<v8::Value> jsValue, v8
::Isolate* isolate, WrapperWorldType currentWorldType) | 221 bool V8TestInterfaceImplementedAs::hasInstance(v8::Handle<v8::Value> jsValue, v8
::Isolate* isolate, WrapperWorldType currentWorldType) |
| 222 { | 222 { |
| 223 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); | 223 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); |
| 224 } | 224 } |
| 225 | 225 |
| 226 bool V8TestInterfaceImplementedAs::hasInstanceInAnyWorld(v8::Handle<v8::Value> j
sValue, v8::Isolate* isolate) | 226 bool V8TestInterfaceImplementedAs::hasInstanceInAnyWorld(v8::Handle<v8::Value> j
sValue, v8::Isolate* isolate) |
| 227 { | 227 { |
| 228 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) | 228 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 255 fromInternalPointer(object)->deref(); | 255 fromInternalPointer(object)->deref(); |
| 256 } | 256 } |
| 257 | 257 |
| 258 template<> | 258 template<> |
| 259 v8::Handle<v8::Value> toV8NoInline(RealClass* impl, v8::Handle<v8::Object> creat
ionContext, v8::Isolate* isolate) | 259 v8::Handle<v8::Value> toV8NoInline(RealClass* impl, v8::Handle<v8::Object> creat
ionContext, v8::Isolate* isolate) |
| 260 { | 260 { |
| 261 return toV8(impl, creationContext, isolate); | 261 return toV8(impl, creationContext, isolate); |
| 262 } | 262 } |
| 263 | 263 |
| 264 } // namespace WebCore | 264 } // namespace WebCore |
| OLD | NEW |