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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: Source/bindings/dart/custom/DartWebSocketCustom.cpp
diff --git a/Source/bindings/dart/custom/DartWebSocketCustom.cpp b/Source/bindings/dart/custom/DartWebSocketCustom.cpp
index 53ace5fd353ad4540267886761be226f71d54bd8..7921369bd015ba0fbf3563f4dec698f4a4912f1e 100644
--- a/Source/bindings/dart/custom/DartWebSocketCustom.cpp
+++ b/Source/bindings/dart/custom/DartWebSocketCustom.cpp
@@ -81,6 +81,114 @@ fail:
ASSERT_NOT_REACHED();
}
+void sendByteBufferCallback(Dart_NativeArguments args)
+{
+ DartApiScope dartApiScope;
+ Dart_Handle exception = 0;
+ {
+ WebSocket* receiver = DartDOMWrapper::receiver<WebSocket>(args);
+ Dart_Handle dataHandle = Dart_GetNativeArgument(args, 1);
+
+ RefPtr<ArrayBufferView> data = DartUtilities::dartToArrayBufferView(dataHandle, exception);
+ if (exception)
+ goto fail;
+
+ ExceptionCode ec = 0;
+ receiver->send(data.get(), ec);
+
+ if (UNLIKELY(ec)) {
+ exception = DartDOMWrapper::exceptionCodeToDartException(ec);
+ goto fail;
+ }
+ return;
+ }
+
+fail:
+ Dart_ThrowException(exception);
+ ASSERT_NOT_REACHED();
+}
+
+void sendTypeDataCallback(Dart_NativeArguments args)
+{
+ DartApiScope dartApiScope;
+ Dart_Handle exception = 0;
+ {
+ WebSocket* receiver = DartDOMWrapper::receiver<WebSocket>(args);
+ Dart_Handle dataHandle = Dart_GetNativeArgument(args, 1);
+
+ RefPtr<ArrayBuffer> data = DartUtilities::dartToArrayBuffer(dataHandle, exception);
+ if (exception)
+ goto fail;
+
+ ExceptionCode ec = 0;
+ receiver->send(data.get(), ec);
+
+ if (UNLIKELY(ec)) {
+ exception = DartDOMWrapper::exceptionCodeToDartException(ec);
+ goto fail;
+ }
+ return;
+ }
+
+fail:
+ Dart_ThrowException(exception);
+ ASSERT_NOT_REACHED();
+}
+
+void sendBlobCallback(Dart_NativeArguments args)
+{
+ DartApiScope dartApiScope;
+ Dart_Handle exception = 0;
+ {
+ WebSocket* receiver = DartDOMWrapper::receiver<WebSocket>(args);
+ Dart_Handle dataHandle = Dart_GetNativeArgument(args, 1);
+
+ Blob* data = DartBlob::toNative(dataHandle, exception);
+ if (exception)
+ goto fail;
+
+ ExceptionCode ec = 0;
+ receiver->send(data, ec);
+
+ if (UNLIKELY(ec)) {
+ exception = DartDOMWrapper::exceptionCodeToDartException(ec);
+ goto fail;
+ }
+ return;
+ }
+
+fail:
+ Dart_ThrowException(exception);
+ ASSERT_NOT_REACHED();
+}
+
+void sendStringCallback(Dart_NativeArguments args)
+{
+ DartApiScope dartApiScope;
+ Dart_Handle exception = 0;
+ {
+ WebSocket* receiver = DartDOMWrapper::receiver<WebSocket>(args);
+ Dart_Handle dataHandle = Dart_GetNativeArgument(args, 1);
+
+ DartStringAdapter data = DartUtilities::dartToString(dataHandle, exception);
+ if (exception)
+ goto fail;
+
+ ExceptionCode ec = 0;
+ receiver->send(data, ec);
+
+ if (UNLIKELY(ec)) {
+ exception = DartDOMWrapper::exceptionCodeToDartException(ec);
+ goto fail;
+ }
+ return;
+ }
+
+fail:
+ Dart_ThrowException(exception);
+ ASSERT_NOT_REACHED();
+}
+
}
}

Powered by Google App Engine
This is Rietveld 408576698