| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 V8TestActiveDOMObjectInterface::hasInstanceInAnyWorld(v8::Handle<v8::Value>
jsValue, v8::Isolate* isolate) | 117 bool V8TestActiveDOMObjectInterface::hasInstanceInAnyWorld(v8::Handle<v8::Value>
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) |
| 120 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, IsolatedWorld) | 120 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, IsolatedWorld) |
| 121 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, WorkerWorld); | 121 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, WorkerWorld); |
| 122 } | 122 } |
| 123 | 123 |
| 124 ActiveDOMObject* V8TestActiveDOMObjectInterface::toActiveDOMObject(v8::Handle<v8
::Object> object) | 124 ActiveDOMObject* V8TestActiveDOMObjectInterface::toActiveDOMObject(v8::Handle<v8
::Object> wrapper) |
| 125 { | 125 { |
| 126 return toNative(object); | 126 return toNative(wrapper); |
| 127 } | 127 } |
| 128 | 128 |
| 129 v8::Handle<v8::Object> V8TestActiveDOMObjectInterface::createWrapper(PassRefPtr<
TestActiveDOMObjectInterface> impl, v8::Handle<v8::Object> creationContext, v8::
Isolate* isolate) | 129 v8::Handle<v8::Object> V8TestActiveDOMObjectInterface::createWrapper(PassRefPtr<
TestActiveDOMObjectInterface> impl, v8::Handle<v8::Object> creationContext, v8::
Isolate* isolate) |
| 130 { | 130 { |
| 131 ASSERT(impl); | 131 ASSERT(impl); |
| 132 ASSERT(!DOMDataStore::containsWrapper<V8TestActiveDOMObjectInterface>(impl.g
et(), isolate)); | 132 ASSERT(!DOMDataStore::containsWrapper<V8TestActiveDOMObjectInterface>(impl.g
et(), isolate)); |
| 133 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 133 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
| 134 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | 134 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
| 135 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | 135 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have |
| 136 // the same object de-ref functions, though, so use that as the basis of
the check. | 136 // the same object de-ref functions, though, so use that as the basis of
the check. |
| 137 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); | 137 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); |
| 138 } | 138 } |
| 139 | 139 |
| 140 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); | 140 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); |
| 141 if (UNLIKELY(wrapper.IsEmpty())) | 141 if (UNLIKELY(wrapper.IsEmpty())) |
| 142 return wrapper; | 142 return wrapper; |
| 143 | 143 |
| 144 installPerContextEnabledProperties(wrapper, impl.get(), isolate); | 144 installPerContextEnabledProperties(wrapper, impl.get(), isolate); |
| 145 V8DOMWrapper::associateObjectWithWrapper<V8TestActiveDOMObjectInterface>(imp
l, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent); | 145 V8DOMWrapper::associateObjectWithWrapper<V8TestActiveDOMObjectInterface>(imp
l, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent); |
| 146 return wrapper; | 146 return wrapper; |
| 147 } | 147 } |
| 148 | 148 |
| 149 void V8TestActiveDOMObjectInterface::derefObject(void* object) | 149 void V8TestActiveDOMObjectInterface::derefObject(void* object) |
| 150 { | 150 { |
| 151 fromInternalPointer(object)->deref(); | 151 fromInternalPointer(object)->deref(); |
| 152 } | 152 } |
| 153 | 153 |
| 154 } // namespace WebCore | 154 } // namespace WebCore |
| OLD | NEW |