Chromium Code Reviews| 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 27 matching lines...) Expand all Loading... | |
| 38 namespace WebCore { | 38 namespace WebCore { |
| 39 | 39 |
| 40 namespace DartArrayBufferViewInternal { | 40 namespace DartArrayBufferViewInternal { |
| 41 | 41 |
| 42 template<class ArrayClass, class ElementType> | 42 template<class ArrayClass, class ElementType> |
| 43 void constructWebGLArray(Dart_NativeArguments args) | 43 void constructWebGLArray(Dart_NativeArguments args) |
| 44 { | 44 { |
| 45 DartApiScope dartApiScope; | 45 DartApiScope dartApiScope; |
| 46 Dart_Handle exception; | 46 Dart_Handle exception; |
| 47 { | 47 { |
| 48 Dart_Handle arg1 = Dart_GetNativeArgument(args, 1); | 48 Dart_Handle arg1 = Dart_GetNativeArgument(args, 0); |
|
antonm
2012/01/25 18:56:40
shouldn't you rename construct into something else
podivilov
2012/01/25 19:04:05
I think construct is the right name, as we constru
Anton Muhin
2012/01/26 12:13:35
I think factory is ways better.
My understanding:
podivilov
2012/01/30 18:27:54
Done.
| |
| 49 RefPtr<ArrayClass> array; | 49 RefPtr<ArrayClass> array; |
| 50 if (Dart_IsNumber(arg1)) { | 50 if (Dart_IsNumber(arg1)) { |
| 51 ParameterAdapter<int> length(arg1); | 51 ParameterAdapter<int> length(arg1); |
| 52 if (!length.conversionSuccessful()) { | 52 if (!length.conversionSuccessful()) { |
| 53 exception = length.exception(); | 53 exception = length.exception(); |
| 54 goto fail; | 54 goto fail; |
| 55 } | 55 } |
| 56 array = ArrayClass::create(length); | 56 array = ArrayClass::create(length); |
| 57 } else { | 57 } else { |
| 58 ParameterAdapter< Vector<ElementType> > list(arg1); | 58 ParameterAdapter< Vector<ElementType> > list(arg1); |
| 59 if (!list.conversionSuccessful()) { | 59 if (!list.conversionSuccessful()) { |
| 60 exception = list.exception(); | 60 exception = list.exception(); |
| 61 goto fail; | 61 goto fail; |
| 62 } | 62 } |
| 63 array = ArrayClass::create(list->data(), list->size()); | 63 array = ArrayClass::create(list->data(), list->size()); |
| 64 } | 64 } |
| 65 // FIXME: also process 3 argument constructor. | 65 // FIXME: also process 3 argument constructor. |
| 66 DartDOMWrapper::bindDOMObjectToDartWrapper(array.get(), Dart_GetNativeAr gument(args, 0)); | 66 Dart_Handle result = toDartValue(array.get()); |
| 67 if (result) | |
|
Anton Muhin
2012/01/26 12:13:35
care to add comment why you don't use ::returnValu
| |
| 68 Dart_SetReturnValue(args, result); | |
| 67 return; | 69 return; |
| 68 } | 70 } |
| 69 | 71 |
| 70 fail: | 72 fail: |
| 71 Dart_ThrowException(exception); | 73 Dart_ThrowException(exception); |
| 72 ASSERT_NOT_REACHED(); | 74 ASSERT_NOT_REACHED(); |
| 73 } | 75 } |
| 74 | 76 |
| 75 template <class ArrayClass, class DartArrayClass> | 77 template <class ArrayClass, class DartArrayClass> |
| 76 void setWebGLArrayHelper(Dart_NativeArguments args) | 78 void setWebGLArrayHelper(Dart_NativeArguments args) |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 | 147 |
| 146 fail: | 148 fail: |
| 147 Dart_ThrowException(exception); | 149 Dart_ThrowException(exception); |
| 148 ASSERT_NOT_REACHED(); | 150 ASSERT_NOT_REACHED(); |
| 149 } | 151 } |
| 150 | 152 |
| 151 } | 153 } |
| 152 | 154 |
| 153 } | 155 } |
| 154 #endif // DartArrayBufferViewCustom_h | 156 #endif // DartArrayBufferViewCustom_h |
| OLD | NEW |