| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 119 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 120 return handleScope.Escape(templ); | 120 return handleScope.Escape(templ); |
| 121 } | 121 } |
| 122 | 122 |
| 123 bool V8TestInterfacePython2::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isol
ate* isolate) | 123 bool V8TestInterfacePython2::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isol
ate* isolate) |
| 124 { | 124 { |
| 125 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI
nfo, jsValue) | 125 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI
nfo, jsValue) |
| 126 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy
peInfo, jsValue); | 126 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy
peInfo, jsValue); |
| 127 } | 127 } |
| 128 | 128 |
| 129 TestInterfacePython2* V8TestInterfacePython2::toNativeWithTypeCheck(v8::Isolate*
isolate, v8::Handle<v8::Value> value) |
| 130 { |
| 131 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje
ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) :
0; |
| 132 } |
| 133 |
| 129 v8::Handle<v8::Object> wrap(TestInterfacePython2* impl, v8::Handle<v8::Object> c
reationContext, v8::Isolate* isolate) | 134 v8::Handle<v8::Object> wrap(TestInterfacePython2* impl, v8::Handle<v8::Object> c
reationContext, v8::Isolate* isolate) |
| 130 { | 135 { |
| 131 ASSERT(impl); | 136 ASSERT(impl); |
| 132 if (impl->isInterface1()) | 137 if (impl->isInterface1()) |
| 133 return wrap(toInterface1(impl), creationContext, isolate); | 138 return wrap(toInterface1(impl), creationContext, isolate); |
| 134 if (impl->isInterface2()) | 139 if (impl->isInterface2()) |
| 135 return wrap(toInterface2(impl), creationContext, isolate); | 140 return wrap(toInterface2(impl), creationContext, isolate); |
| 136 v8::Handle<v8::Object> wrapper = V8TestInterfacePython2::createWrapper(impl,
creationContext, isolate); | 141 v8::Handle<v8::Object> wrapper = V8TestInterfacePython2::createWrapper(impl,
creationContext, isolate); |
| 137 return wrapper; | 142 return wrapper; |
| 138 } | 143 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 162 fromInternalPointer(object)->deref(); | 167 fromInternalPointer(object)->deref(); |
| 163 } | 168 } |
| 164 | 169 |
| 165 template<> | 170 template<> |
| 166 v8::Handle<v8::Value> toV8NoInline(TestInterfacePython2* impl, v8::Handle<v8::Ob
ject> creationContext, v8::Isolate* isolate) | 171 v8::Handle<v8::Value> toV8NoInline(TestInterfacePython2* impl, v8::Handle<v8::Ob
ject> creationContext, v8::Isolate* isolate) |
| 167 { | 172 { |
| 168 return toV8(impl, creationContext, isolate); | 173 return toV8(impl, creationContext, isolate); |
| 169 } | 174 } |
| 170 | 175 |
| 171 } // namespace WebCore | 176 } // namespace WebCore |
| OLD | NEW |