| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 return result->value.newLocal(isolate); | 176 return result->value.newLocal(isolate); |
| 177 | 177 |
| 178 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 178 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 179 v8::EscapableHandleScope handleScope(isolate); | 179 v8::EscapableHandleScope handleScope(isolate); |
| 180 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); | 180 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); |
| 181 configureV8TestCustomAccessorsTemplate(templ, isolate, currentWorldType); | 181 configureV8TestCustomAccessorsTemplate(templ, isolate, currentWorldType); |
| 182 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 182 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 183 return handleScope.Escape(templ); | 183 return handleScope.Escape(templ); |
| 184 } | 184 } |
| 185 | 185 |
| 186 bool V8TestCustomAccessors::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isola
te* isolate, WrapperWorldType currentWorldType) | 186 bool V8TestCustomAccessors::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isola
te* isolate) |
| 187 { | 187 { |
| 188 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); | 188 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI
nfo, jsValue) |
| 189 } | 189 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy
peInfo, jsValue); |
| 190 | |
| 191 bool V8TestCustomAccessors::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue,
v8::Isolate* isolate) | |
| 192 { | |
| 193 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, MainWorld) | |
| 194 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, IsolatedWorld) | |
| 195 || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, WorkerWorld); | |
| 196 } | 190 } |
| 197 | 191 |
| 198 v8::Handle<v8::Object> V8TestCustomAccessors::createWrapper(PassRefPtr<TestCusto
mAccessors> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) | 192 v8::Handle<v8::Object> V8TestCustomAccessors::createWrapper(PassRefPtr<TestCusto
mAccessors> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 199 { | 193 { |
| 200 ASSERT(impl); | 194 ASSERT(impl); |
| 201 ASSERT(!DOMDataStore::containsWrapper<V8TestCustomAccessors>(impl.get(), iso
late)); | 195 ASSERT(!DOMDataStore::containsWrapper<V8TestCustomAccessors>(impl.get(), iso
late)); |
| 202 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 196 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
| 203 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | 197 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
| 204 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | 198 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have |
| 205 // the same object de-ref functions, though, so use that as the basis of
the check. | 199 // the same object de-ref functions, though, so use that as the basis of
the check. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 220 fromInternalPointer(object)->deref(); | 214 fromInternalPointer(object)->deref(); |
| 221 } | 215 } |
| 222 | 216 |
| 223 template<> | 217 template<> |
| 224 v8::Handle<v8::Value> toV8NoInline(TestCustomAccessors* impl, v8::Handle<v8::Obj
ect> creationContext, v8::Isolate* isolate) | 218 v8::Handle<v8::Value> toV8NoInline(TestCustomAccessors* impl, v8::Handle<v8::Obj
ect> creationContext, v8::Isolate* isolate) |
| 225 { | 219 { |
| 226 return toV8(impl, creationContext, isolate); | 220 return toV8(impl, creationContext, isolate); |
| 227 } | 221 } |
| 228 | 222 |
| 229 } // namespace WebCore | 223 } // namespace WebCore |
| OLD | NEW |