| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 158 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 159 return handleScope.Escape(templ); | 159 return handleScope.Escape(templ); |
| 160 } | 160 } |
| 161 | 161 |
| 162 bool V8TestInterfaceNamedConstructor2::hasInstance(v8::Handle<v8::Value> jsValue
, v8::Isolate* isolate) | 162 bool V8TestInterfaceNamedConstructor2::hasInstance(v8::Handle<v8::Value> jsValue
, v8::Isolate* isolate) |
| 163 { | 163 { |
| 164 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI
nfo, jsValue) | 164 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI
nfo, jsValue) |
| 165 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy
peInfo, jsValue); | 165 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy
peInfo, jsValue); |
| 166 } | 166 } |
| 167 | 167 |
| 168 TestInterfaceNamedConstructor2* V8TestInterfaceNamedConstructor2::toNativeWithTy
peCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value) |
| 169 { |
| 170 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje
ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) :
0; |
| 171 } |
| 172 |
| 168 v8::Handle<v8::Object> V8TestInterfaceNamedConstructor2::createWrapper(PassRefPt
r<TestInterfaceNamedConstructor2> impl, v8::Handle<v8::Object> creationContext,
v8::Isolate* isolate) | 173 v8::Handle<v8::Object> V8TestInterfaceNamedConstructor2::createWrapper(PassRefPt
r<TestInterfaceNamedConstructor2> impl, v8::Handle<v8::Object> creationContext,
v8::Isolate* isolate) |
| 169 { | 174 { |
| 170 ASSERT(impl); | 175 ASSERT(impl); |
| 171 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceNamedConstructor2>(impl
.get(), isolate)); | 176 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceNamedConstructor2>(impl
.get(), isolate)); |
| 172 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 177 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
| 173 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | 178 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
| 174 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | 179 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have |
| 175 // the same object de-ref functions, though, so use that as the basis of
the check. | 180 // the same object de-ref functions, though, so use that as the basis of
the check. |
| 176 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); | 181 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); |
| 177 } | 182 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 190 fromInternalPointer(object)->deref(); | 195 fromInternalPointer(object)->deref(); |
| 191 } | 196 } |
| 192 | 197 |
| 193 template<> | 198 template<> |
| 194 v8::Handle<v8::Value> toV8NoInline(TestInterfaceNamedConstructor2* impl, v8::Han
dle<v8::Object> creationContext, v8::Isolate* isolate) | 199 v8::Handle<v8::Value> toV8NoInline(TestInterfaceNamedConstructor2* impl, v8::Han
dle<v8::Object> creationContext, v8::Isolate* isolate) |
| 195 { | 200 { |
| 196 return toV8(impl, creationContext, isolate); | 201 return toV8(impl, creationContext, isolate); |
| 197 } | 202 } |
| 198 | 203 |
| 199 } // namespace WebCore | 204 } // namespace WebCore |
| OLD | NEW |