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

Side by Side Diff: Source/bindings/tests/results/V8TestTypedefs.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
« no previous file with comments | « Source/bindings/tests/results/V8TestTypedefs.h ('k') | Source/bindings/v8/Dictionary.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 477 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
478 return handleScope.Escape(templ); 478 return handleScope.Escape(templ);
479 } 479 }
480 480
481 bool V8TestTypedefs::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* iso late) 481 bool V8TestTypedefs::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* iso late)
482 { 482 {
483 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI nfo, jsValue) 483 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI nfo, jsValue)
484 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy peInfo, jsValue); 484 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy peInfo, jsValue);
485 } 485 }
486 486
487 TestTypedefs* V8TestTypedefs::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Ha ndle<v8::Value> value)
488 {
489 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) : 0;
490 }
491
487 v8::Handle<v8::Object> V8TestTypedefs::createWrapper(PassRefPtr<TestTypedefs> im pl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 492 v8::Handle<v8::Object> V8TestTypedefs::createWrapper(PassRefPtr<TestTypedefs> im pl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
488 { 493 {
489 ASSERT(impl); 494 ASSERT(impl);
490 ASSERT(!DOMDataStore::containsWrapper<V8TestTypedefs>(impl.get(), isolate)); 495 ASSERT(!DOMDataStore::containsWrapper<V8TestTypedefs>(impl.get(), isolate));
491 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { 496 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
492 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get()); 497 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get());
493 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have 498 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have
494 // the same object de-ref functions, though, so use that as the basis of the check. 499 // the same object de-ref functions, though, so use that as the basis of the check.
495 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction); 500 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction);
496 } 501 }
(...skipping 12 matching lines...) Expand all
509 fromInternalPointer(object)->deref(); 514 fromInternalPointer(object)->deref();
510 } 515 }
511 516
512 template<> 517 template<>
513 v8::Handle<v8::Value> toV8NoInline(TestTypedefs* impl, v8::Handle<v8::Object> cr eationContext, v8::Isolate* isolate) 518 v8::Handle<v8::Value> toV8NoInline(TestTypedefs* impl, v8::Handle<v8::Object> cr eationContext, v8::Isolate* isolate)
514 { 519 {
515 return toV8(impl, creationContext, isolate); 520 return toV8(impl, creationContext, isolate);
516 } 521 }
517 522
518 } // namespace WebCore 523 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestTypedefs.h ('k') | Source/bindings/v8/Dictionary.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698