| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 constructWebGLArrayWithArrayBufferArgument<DataView, char>(args, &info, v8::
kExternalByteArray, false); | 50 constructWebGLArrayWithArrayBufferArgument<DataView, char>(args, &info, v8::
kExternalByteArray, false); |
| 51 } | 51 } |
| 52 | 52 |
| 53 // FIXME: Don't need this override. | 53 // FIXME: Don't need this override. |
| 54 v8::Handle<v8::Object> wrap(DataView* impl, v8::Handle<v8::Object> creationConte
xt, v8::Isolate* isolate) | 54 v8::Handle<v8::Object> wrap(DataView* impl, v8::Handle<v8::Object> creationConte
xt, v8::Isolate* isolate) |
| 55 { | 55 { |
| 56 ASSERT(impl); | 56 ASSERT(impl); |
| 57 return V8DataView::createWrapper(impl, creationContext, isolate); | 57 return V8DataView::createWrapper(impl, creationContext, isolate); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void V8DataView::getInt8MethodCustom(const v8::FunctionCallbackInfo<v8::Value>&
args) | |
| 61 { | |
| 62 if (args.Length() < 1) { | |
| 63 throwNotEnoughArgumentsError(args.GetIsolate()); | |
| 64 return; | |
| 65 } | |
| 66 | |
| 67 DataView* imp = V8DataView::toNative(args.Holder()); | |
| 68 ExceptionCode ec = 0; | |
| 69 V8TRYCATCH_VOID(unsigned, byteOffset, toUInt32(args[0])); | |
| 70 int8_t result = imp->getInt8(byteOffset, ec); | |
| 71 if (UNLIKELY(ec)) { | |
| 72 setDOMException(ec, args.GetIsolate()); | |
| 73 return; | |
| 74 } | |
| 75 v8SetReturnValue(args, result); | |
| 76 } | |
| 77 | |
| 78 void V8DataView::getUint8MethodCustom(const v8::FunctionCallbackInfo<v8::Value>&
args) | |
| 79 { | |
| 80 if (args.Length() < 1) { | |
| 81 throwNotEnoughArgumentsError(args.GetIsolate()); | |
| 82 return; | |
| 83 } | |
| 84 | |
| 85 DataView* imp = V8DataView::toNative(args.Holder()); | |
| 86 ExceptionCode ec = 0; | |
| 87 V8TRYCATCH_VOID(unsigned, byteOffset, toUInt32(args[0])); | |
| 88 uint8_t result = imp->getUint8(byteOffset, ec); | |
| 89 if (UNLIKELY(ec)) { | |
| 90 setDOMException(ec, args.GetIsolate()); | |
| 91 return; | |
| 92 } | |
| 93 v8SetReturnValue(args, result); | |
| 94 } | |
| 95 | |
| 96 void V8DataView::setInt8MethodCustom(const v8::FunctionCallbackInfo<v8::Value>&
args) | |
| 97 { | |
| 98 if (args.Length() < 2) { | |
| 99 throwNotEnoughArgumentsError(args.GetIsolate()); | |
| 100 return; | |
| 101 } | |
| 102 | |
| 103 DataView* imp = V8DataView::toNative(args.Holder()); | |
| 104 ExceptionCode ec = 0; | |
| 105 V8TRYCATCH_VOID(unsigned, byteOffset, toUInt32(args[0])); | |
| 106 V8TRYCATCH_VOID(int, value, toInt32(args[1])); | |
| 107 imp->setInt8(byteOffset, static_cast<int8_t>(value), ec); | |
| 108 if (UNLIKELY(ec)) { | |
| 109 setDOMException(ec, args.GetIsolate()); | |
| 110 return; | |
| 111 } | |
| 112 } | |
| 113 | |
| 114 void V8DataView::setUint8MethodCustom(const v8::FunctionCallbackInfo<v8::Value>&
args) | |
| 115 { | |
| 116 if (args.Length() < 2) { | |
| 117 throwNotEnoughArgumentsError(args.GetIsolate()); | |
| 118 return; | |
| 119 } | |
| 120 | |
| 121 DataView* imp = V8DataView::toNative(args.Holder()); | |
| 122 ExceptionCode ec = 0; | |
| 123 V8TRYCATCH_VOID(unsigned, byteOffset, toUInt32(args[0])); | |
| 124 V8TRYCATCH_VOID(int, value, toInt32(args[1])); | |
| 125 imp->setUint8(byteOffset, static_cast<uint8_t>(value), ec); | |
| 126 if (UNLIKELY(ec)) { | |
| 127 setDOMException(ec, args.GetIsolate()); | |
| 128 return; | |
| 129 } | |
| 130 } | |
| 131 | |
| 132 } // namespace WebCore | 60 } // namespace WebCore |
| OLD | NEW |