| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2009, 2012 Google Inc. 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 23 matching lines...) Expand all Loading... |
| 34 #include "DartArrayBuffer.h" | 34 #include "DartArrayBuffer.h" |
| 35 #include "DartUtilities.h" | 35 #include "DartUtilities.h" |
| 36 | 36 |
| 37 #include <dart_api.h> | 37 #include <dart_api.h> |
| 38 | 38 |
| 39 namespace WebCore { | 39 namespace WebCore { |
| 40 | 40 |
| 41 namespace DartArrayBufferViewInternal { | 41 namespace DartArrayBufferViewInternal { |
| 42 | 42 |
| 43 template<class ArrayClass, class ElementType> | 43 template<class ArrayClass, class ElementType> |
| 44 void constructWebGLArray(Dart_NativeArguments args) | 44 void createWebGLArray(Dart_NativeArguments args) |
| 45 { | 45 { |
| 46 DartApiScope dartApiScope; | 46 DartApiScope dartApiScope; |
| 47 Dart_Handle exception; | 47 Dart_Handle exception; |
| 48 { | 48 { |
| 49 Dart_Handle arg1 = Dart_GetNativeArgument(args, 1); | 49 Dart_Handle arg1 = Dart_GetNativeArgument(args, 0); |
| 50 RefPtr<ArrayClass> array; | 50 RefPtr<ArrayClass> array; |
| 51 if (Dart_IsNumber(arg1)) { | 51 if (Dart_IsNumber(arg1)) { |
| 52 ParameterAdapter<int> length(arg1); | 52 ParameterAdapter<int> length(arg1); |
| 53 if (!length.conversionSuccessful()) { | 53 if (!length.conversionSuccessful()) { |
| 54 exception = length.exception(); | 54 exception = length.exception(); |
| 55 goto fail; | 55 goto fail; |
| 56 } | 56 } |
| 57 array = ArrayClass::create(length); | 57 array = ArrayClass::create(length); |
| 58 } else { | 58 } else { |
| 59 ParameterAdapter< Vector<ElementType> > list(arg1); | 59 ParameterAdapter< Vector<ElementType> > list(arg1); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 80 ParameterAdapter<unsigned> lengthArg(Dart_GetNativeArgument(
args, 3)); | 80 ParameterAdapter<unsigned> lengthArg(Dart_GetNativeArgument(
args, 3)); |
| 81 if (!lengthArg.conversionSuccessful()) { | 81 if (!lengthArg.conversionSuccessful()) { |
| 82 exception = lengthArg.exception(); | 82 exception = lengthArg.exception(); |
| 83 goto fail; | 83 goto fail; |
| 84 } | 84 } |
| 85 length = lengthArg; | 85 length = lengthArg; |
| 86 } | 86 } |
| 87 array = ArrayClass::create(bufferPtr, start, length); | 87 array = ArrayClass::create(bufferPtr, start, length); |
| 88 } | 88 } |
| 89 } | 89 } |
| 90 DartDOMWrapper::bindDOMObjectToDartWrapper(array.get(), Dart_GetNativeAr
gument(args, 0)); | 90 |
| 91 Dart_Handle result = toDartValue(array.get()); |
| 92 if (result) |
| 93 Dart_SetReturnValue(args, result); |
| 91 return; | 94 return; |
| 92 } | 95 } |
| 93 | 96 |
| 94 fail: | 97 fail: |
| 95 Dart_ThrowException(exception); | 98 Dart_ThrowException(exception); |
| 96 ASSERT_NOT_REACHED(); | 99 ASSERT_NOT_REACHED(); |
| 97 } | 100 } |
| 98 | 101 |
| 99 template <class ArrayClass, class DartArrayClass> | 102 template <class ArrayClass, class DartArrayClass> |
| 100 void setWebGLArrayHelper(Dart_NativeArguments args) | 103 void setWebGLArrayHelper(Dart_NativeArguments args) |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 172 |
| 170 fail: | 173 fail: |
| 171 Dart_ThrowException(exception); | 174 Dart_ThrowException(exception); |
| 172 ASSERT_NOT_REACHED(); | 175 ASSERT_NOT_REACHED(); |
| 173 } | 176 } |
| 174 | 177 |
| 175 } | 178 } |
| 176 | 179 |
| 177 } | 180 } |
| 178 #endif // DartArrayBufferViewCustom_h | 181 #endif // DartArrayBufferViewCustom_h |
| OLD | NEW |