| 135 | #include "buffer_new_or_copy-inl.h" |
| 136 | |
| 137 | void CheckBuffer(const CallbackInfo& info) { |
| 138 | if (!info[0].IsBuffer()) { |
| 139 | Error::New(info.Env(), "A buffer was expected.") |
| 140 | .ThrowAsJavaScriptException(); |
| 141 | return; |
| 142 | } |
| 143 | |
| 144 | Buffer<uint16_t> buffer = info[0].As<Buffer<uint16_t>>(); |
| 145 | |
| 146 | if (buffer.Length() != testLength) { |
| 147 | Error::New(info.Env(), "Incorrect buffer length.") |
| 148 | .ThrowAsJavaScriptException(); |
| 149 | return; |
| 150 | } |
| 151 | |
| 152 | if (!VerifyData(buffer.Data(), testLength)) { |
| 153 | Error::New(info.Env(), "Incorrect buffer data.") |
| 154 | .ThrowAsJavaScriptException(); |
| 155 | return; |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | Value GetFinalizeCount(const CallbackInfo& info) { |
| 160 | return Number::New(info.Env(), finalizeCount); |
nothing calls this directly
no test coverage detected