| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); | 179 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); |
| 180 } | 180 } |
| 181 | 181 |
| 182 bool V8TestNamedConstructor::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue
, v8::Isolate* isolate) | 182 bool V8TestNamedConstructor::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue
, v8::Isolate* isolate) |
| 183 { | 183 { |
| 184 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) | 184 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) |
| 185 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, IsolatedWorld) | 185 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, IsolatedWorld) |
| 186 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, WorkerWorld); | 186 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, WorkerWorld); |
| 187 } | 187 } |
| 188 | 188 |
| 189 ActiveDOMObject* V8TestNamedConstructor::toActiveDOMObject(v8::Handle<v8::Object
> object) | 189 ActiveDOMObject* V8TestNamedConstructor::toActiveDOMObject(v8::Handle<v8::Object
> wrapper) |
| 190 { | 190 { |
| 191 return toNative(object); | 191 return toNative(wrapper); |
| 192 } | 192 } |
| 193 | 193 |
| 194 v8::Handle<v8::Object> V8TestNamedConstructor::createWrapper(PassRefPtr<TestName
dConstructor> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate
) | 194 v8::Handle<v8::Object> V8TestNamedConstructor::createWrapper(PassRefPtr<TestName
dConstructor> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate
) |
| 195 { | 195 { |
| 196 ASSERT(impl); | 196 ASSERT(impl); |
| 197 ASSERT(!DOMDataStore::containsWrapper<V8TestNamedConstructor>(impl.get(), is
olate)); | 197 ASSERT(!DOMDataStore::containsWrapper<V8TestNamedConstructor>(impl.get(), is
olate)); |
| 198 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 198 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
| 199 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | 199 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
| 200 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | 200 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have |
| 201 // the same object de-ref functions, though, so use that as the basis of
the check. | 201 // the same object de-ref functions, though, so use that as the basis of
the check. |
| 202 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); | 202 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); |
| 203 } | 203 } |
| 204 | 204 |
| 205 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); | 205 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); |
| 206 if (UNLIKELY(wrapper.IsEmpty())) | 206 if (UNLIKELY(wrapper.IsEmpty())) |
| 207 return wrapper; | 207 return wrapper; |
| 208 | 208 |
| 209 installPerContextEnabledProperties(wrapper, impl.get(), isolate); | 209 installPerContextEnabledProperties(wrapper, impl.get(), isolate); |
| 210 V8DOMWrapper::associateObjectWithWrapper<V8TestNamedConstructor>(impl, &wrap
perTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent); | 210 V8DOMWrapper::associateObjectWithWrapper<V8TestNamedConstructor>(impl, &wrap
perTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent); |
| 211 return wrapper; | 211 return wrapper; |
| 212 } | 212 } |
| 213 | 213 |
| 214 void V8TestNamedConstructor::derefObject(void* object) | 214 void V8TestNamedConstructor::derefObject(void* object) |
| 215 { | 215 { |
| 216 fromInternalPointer(object)->deref(); | 216 fromInternalPointer(object)->deref(); |
| 217 } | 217 } |
| 218 | 218 |
| 219 } // namespace WebCore | 219 } // namespace WebCore |
| OLD | NEW |