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

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

Issue 18337011: Added custom bindings for renamed custom functions. (Closed) Base URL: svn://svn.chromium.org/multivm/trunk/webkit
Patch Set: Created 7 years, 5 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/dart/custom/DartFormDataCustom.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 goto fail; 74 goto fail;
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 void sendByteBufferCallback(Dart_NativeArguments args)
85 {
86 DartApiScope dartApiScope;
87 Dart_Handle exception = 0;
88 {
89 WebSocket* receiver = DartDOMWrapper::receiver<WebSocket>(args);
90 Dart_Handle dataHandle = Dart_GetNativeArgument(args, 1);
91
92 RefPtr<ArrayBufferView> data = DartUtilities::dartToArrayBufferView(data Handle, exception);
93 if (exception)
94 goto fail;
95
96 ExceptionCode ec = 0;
97 receiver->send(data.get(), ec);
98
99 if (UNLIKELY(ec)) {
100 exception = DartDOMWrapper::exceptionCodeToDartException(ec);
101 goto fail;
102 }
103 return;
104 }
105
106 fail:
107 Dart_ThrowException(exception);
108 ASSERT_NOT_REACHED();
109 }
110
111 void sendTypedDataCallback(Dart_NativeArguments args)
112 {
113 DartApiScope dartApiScope;
114 Dart_Handle exception = 0;
115 {
116 WebSocket* receiver = DartDOMWrapper::receiver<WebSocket>(args);
117 Dart_Handle dataHandle = Dart_GetNativeArgument(args, 1);
118
119 RefPtr<ArrayBuffer> data = DartUtilities::dartToArrayBuffer(dataHandle, exception);
120 if (exception)
121 goto fail;
122
123 ExceptionCode ec = 0;
124 receiver->send(data.get(), ec);
125
126 if (UNLIKELY(ec)) {
127 exception = DartDOMWrapper::exceptionCodeToDartException(ec);
128 goto fail;
129 }
130 return;
131 }
132
133 fail:
134 Dart_ThrowException(exception);
135 ASSERT_NOT_REACHED();
136 }
137
138 void sendBlobCallback(Dart_NativeArguments args)
139 {
140 DartApiScope dartApiScope;
141 Dart_Handle exception = 0;
142 {
143 WebSocket* receiver = DartDOMWrapper::receiver<WebSocket>(args);
144 Dart_Handle dataHandle = Dart_GetNativeArgument(args, 1);
145
146 Blob* data = DartBlob::toNative(dataHandle, exception);
147 if (exception)
148 goto fail;
149
150 ExceptionCode ec = 0;
151 receiver->send(data, ec);
152
153 if (UNLIKELY(ec)) {
154 exception = DartDOMWrapper::exceptionCodeToDartException(ec);
155 goto fail;
156 }
157 return;
158 }
159
160 fail:
161 Dart_ThrowException(exception);
162 ASSERT_NOT_REACHED();
163 }
164
165 void sendStringCallback(Dart_NativeArguments args)
166 {
167 DartApiScope dartApiScope;
168 Dart_Handle exception = 0;
169 {
170 WebSocket* receiver = DartDOMWrapper::receiver<WebSocket>(args);
171 Dart_Handle dataHandle = Dart_GetNativeArgument(args, 1);
172
173 DartStringAdapter data = DartUtilities::dartToString(dataHandle, excepti on);
174 if (exception)
175 goto fail;
176
177 ExceptionCode ec = 0;
178 receiver->send(data, ec);
179
180 if (UNLIKELY(ec)) {
181 exception = DartDOMWrapper::exceptionCodeToDartException(ec);
182 goto fail;
183 }
184 return;
185 }
186
187 fail:
188 Dart_ThrowException(exception);
189 ASSERT_NOT_REACHED();
190 }
191
84 } 192 }
85 193
86 } 194 }
OLDNEW
« no previous file with comments | « Source/bindings/dart/custom/DartFormDataCustom.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698