| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 0, 0, | 83 0, 0, |
| 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 | 91 |
| 92 // Custom toString template | 92 // Custom toString template |
| 93 functionTemplate->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::c
urrent()->toStringTemplate()); | 93 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); |
| 94 return functionTemplate; | 94 return functionTemplate; |
| 95 } | 95 } |
| 96 | 96 |
| 97 v8::Handle<v8::FunctionTemplate> V8TestDependentLifetimeInterface::GetTemplate(v
8::Isolate* isolate, WrapperWorldType currentWorldType) | 97 v8::Handle<v8::FunctionTemplate> V8TestDependentLifetimeInterface::GetTemplate(v
8::Isolate* isolate, WrapperWorldType currentWorldType) |
| 98 { | 98 { |
| 99 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 99 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 100 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 100 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
| 101 if (result != data->templateMap(currentWorldType).end()) | 101 if (result != data->templateMap(currentWorldType).end()) |
| 102 return result->value.newLocal(isolate); | 102 return result->value.newLocal(isolate); |
| 103 | 103 |
| 104 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 104 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 105 v8::HandleScope handleScope(isolate); | 105 v8::EscapableHandleScope handleScope(isolate); |
| 106 v8::Handle<v8::FunctionTemplate> templ = | 106 v8::Local<v8::FunctionTemplate> templ = |
| 107 ConfigureV8TestDependentLifetimeInterfaceTemplate(data->rawTemplate(&wra
pperTypeInfo, currentWorldType), isolate, currentWorldType); | 107 ConfigureV8TestDependentLifetimeInterfaceTemplate(data->rawTemplate(&wra
pperTypeInfo, currentWorldType), isolate, currentWorldType); |
| 108 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 108 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 109 return handleScope.Close(templ); | 109 return handleScope.Escape(templ); |
| 110 } | 110 } |
| 111 | 111 |
| 112 bool V8TestDependentLifetimeInterface::hasInstance(v8::Handle<v8::Value> jsValue
, v8::Isolate* isolate, WrapperWorldType currentWorldType) | 112 bool V8TestDependentLifetimeInterface::hasInstance(v8::Handle<v8::Value> jsValue
, v8::Isolate* isolate, WrapperWorldType currentWorldType) |
| 113 { | 113 { |
| 114 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); | 114 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); |
| 115 } | 115 } |
| 116 | 116 |
| 117 bool V8TestDependentLifetimeInterface::hasInstanceInAnyWorld(v8::Handle<v8::Valu
e> jsValue, v8::Isolate* isolate) | 117 bool V8TestDependentLifetimeInterface::hasInstanceInAnyWorld(v8::Handle<v8::Valu
e> jsValue, v8::Isolate* isolate) |
| 118 { | 118 { |
| 119 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) | 119 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 146 fromInternalPointer(object)->deref(); | 146 fromInternalPointer(object)->deref(); |
| 147 } | 147 } |
| 148 | 148 |
| 149 template<> | 149 template<> |
| 150 v8::Handle<v8::Value> toV8NoInline(TestDependentLifetimeInterface* impl, v8::Han
dle<v8::Object> creationContext, v8::Isolate* isolate) | 150 v8::Handle<v8::Value> toV8NoInline(TestDependentLifetimeInterface* impl, v8::Han
dle<v8::Object> creationContext, v8::Isolate* isolate) |
| 151 { | 151 { |
| 152 return toV8(impl, creationContext, isolate); | 152 return toV8(impl, creationContext, isolate); |
| 153 } | 153 } |
| 154 | 154 |
| 155 } // namespace WebCore | 155 } // namespace WebCore |
| OLD | NEW |