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

Side by Side Diff: Source/bindings/tests/results/V8TestSpecialOperationsIdentifierRaisesException.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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 424 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
425 return handleScope.Escape(templ); 425 return handleScope.Escape(templ);
426 } 426 }
427 427
428 bool V8TestSpecialOperationsIdentifierRaisesException::hasInstance(v8::Handle<v8 ::Value> jsValue, v8::Isolate* isolate) 428 bool V8TestSpecialOperationsIdentifierRaisesException::hasInstance(v8::Handle<v8 ::Value> jsValue, v8::Isolate* isolate)
429 { 429 {
430 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI nfo, jsValue) 430 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI nfo, jsValue)
431 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy peInfo, jsValue); 431 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy peInfo, jsValue);
432 } 432 }
433 433
434 TestSpecialOperationsIdentifierRaisesException* V8TestSpecialOperationsIdentifie rRaisesException::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Val ue> value)
435 {
436 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) : 0;
437 }
438
434 v8::Handle<v8::Object> V8TestSpecialOperationsIdentifierRaisesException::createW rapper(PassRefPtr<TestSpecialOperationsIdentifierRaisesException> impl, v8::Hand le<v8::Object> creationContext, v8::Isolate* isolate) 439 v8::Handle<v8::Object> V8TestSpecialOperationsIdentifierRaisesException::createW rapper(PassRefPtr<TestSpecialOperationsIdentifierRaisesException> impl, v8::Hand le<v8::Object> creationContext, v8::Isolate* isolate)
435 { 440 {
436 ASSERT(impl); 441 ASSERT(impl);
437 ASSERT(!DOMDataStore::containsWrapper<V8TestSpecialOperationsIdentifierRaise sException>(impl.get(), isolate)); 442 ASSERT(!DOMDataStore::containsWrapper<V8TestSpecialOperationsIdentifierRaise sException>(impl.get(), isolate));
438 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { 443 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
439 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get()); 444 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get());
440 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have 445 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have
441 // the same object de-ref functions, though, so use that as the basis of the check. 446 // the same object de-ref functions, though, so use that as the basis of the check.
442 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction); 447 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction);
443 } 448 }
(...skipping 12 matching lines...) Expand all
456 fromInternalPointer(object)->deref(); 461 fromInternalPointer(object)->deref();
457 } 462 }
458 463
459 template<> 464 template<>
460 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsIdentifierRaisesExceptio n* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 465 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsIdentifierRaisesExceptio n* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
461 { 466 {
462 return toV8(impl, creationContext, isolate); 467 return toV8(impl, creationContext, isolate);
463 } 468 }
464 469
465 } // namespace WebCore 470 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698