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

Side by Side Diff: Source/bindings/tests/results/V8TestInterfaceEventConstructor.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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 400 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
401 return handleScope.Escape(templ); 401 return handleScope.Escape(templ);
402 } 402 }
403 403
404 bool V8TestInterfaceEventConstructor::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate) 404 bool V8TestInterfaceEventConstructor::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate)
405 { 405 {
406 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI nfo, jsValue) 406 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI nfo, jsValue)
407 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy peInfo, jsValue); 407 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy peInfo, jsValue);
408 } 408 }
409 409
410 TestInterfaceEventConstructor* V8TestInterfaceEventConstructor::toNativeWithType Check(v8::Isolate* isolate, v8::Handle<v8::Value> value)
411 {
412 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) : 0;
413 }
414
410 v8::Handle<v8::Object> V8TestInterfaceEventConstructor::createWrapper(PassRefPtr <TestInterfaceEventConstructor> impl, v8::Handle<v8::Object> creationContext, v8 ::Isolate* isolate) 415 v8::Handle<v8::Object> V8TestInterfaceEventConstructor::createWrapper(PassRefPtr <TestInterfaceEventConstructor> impl, v8::Handle<v8::Object> creationContext, v8 ::Isolate* isolate)
411 { 416 {
412 ASSERT(impl); 417 ASSERT(impl);
413 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceEventConstructor>(impl. get(), isolate)); 418 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceEventConstructor>(impl. get(), isolate));
414 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { 419 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
415 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get()); 420 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get());
416 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have 421 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have
417 // the same object de-ref functions, though, so use that as the basis of the check. 422 // the same object de-ref functions, though, so use that as the basis of the check.
418 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction); 423 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction);
419 } 424 }
(...skipping 12 matching lines...) Expand all
432 fromInternalPointer(object)->deref(); 437 fromInternalPointer(object)->deref();
433 } 438 }
434 439
435 template<> 440 template<>
436 v8::Handle<v8::Value> toV8NoInline(TestInterfaceEventConstructor* impl, v8::Hand le<v8::Object> creationContext, v8::Isolate* isolate) 441 v8::Handle<v8::Value> toV8NoInline(TestInterfaceEventConstructor* impl, v8::Hand le<v8::Object> creationContext, v8::Isolate* isolate)
437 { 442 {
438 return toV8(impl, creationContext, isolate); 443 return toV8(impl, creationContext, isolate);
439 } 444 }
440 445
441 } // namespace WebCore 446 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698