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

Side by Side Diff: Source/bindings/tests/results/V8TestNode.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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 220 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
221 return handleScope.Escape(templ); 221 return handleScope.Escape(templ);
222 } 222 }
223 223
224 bool V8TestNode::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate ) 224 bool V8TestNode::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate )
225 { 225 {
226 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI nfo, jsValue) 226 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI nfo, jsValue)
227 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy peInfo, jsValue); 227 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy peInfo, jsValue);
228 } 228 }
229 229
230 TestNode* V8TestNode::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8: :Value> value)
231 {
232 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) : 0;
233 }
234
230 EventTarget* V8TestNode::toEventTarget(v8::Handle<v8::Object> object) 235 EventTarget* V8TestNode::toEventTarget(v8::Handle<v8::Object> object)
231 { 236 {
232 return toNative(object); 237 return toNative(object);
233 } 238 }
234 239
235 v8::Handle<v8::Object> V8TestNode::createWrapper(PassRefPtr<TestNode> impl, v8:: Handle<v8::Object> creationContext, v8::Isolate* isolate) 240 v8::Handle<v8::Object> V8TestNode::createWrapper(PassRefPtr<TestNode> impl, v8:: Handle<v8::Object> creationContext, v8::Isolate* isolate)
236 { 241 {
237 ASSERT(impl); 242 ASSERT(impl);
238 ASSERT(!DOMDataStore::containsWrapper<V8TestNode>(impl.get(), isolate)); 243 ASSERT(!DOMDataStore::containsWrapper<V8TestNode>(impl.get(), isolate));
239 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { 244 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
(...skipping 17 matching lines...) Expand all
257 fromInternalPointer(object)->deref(); 262 fromInternalPointer(object)->deref();
258 } 263 }
259 264
260 template<> 265 template<>
261 v8::Handle<v8::Value> toV8NoInline(TestNode* impl, v8::Handle<v8::Object> creati onContext, v8::Isolate* isolate) 266 v8::Handle<v8::Value> toV8NoInline(TestNode* impl, v8::Handle<v8::Object> creati onContext, v8::Isolate* isolate)
262 { 267 {
263 return toV8(impl, creationContext, isolate); 268 return toV8(impl, creationContext, isolate);
264 } 269 }
265 270
266 } // namespace WebCore 271 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestNode.h ('k') | Source/bindings/tests/results/V8TestObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698