Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: Source/bindings/tests/results/V8TestInterfaceEventTarget.cpp

Issue 171533006: V8 Binding: Introduce toNativeWithTypeCheck (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 153 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
154 return handleScope.Escape(templ); 154 return handleScope.Escape(templ);
155 } 155 }
156 156
157 bool V8TestInterfaceEventTarget::hasInstance(v8::Handle<v8::Value> jsValue, v8:: Isolate* isolate) 157 bool V8TestInterfaceEventTarget::hasInstance(v8::Handle<v8::Value> jsValue, v8:: Isolate* isolate)
158 { 158 {
159 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI nfo, jsValue) 159 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI nfo, jsValue)
160 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy peInfo, jsValue); 160 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy peInfo, jsValue);
161 } 161 }
162 162
163 TestInterfaceEventTarget* V8TestInterfaceEventTarget::toNativeWithTypeCheck(v8:: Isolate* isolate, v8::Handle<v8::Value> value)
164 {
165 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) : 0;
166 }
167
163 EventTarget* V8TestInterfaceEventTarget::toEventTarget(v8::Handle<v8::Object> ob ject) 168 EventTarget* V8TestInterfaceEventTarget::toEventTarget(v8::Handle<v8::Object> ob ject)
164 { 169 {
165 return toNative(object); 170 return toNative(object);
166 } 171 }
167 172
168 v8::Handle<v8::Object> V8TestInterfaceEventTarget::createWrapper(PassRefPtr<Test InterfaceEventTarget> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 173 v8::Handle<v8::Object> V8TestInterfaceEventTarget::createWrapper(PassRefPtr<Test InterfaceEventTarget> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
169 { 174 {
170 ASSERT(impl); 175 ASSERT(impl);
171 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceEventTarget>(impl.get() , isolate)); 176 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceEventTarget>(impl.get() , isolate));
172 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { 177 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
(...skipping 17 matching lines...) Expand all
190 fromInternalPointer(object)->deref(); 195 fromInternalPointer(object)->deref();
191 } 196 }
192 197
193 template<> 198 template<>
194 v8::Handle<v8::Value> toV8NoInline(TestInterfaceEventTarget* impl, v8::Handle<v8 ::Object> creationContext, v8::Isolate* isolate) 199 v8::Handle<v8::Value> toV8NoInline(TestInterfaceEventTarget* impl, v8::Handle<v8 ::Object> creationContext, v8::Isolate* isolate)
195 { 200 {
196 return toV8(impl, creationContext, isolate); 201 return toV8(impl, creationContext, isolate);
197 } 202 }
198 203
199 } // namespace WebCore 204 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698