| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 0, 0, | 84 0, 0, |
| 85 isolate, currentWorldType); | 85 isolate, currentWorldType); |
| 86 UNUSED_PARAM(defaultSignature); | 86 UNUSED_PARAM(defaultSignature); |
| 87 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); | 87 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT
emplate(); |
| 88 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); | 88 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp
eTemplate(); |
| 89 UNUSED_PARAM(instanceTemplate); | 89 UNUSED_PARAM(instanceTemplate); |
| 90 UNUSED_PARAM(prototypeTemplate); | 90 UNUSED_PARAM(prototypeTemplate); |
| 91 functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler(V8TestCustomL
egacyCallInterface::legacyCallCustom); | 91 functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler(V8TestCustomL
egacyCallInterface::legacyCallCustom); |
| 92 | 92 |
| 93 // Custom toString template | 93 // Custom toString template |
| 94 functionTemplate->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::c
urrent()->toStringTemplate()); | 94 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); |
| 95 return functionTemplate; | 95 return functionTemplate; |
| 96 } | 96 } |
| 97 | 97 |
| 98 v8::Handle<v8::FunctionTemplate> V8TestCustomLegacyCallInterface::GetTemplate(v8
::Isolate* isolate, WrapperWorldType currentWorldType) | 98 v8::Handle<v8::FunctionTemplate> V8TestCustomLegacyCallInterface::GetTemplate(v8
::Isolate* isolate, WrapperWorldType currentWorldType) |
| 99 { | 99 { |
| 100 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 100 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 101 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 101 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
| 102 if (result != data->templateMap(currentWorldType).end()) | 102 if (result != data->templateMap(currentWorldType).end()) |
| 103 return result->value.newLocal(isolate); | 103 return result->value.newLocal(isolate); |
| 104 | 104 |
| 105 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 105 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 106 v8::HandleScope handleScope(isolate); | 106 v8::EscapableHandleScope handleScope(isolate); |
| 107 v8::Handle<v8::FunctionTemplate> templ = | 107 v8::Local<v8::FunctionTemplate> templ = |
| 108 ConfigureV8TestCustomLegacyCallInterfaceTemplate(data->rawTemplate(&wrap
perTypeInfo, currentWorldType), isolate, currentWorldType); | 108 ConfigureV8TestCustomLegacyCallInterfaceTemplate(data->rawTemplate(&wrap
perTypeInfo, currentWorldType), isolate, currentWorldType); |
| 109 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 109 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 110 return handleScope.Close(templ); | 110 return handleScope.Escape(templ); |
| 111 } | 111 } |
| 112 | 112 |
| 113 bool V8TestCustomLegacyCallInterface::hasInstance(v8::Handle<v8::Value> jsValue,
v8::Isolate* isolate, WrapperWorldType currentWorldType) | 113 bool V8TestCustomLegacyCallInterface::hasInstance(v8::Handle<v8::Value> jsValue,
v8::Isolate* isolate, WrapperWorldType currentWorldType) |
| 114 { | 114 { |
| 115 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); | 115 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); |
| 116 } | 116 } |
| 117 | 117 |
| 118 bool V8TestCustomLegacyCallInterface::hasInstanceInAnyWorld(v8::Handle<v8::Value
> jsValue, v8::Isolate* isolate) | 118 bool V8TestCustomLegacyCallInterface::hasInstanceInAnyWorld(v8::Handle<v8::Value
> jsValue, v8::Isolate* isolate) |
| 119 { | 119 { |
| 120 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) | 120 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 147 fromInternalPointer(object)->deref(); | 147 fromInternalPointer(object)->deref(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 template<> | 150 template<> |
| 151 v8::Handle<v8::Value> toV8NoInline(TestCustomLegacyCallInterface* impl, v8::Hand
le<v8::Object> creationContext, v8::Isolate* isolate) | 151 v8::Handle<v8::Value> toV8NoInline(TestCustomLegacyCallInterface* impl, v8::Hand
le<v8::Object> creationContext, v8::Isolate* isolate) |
| 152 { | 152 { |
| 153 return toV8(impl, creationContext, isolate); | 153 return toV8(impl, creationContext, isolate); |
| 154 } | 154 } |
| 155 | 155 |
| 156 } // namespace WebCore | 156 } // namespace WebCore |
| OLD | NEW |