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

Side by Side Diff: Source/bindings/tests/results/V8TestInterfaceDocument.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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 107 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
108 return handleScope.Escape(templ); 108 return handleScope.Escape(templ);
109 } 109 }
110 110
111 bool V8TestInterfaceDocument::hasInstance(v8::Handle<v8::Value> jsValue, v8::Iso late* isolate) 111 bool V8TestInterfaceDocument::hasInstance(v8::Handle<v8::Value> jsValue, v8::Iso late* isolate)
112 { 112 {
113 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI nfo, jsValue) 113 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI nfo, jsValue)
114 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy peInfo, jsValue); 114 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy peInfo, jsValue);
115 } 115 }
116 116
117 TestInterfaceDocument* V8TestInterfaceDocument::toNativeWithTypeCheck(v8::Isolat e* isolate, v8::Handle<v8::Value> value)
118 {
119 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) : 0;
120 }
121
117 EventTarget* V8TestInterfaceDocument::toEventTarget(v8::Handle<v8::Object> objec t) 122 EventTarget* V8TestInterfaceDocument::toEventTarget(v8::Handle<v8::Object> objec t)
118 { 123 {
119 return toNative(object); 124 return toNative(object);
120 } 125 }
121 126
122 v8::Handle<v8::Object> wrap(TestInterfaceDocument* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 127 v8::Handle<v8::Object> wrap(TestInterfaceDocument* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
123 { 128 {
124 ASSERT(impl); 129 ASSERT(impl);
125 v8::Handle<v8::Object> wrapper = V8TestInterfaceDocument::createWrapper(impl , creationContext, isolate); 130 v8::Handle<v8::Object> wrapper = V8TestInterfaceDocument::createWrapper(impl , creationContext, isolate);
126 if (wrapper.IsEmpty()) 131 if (wrapper.IsEmpty())
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 fromInternalPointer(object)->deref(); 171 fromInternalPointer(object)->deref();
167 } 172 }
168 173
169 template<> 174 template<>
170 v8::Handle<v8::Value> toV8NoInline(TestInterfaceDocument* impl, v8::Handle<v8::O bject> creationContext, v8::Isolate* isolate) 175 v8::Handle<v8::Value> toV8NoInline(TestInterfaceDocument* impl, v8::Handle<v8::O bject> creationContext, v8::Isolate* isolate)
171 { 176 {
172 return toV8(impl, creationContext, isolate); 177 return toV8(impl, creationContext, isolate);
173 } 178 }
174 179
175 } // namespace WebCore 180 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestInterfaceDocument.h ('k') | Source/bindings/tests/results/V8TestInterfaceEmpty.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698