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

Unified Diff: Source/bindings/tests/results/core/V8TestObject.cpp

Issue 1079983002: Introduce SmallTypedArray IDL type and use it for bufferSubData (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: updates Created 5 years, 8 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/tests/results/core/V8TestObject.cpp
diff --git a/Source/bindings/tests/results/core/V8TestObject.cpp b/Source/bindings/tests/results/core/V8TestObject.cpp
index 535c45fe8c1abcbae000999c6d2d3c1c9ad48911..cf1509c1b1a1c81a85fb0a6d7e9b5132cc4f8d11 100644
--- a/Source/bindings/tests/results/core/V8TestObject.cpp
+++ b/Source/bindings/tests/results/core/V8TestObject.cpp
@@ -6662,12 +6662,22 @@ static void voidMethodArrayBufferOrNullArgMethodCallback(const v8::FunctionCallb
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
-static void voidMethodArrayBufferViewArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
+static void voidMethodArrayBufferViewArg1Method(const v8::FunctionCallbackInfo<v8::Value>& info)
{
- if (UNLIKELY(info.Length() < 1)) {
- V8ThrowException::throwException(createMinimumArityTypeErrorForMethod(info.GetIsolate(), "voidMethodArrayBufferViewArg", "TestObject", 1, info.Length()), info.GetIsolate());
- return;
+ TestObject* impl = V8TestObject::toImpl(info.Holder());
+ std::pair<void*, size_t> arrayBufferViewArg;
+ {
+ arrayBufferViewArg = info[0]->IsArrayBufferView() ? arrayBufferViewArg = std::make_pair(alloca(v8::ArrayBufferView::Cast(*info[0])->ByteLength()), v8::ArrayBufferView::Cast(*info[0])->ByteLength()), v8::ArrayBufferView::Cast(*info[0])->CopyContents(arrayBufferViewArg.first, arrayBufferViewArg.second), arrayBufferViewArg : std::make_pair(nullptr, 0);
+ if (!arrayBufferViewArg.first) {
+ V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodArrayBufferViewArg", "TestObject", "parameter 1 is not of type 'ArrayBufferView' and 'small'."));
+ return;
+ }
}
+ impl->voidMethodArrayBufferViewArg(arrayBufferViewArg.first, arrayBufferViewArg.second);
+}
+
+static void voidMethodArrayBufferViewArg2Method(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
TestObject* impl = V8TestObject::toImpl(info.Holder());
TestArrayBufferView* arrayBufferViewArg;
{
@@ -6676,6 +6686,33 @@ static void voidMethodArrayBufferViewArgMethod(const v8::FunctionCallbackInfo<v8
impl->voidMethodArrayBufferViewArg(arrayBufferViewArg);
}
+static void voidMethodArrayBufferViewArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
+{
+ ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodArrayBufferViewArg", "TestObject", info.Holder(), info.GetIsolate());
+ switch (std::min(1, info.Length())) {
+ case 1:
+ if (V8ArrayBufferView::hasInstance(info[0], info.GetIsolate()) && !v8::ArrayBufferView::Cast(*info[0])->HasBuffer()) {
+ voidMethodArrayBufferViewArg1Method(info);
+ return;
+ }
+ if (V8ArrayBufferView::hasInstance(info[0], info.GetIsolate())) {
+ voidMethodArrayBufferViewArg2Method(info);
+ return;
+ }
+ break;
+ default:
+ break;
+ }
+ if (info.Length() < 1) {
+ exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length()));
+ exceptionState.throwIfNeeded();
+ return;
+ }
+ exceptionState.throwTypeError("No function was found that matched the signature provided.");
+ exceptionState.throwIfNeeded();
+ return;
+}
+
static void voidMethodArrayBufferViewArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");

Powered by Google App Engine
This is Rietveld 408576698