| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 return result->value.newLocal(isolate); | 151 return result->value.newLocal(isolate); |
| 152 | 152 |
| 153 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 153 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 154 v8::EscapableHandleScope handleScope(isolate); | 154 v8::EscapableHandleScope handleScope(isolate); |
| 155 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); | 155 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); |
| 156 configureV8TestInterfaceNamedConstructor2Template(templ, isolate, currentWor
ldType); | 156 configureV8TestInterfaceNamedConstructor2Template(templ, isolate, currentWor
ldType); |
| 157 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 157 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 158 return handleScope.Escape(templ); | 158 return handleScope.Escape(templ); |
| 159 } | 159 } |
| 160 | 160 |
| 161 bool V8TestInterfaceNamedConstructor2::hasInstance(v8::Handle<v8::Value> jsValue
, v8::Isolate* isolate, WrapperWorldType currentWorldType) | 161 bool V8TestInterfaceNamedConstructor2::hasInstance(v8::Handle<v8::Value> jsValue
, v8::Isolate* isolate) |
| 162 { | 162 { |
| 163 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); | 163 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI
nfo, jsValue) |
| 164 } | 164 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy
peInfo, jsValue); |
| 165 | |
| 166 bool V8TestInterfaceNamedConstructor2::hasInstanceInAnyWorld(v8::Handle<v8::Valu
e> jsValue, v8::Isolate* isolate) | |
| 167 { | |
| 168 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) | |
| 169 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, IsolatedWorld) | |
| 170 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, WorkerWorld); | |
| 171 } | 165 } |
| 172 | 166 |
| 173 v8::Handle<v8::Object> V8TestInterfaceNamedConstructor2::createWrapper(PassRefPt
r<TestInterfaceNamedConstructor2> impl, v8::Handle<v8::Object> creationContext,
v8::Isolate* isolate) | 167 v8::Handle<v8::Object> V8TestInterfaceNamedConstructor2::createWrapper(PassRefPt
r<TestInterfaceNamedConstructor2> impl, v8::Handle<v8::Object> creationContext,
v8::Isolate* isolate) |
| 174 { | 168 { |
| 175 ASSERT(impl); | 169 ASSERT(impl); |
| 176 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceNamedConstructor2>(impl
.get(), isolate)); | 170 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceNamedConstructor2>(impl
.get(), isolate)); |
| 177 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 171 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
| 178 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | 172 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
| 179 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | 173 // 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. | 174 // the same object de-ref functions, though, so use that as the basis of
the check. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 195 fromInternalPointer(object)->deref(); | 189 fromInternalPointer(object)->deref(); |
| 196 } | 190 } |
| 197 | 191 |
| 198 template<> | 192 template<> |
| 199 v8::Handle<v8::Value> toV8NoInline(TestInterfaceNamedConstructor2* impl, v8::Han
dle<v8::Object> creationContext, v8::Isolate* isolate) | 193 v8::Handle<v8::Value> toV8NoInline(TestInterfaceNamedConstructor2* impl, v8::Han
dle<v8::Object> creationContext, v8::Isolate* isolate) |
| 200 { | 194 { |
| 201 return toV8(impl, creationContext, isolate); | 195 return toV8(impl, creationContext, isolate); |
| 202 } | 196 } |
| 203 | 197 |
| 204 } // namespace WebCore | 198 } // namespace WebCore |
| OLD | NEW |