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

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

Issue 469373002: Bindings generation emits (more) correct null checking (Closed) Base URL: svn://svn.chromium.org/blink/branches/dart/dartium
Patch Set: Adding in fixes to binding generation Created 6 years, 4 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 namespace DartNodeInternal { 49 namespace DartNodeInternal {
50 50
51 // This function is customized to take advantage of the optional 4th argument: s houldLazyAttach. 51 // This function is customized to take advantage of the optional 4th argument: s houldLazyAttach.
52 void insertBeforeCallback(Dart_NativeArguments args) 52 void insertBeforeCallback(Dart_NativeArguments args)
53 { 53 {
54 Dart_Handle exception = 0; 54 Dart_Handle exception = 0;
55 { 55 {
56 Node* receiver = DartDOMWrapper::receiver<Node>(args); 56 Node* receiver = DartDOMWrapper::receiver<Node>(args);
57 57
58 Node* newChild = DartNode::toNative(args, 1, exception); 58 Node* newChild = DartNode::toNativeWithNullCheck(args, 1, exception);
59 if (exception) 59 if (exception)
60 goto fail; 60 goto fail;
61 61
62 Node* refChild = DartNode::toNative(args, 2, exception); 62 Node* refChild = DartNode::toNativeWithNullCheck(args, 2, exception);
63 if (exception) 63 if (exception)
64 goto fail; 64 goto fail;
65 65
66 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 66 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
67 67
68 DartExceptionState es; 68 DartExceptionState es;
69 receiver->insertBefore(newChild, refChild, es); 69 receiver->insertBefore(newChild, refChild, es);
70 if (es.hadException()) { 70 if (es.hadException()) {
71 exception = DartDOMWrapper::exceptionCodeToDartException(es); 71 exception = DartDOMWrapper::exceptionCodeToDartException(es);
72 goto fail; 72 goto fail;
73 } 73 }
74 74
75 DartDOMWrapper::returnToDart<DartNode>(args, newChild); 75 DartDOMWrapper::returnToDart<DartNode>(args, newChild);
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 // This function is customized to take advantage of the optional 4th argument: s houldLazyAttach. 84 // This function is customized to take advantage of the optional 4th argument: s houldLazyAttach.
85 void replaceChildCallback(Dart_NativeArguments args) 85 void replaceChildCallback(Dart_NativeArguments args)
86 { 86 {
87 Dart_Handle exception = 0; 87 Dart_Handle exception = 0;
88 { 88 {
89 Node* receiver = DartDOMWrapper::receiver<Node>(args); 89 Node* receiver = DartDOMWrapper::receiver<Node>(args);
90 90
91 Node* newChild = DartNode::toNative(args, 1, exception); 91 Node* newChild = DartNode::toNativeWithNullCheck(args, 1, exception);
92 if (exception) 92 if (exception)
93 goto fail; 93 goto fail;
94 94
95 Node* oldChild = DartNode::toNative(args, 2, exception); 95 Node* oldChild = DartNode::toNativeWithNullCheck(args, 2, exception);
96 if (exception) 96 if (exception)
97 goto fail; 97 goto fail;
98 98
99 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 99 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
100 100
101 DartExceptionState es; 101 DartExceptionState es;
102 receiver->replaceChild(newChild, oldChild, es); 102 receiver->replaceChild(newChild, oldChild, es);
103 if (es.hadException()) { 103 if (es.hadException()) {
104 exception = DartDOMWrapper::exceptionCodeToDartException(es); 104 exception = DartDOMWrapper::exceptionCodeToDartException(es);
105 goto fail; 105 goto fail;
106 } 106 }
107 107
108 DartDOMWrapper::returnToDart<DartNode>(args, newChild); 108 DartDOMWrapper::returnToDart<DartNode>(args, newChild);
109 return; 109 return;
110 } 110 }
111 111
112 fail: 112 fail:
113 Dart_ThrowException(exception); 113 Dart_ThrowException(exception);
114 ASSERT_NOT_REACHED(); 114 ASSERT_NOT_REACHED();
115 } 115 }
116 116
117 // Custom handling of the return value. 117 // Custom handling of the return value.
118 void removeChildCallback(Dart_NativeArguments args) 118 void removeChildCallback(Dart_NativeArguments args)
119 { 119 {
120 Dart_Handle exception = 0; 120 Dart_Handle exception = 0;
121 { 121 {
122 Node* receiver = DartDOMWrapper::receiver<Node>(args); 122 Node* receiver = DartDOMWrapper::receiver<Node>(args);
123 123
124 Node* child = DartNode::toNative(args, 1, exception); 124 Node* child = DartNode::toNativeWithNullCheck(args, 1, exception);
125 if (exception) 125 if (exception)
126 goto fail; 126 goto fail;
127 127
128 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 128 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
129 129
130 DartExceptionState es; 130 DartExceptionState es;
131 receiver->removeChild(child, es); 131 receiver->removeChild(child, es);
132 if (es.hadException()) { 132 if (es.hadException()) {
133 exception = DartDOMWrapper::exceptionCodeToDartException(es); 133 exception = DartDOMWrapper::exceptionCodeToDartException(es);
134 goto fail; 134 goto fail;
135 } 135 }
136 136
137 DartDOMWrapper::returnToDart<DartNode>(args, child); 137 DartDOMWrapper::returnToDart<DartNode>(args, child);
138 return; 138 return;
139 } 139 }
140 140
141 fail: 141 fail:
142 Dart_ThrowException(exception); 142 Dart_ThrowException(exception);
143 ASSERT_NOT_REACHED(); 143 ASSERT_NOT_REACHED();
144 } 144 }
145 145
146 // This function is customized to enable lazy attaching - see the last argument to appendChild. 146 // This function is customized to enable lazy attaching - see the last argument to appendChild.
147 void appendChildCallback(Dart_NativeArguments args) 147 void appendChildCallback(Dart_NativeArguments args)
148 { 148 {
149 Dart_Handle exception = 0; 149 Dart_Handle exception = 0;
150 { 150 {
151 Node* receiver = DartDOMWrapper::receiver<Node>(args); 151 Node* receiver = DartDOMWrapper::receiver<Node>(args);
152 152
153 Node* child = DartNode::toNative(args, 1, exception); 153 Node* child = DartNode::toNativeWithNullCheck(args, 1, exception);
154 if (exception) 154 if (exception)
155 goto fail; 155 goto fail;
156 156
157 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 157 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
158 158
159 DartExceptionState es; 159 DartExceptionState es;
160 receiver->appendChild(child, es); 160 receiver->appendChild(child, es);
161 if (es.hadException()) { 161 if (es.hadException()) {
162 exception = DartDOMWrapper::exceptionCodeToDartException(es); 162 exception = DartDOMWrapper::exceptionCodeToDartException(es);
163 goto fail; 163 goto fail;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 case Node::DOCUMENT_FRAGMENT_NODE: 225 case Node::DOCUMENT_FRAGMENT_NODE:
226 if (node->isShadowRoot()) 226 if (node->isShadowRoot())
227 return DartShadowRoot::createWrapper(domData, static_cast<ShadowRoot *>(node)); 227 return DartShadowRoot::createWrapper(domData, static_cast<ShadowRoot *>(node));
228 return DartDocumentFragment::createWrapper(domData, static_cast<Document Fragment*>(node)); 228 return DartDocumentFragment::createWrapper(domData, static_cast<Document Fragment*>(node));
229 default: break; // XPATH_NAMESPACE_NODE 229 default: break; // XPATH_NAMESPACE_NODE
230 } 230 }
231 return DartDOMWrapper::createWrapper<DartNode>(domData, node); 231 return DartDOMWrapper::createWrapper<DartNode>(domData, node);
232 } 232 }
233 233
234 } 234 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698