本文整理汇总了C++中Uint8Array类的典型用法代码示例。如果您正苦于以下问题:C++ Uint8Array类的具体用法?C++ Uint8Array怎么用?C++ Uint8Array使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Uint8Array类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ParseFromBuffer
already_AddRefed<nsIDocument>
DOMParser::ParseFromBuffer(const Uint8Array& aBuf, SupportedType aType,
ErrorResult& aRv)
{
aBuf.ComputeLengthAndData();
return ParseFromBuffer(MakeSpan(aBuf.Data(), aBuf.Length()), aType, aRv);
}
开发者ID:artines1,项目名称:gecko-dev,代码行数:7,代码来源:DOMParser.cpp
示例2: jsUint8ArrayPrototypeFunctionSubarray
EncodedJSValue JSC_HOST_CALL jsUint8ArrayPrototypeFunctionSubarray(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSUint8Array::s_info))
return throwVMTypeError(exec);
JSUint8Array* castedThis = static_cast<JSUint8Array*>(asObject(thisValue));
ASSERT_GC_OBJECT_INHERITS(castedThis, &JSUint8Array::s_info);
Uint8Array* imp = static_cast<Uint8Array*>(castedThis->impl());
int start(exec->argument(0).toInt32(exec));
if (exec->hadException())
return JSValue::encode(jsUndefined());
int argsCount = exec->argumentCount();
if (argsCount <= 1) {
JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->subarray(start)));
return JSValue::encode(result);
}
int end(exec->argument(1).toInt32(exec));
if (exec->hadException())
return JSValue::encode(jsUndefined());
JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->subarray(start, end)));
return JSValue::encode(result);
}
开发者ID:mulriple,项目名称:Webkit-Projects,代码行数:27,代码来源:JSUint8Array.cpp
示例3: jsUint8ArrayLength
JSValue jsUint8ArrayLength(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSUint8Array* castedThis = static_cast<JSUint8Array*>(asObject(slotBase));
UNUSED_PARAM(exec);
Uint8Array* imp = static_cast<Uint8Array*>(castedThis->impl());
JSValue result = jsNumber(imp->length());
return result;
}
开发者ID:mulriple,项目名称:Webkit-Projects,代码行数:8,代码来源:JSUint8Array.cpp
示例4:
void
AnalyserNode::GetByteTimeDomainData(const Uint8Array& aArray)
{
unsigned char* buffer = aArray.Data();
uint32_t length = std::min(aArray.Length(), mBuffer.Length());
for (uint32_t i = 0; i < length; ++i) {
const float value = mBuffer[(i + mWriteIndex) % mBuffer.Length()];
// scale the value to the range of [0, UCHAR_MAX]
const float scaled = std::max(0.0f, std::min(float(UCHAR_MAX),
128.0f * (value + 1.0f)));
buffer[i] = static_cast<unsigned char>(scaled);
}
}
开发者ID:JuannyWang,项目名称:gecko-dev,代码行数:14,代码来源:AnalyserNode.cpp
示例5: task
void
CDMProxy::SetServerCertificate(PromiseId aPromiseId,
const Uint8Array& aCert)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(mGMPThread);
nsAutoPtr<SetServerCertificateData> data;
data->mPromiseId = aPromiseId;
data->mCert.AppendElements(aCert.Data(), aCert.Length());
nsRefPtr<nsIRunnable> task(
NS_NewRunnableMethodWithArg<nsAutoPtr<SetServerCertificateData>>(this, &CDMProxy::gmp_SetServerCertificate, data));
mGMPThread->Dispatch(task, NS_DISPATCH_NORMAL);
}
开发者ID:chenhequn,项目名称:gecko,代码行数:14,代码来源:CDMProxy.cpp
示例6: document
already_AddRefed<nsIDocument>
nsDOMParser::ParseFromBuffer(const Uint8Array& aBuf, uint32_t aBufLen,
SupportedType aType, ErrorResult& rv)
{
if (aBufLen > aBuf.Length()) {
rv.Throw(NS_ERROR_XPC_NOT_ENOUGH_ELEMENTS_IN_ARRAY);
return nullptr;
}
nsCOMPtr<nsIDOMDocument> domDocument;
rv = nsDOMParser::ParseFromBuffer(aBuf.Data(), aBufLen,
SupportedTypeValues::strings[aType].value,
getter_AddRefs(domDocument));
nsCOMPtr<nsIDocument> document(do_QueryInterface(domDocument));
return document.forget();
}
开发者ID:,项目名称:,代码行数:15,代码来源:
示例7: promise
already_AddRefed<Promise>
MediaKeys::CreateSession(const nsAString& initDataType,
const Uint8Array& aInitData,
SessionType aSessionType,
ErrorResult& aRv)
{
aInitData.ComputeLengthAndData();
nsRefPtr<Promise> promise(MakePromise(aRv));
if (aRv.Failed()) {
return nullptr;
}
nsRefPtr<MediaKeySession> session = new MediaKeySession(GetParentObject(),
this,
mKeySystem,
aSessionType, aRv);
if (aRv.Failed()) {
return nullptr;
}
auto pid = StorePromise(promise);
// Hang onto session until the CDM has finished setting it up.
mPendingSessions.Put(pid, session);
mProxy->CreateSession(aSessionType,
pid,
initDataType,
aInitData);
return promise.forget();
}
开发者ID:andrenatal,项目名称:gecko-dev,代码行数:29,代码来源:MediaKeys.cpp
示例8: data
void
CDMProxy::UpdateSession(const nsAString& aSessionId,
PromiseId aPromiseId,
const Uint8Array& aResponse)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(mGMPThread);
NS_ENSURE_TRUE_VOID(!mKeys.IsNull());
nsAutoPtr<UpdateSessionData> data(new UpdateSessionData());
data->mPromiseId = aPromiseId;
data->mSessionId = NS_ConvertUTF16toUTF8(aSessionId);
data->mResponse.AppendElements(aResponse.Data(), aResponse.Length());
nsRefPtr<nsIRunnable> task(
NS_NewRunnableMethodWithArg<nsAutoPtr<UpdateSessionData>>(this, &CDMProxy::gmp_UpdateSession, data));
mGMPThread->Dispatch(task, NS_DISPATCH_NORMAL);
}
开发者ID:chenhequn,项目名称:gecko,代码行数:17,代码来源:CDMProxy.cpp
示例9: initializeNewSession
void MediaKeySession::initializeNewSession(const String& mimeType, const Uint8Array& initData)
{
ASSERT(!m_isClosed);
m_session->initializeNewSession(mimeType, initData.data(), initData.length());
}
开发者ID:,项目名称:,代码行数:5,代码来源:
注:本文中的Uint8Array类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论