| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 104 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 105 return handleScope.Escape(templ); | 105 return handleScope.Escape(templ); |
| 106 } | 106 } |
| 107 | 107 |
| 108 bool V8TestInterfacePython3::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isol
ate* isolate) | 108 bool V8TestInterfacePython3::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isol
ate* isolate) |
| 109 { | 109 { |
| 110 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI
nfo, jsValue) | 110 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI
nfo, jsValue) |
| 111 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy
peInfo, jsValue); | 111 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy
peInfo, jsValue); |
| 112 } | 112 } |
| 113 | 113 |
| 114 TestInterfacePython3* V8TestInterfacePython3::toNativeWithTypeCheck(v8::Isolate*
isolate, v8::Handle<v8::Value> value) |
| 115 { |
| 116 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje
ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) :
0; |
| 117 } |
| 118 |
| 114 v8::Handle<v8::Object> V8TestInterfacePython3::createWrapper(PassRefPtr<TestInte
rfacePython3> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate
) | 119 v8::Handle<v8::Object> V8TestInterfacePython3::createWrapper(PassRefPtr<TestInte
rfacePython3> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate
) |
| 115 { | 120 { |
| 116 ASSERT(impl); | 121 ASSERT(impl); |
| 117 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfacePython3>(impl.get(), is
olate)); | 122 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfacePython3>(impl.get(), is
olate)); |
| 118 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 123 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
| 119 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | 124 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
| 120 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | 125 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have |
| 121 // the same object de-ref functions, though, so use that as the basis of
the check. | 126 // the same object de-ref functions, though, so use that as the basis of
the check. |
| 122 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); | 127 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); |
| 123 } | 128 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 136 fromInternalPointer(object)->deref(); | 141 fromInternalPointer(object)->deref(); |
| 137 } | 142 } |
| 138 | 143 |
| 139 template<> | 144 template<> |
| 140 v8::Handle<v8::Value> toV8NoInline(TestInterfacePython3* impl, v8::Handle<v8::Ob
ject> creationContext, v8::Isolate* isolate) | 145 v8::Handle<v8::Value> toV8NoInline(TestInterfacePython3* impl, v8::Handle<v8::Ob
ject> creationContext, v8::Isolate* isolate) |
| 141 { | 146 { |
| 142 return toV8(impl, creationContext, isolate); | 147 return toV8(impl, creationContext, isolate); |
| 143 } | 148 } |
| 144 | 149 |
| 145 } // namespace WebCore | 150 } // namespace WebCore |
| OLD | NEW |