| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 163 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 164 return handleScope.Escape(templ); | 164 return handleScope.Escape(templ); |
| 165 } | 165 } |
| 166 | 166 |
| 167 bool V8TestSpecialOperationsCustom::hasInstance(v8::Handle<v8::Value> jsValue, v
8::Isolate* isolate) | 167 bool V8TestSpecialOperationsCustom::hasInstance(v8::Handle<v8::Value> jsValue, v
8::Isolate* isolate) |
| 168 { | 168 { |
| 169 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI
nfo, jsValue) | 169 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI
nfo, jsValue) |
| 170 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy
peInfo, jsValue); | 170 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy
peInfo, jsValue); |
| 171 } | 171 } |
| 172 | 172 |
| 173 TestSpecialOperationsCustom* V8TestSpecialOperationsCustom::toNativeWithTypeChec
k(v8::Isolate* isolate, v8::Handle<v8::Value> value) |
| 174 { |
| 175 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje
ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) :
0; |
| 176 } |
| 177 |
| 173 v8::Handle<v8::Object> V8TestSpecialOperationsCustom::createWrapper(PassRefPtr<T
estSpecialOperationsCustom> impl, v8::Handle<v8::Object> creationContext, v8::Is
olate* isolate) | 178 v8::Handle<v8::Object> V8TestSpecialOperationsCustom::createWrapper(PassRefPtr<T
estSpecialOperationsCustom> impl, v8::Handle<v8::Object> creationContext, v8::Is
olate* isolate) |
| 174 { | 179 { |
| 175 ASSERT(impl); | 180 ASSERT(impl); |
| 176 ASSERT(!DOMDataStore::containsWrapper<V8TestSpecialOperationsCustom>(impl.ge
t(), isolate)); | 181 ASSERT(!DOMDataStore::containsWrapper<V8TestSpecialOperationsCustom>(impl.ge
t(), isolate)); |
| 177 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 182 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
| 178 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | 183 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
| 179 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | 184 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have |
| 180 // the same object de-ref functions, though, so use that as the basis of
the check. | 185 // the same object de-ref functions, though, so use that as the basis of
the check. |
| 181 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); | 186 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); |
| 182 } | 187 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 195 fromInternalPointer(object)->deref(); | 200 fromInternalPointer(object)->deref(); |
| 196 } | 201 } |
| 197 | 202 |
| 198 template<> | 203 template<> |
| 199 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsCustom* impl, v8::Handle
<v8::Object> creationContext, v8::Isolate* isolate) | 204 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsCustom* impl, v8::Handle
<v8::Object> creationContext, v8::Isolate* isolate) |
| 200 { | 205 { |
| 201 return toV8(impl, creationContext, isolate); | 206 return toV8(impl, creationContext, isolate); |
| 202 } | 207 } |
| 203 | 208 |
| 204 } // namespace WebCore | 209 } // namespace WebCore |
| OLD | NEW |