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

Side by Side Diff: Source/bindings/dart/custom/DartHTMLOptionsCollectionCustom.cpp

Issue 27140002: Use Dart_InstanceIsSubtypeOf to check if instance is a direct subtype of specified type. (Closed) Base URL: svn://svn.chromium.org/multivm/trunk/webkit/
Patch Set: Created 7 years, 2 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 // Copyright 2011, Google Inc. 1 // Copyright 2011, Google Inc.
2 // All rights reserved. 2 // 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 // Note: as of now HTMLSelect element doesn't implement List and therefo re I inline v8's 52 // Note: as of now HTMLSelect element doesn't implement List and therefo re I inline v8's
53 // toOptionsCollectionSetter right here. If situation changes later, thi s piece of code should 53 // toOptionsCollectionSetter right here. If situation changes later, thi s piece of code should
54 // be refactored into helper method. 54 // be refactored into helper method.
55 unsigned index = DartUtilities::dartToUnsigned(Dart_GetNativeArgument(ar gs, 1), exception); 55 unsigned index = DartUtilities::dartToUnsigned(Dart_GetNativeArgument(ar gs, 1), exception);
56 if (exception) 56 if (exception)
57 goto fail; 57 goto fail;
58 58
59 Dart_Handle elementArgument = Dart_GetNativeArgument(args, 2); 59 Dart_Handle elementArgument = Dart_GetNativeArgument(args, 2);
60 DartDOMData* domData = static_cast<DartDOMData*>(Dart_GetNativeIsolateDa ta(args)); 60 DartDOMData* domData = static_cast<DartDOMData*>(Dart_GetNativeIsolateDa ta(args));
61 if (!DartDOMWrapper::instanceOf<DartHTMLOptionElement>(domData, elementA rgument)) { 61 if (!DartDOMWrapper::subtypeOf<DartHTMLOptionElement>(domData, elementAr gument)) {
62 exception = DartDOMWrapper::exceptionCodeToDartException(TypeMismatc hError); 62 exception = DartDOMWrapper::exceptionCodeToDartException(TypeMismatc hError);
63 goto fail; 63 goto fail;
64 } 64 }
65 HTMLOptionElement* element = DartHTMLOptionElement::toNative(elementArgu ment, exception); 65 HTMLOptionElement* element = DartHTMLOptionElement::toNative(elementArgu ment, exception);
66 if (exception) 66 if (exception)
67 goto fail; 67 goto fail;
68 68
69 DartExceptionState es; 69 DartExceptionState es;
70 base->setOption(index, element, es); 70 base->setOption(index, element, es);
71 if (es.hadException()) { 71 if (es.hadException()) {
72 exception = DartDOMWrapper::exceptionCodeToDartException(es); 72 exception = DartDOMWrapper::exceptionCodeToDartException(es);
73 goto fail; 73 goto fail;
74 } 74 }
75 75
76 return; 76 return;
77 } 77 }
78 78
79 fail: 79 fail:
80 Dart_ThrowException(exception); 80 Dart_ThrowException(exception);
81 ASSERT_NOT_REACHED(); 81 ASSERT_NOT_REACHED();
82 } 82 }
83 83
84 } 84 }
85 85
86 } 86 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698