本文整理汇总了C++中PassOwnPtr::data方法的典型用法代码示例。如果您正苦于以下问题:C++ PassOwnPtr::data方法的具体用法?C++ PassOwnPtr::data怎么用?C++ PassOwnPtr::data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PassOwnPtr
的用法示例。
在下文中一共展示了PassOwnPtr::data方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: didReceiveBinaryData
void WebSocketImpl::didReceiveBinaryData(PassOwnPtr<Vector<char> > binaryData)
{
#if ENABLE(WEB_SOCKETS)
switch (m_binaryType) {
case BinaryTypeData:
case BinaryTypeBlob: // FIXME: Handle Blob after supporting WebBlob.
m_client->didReceiveBinaryData(WebData(binaryData->data(), binaryData->size()));
break;
case BinaryTypeArrayBuffer:
m_client->didReceiveArrayBuffer(WebArrayBuffer(ArrayBuffer::create(binaryData->data(), binaryData->size())));
break;
}
#else
ASSERT_NOT_REACHED();
#endif
}
示例2: didReceiveBinaryData
void WebSocket::didReceiveBinaryData(PassOwnPtr<Vector<char> > binaryData)
{
WTF_LOG(Network, "WebSocket %p didReceiveBinaryData() %lu byte binary message", this, static_cast<unsigned long>(binaryData->size()));
switch (m_binaryType) {
case BinaryTypeBlob: {
size_t size = binaryData->size();
RefPtr<RawData> rawData = RawData::create();
binaryData->swap(*rawData->mutableData());
OwnPtr<BlobData> blobData = BlobData::create();
blobData->appendData(rawData.release(), 0, BlobDataItem::toEndOfFile);
RefPtrWillBeRawPtr<Blob> blob = Blob::create(BlobDataHandle::create(blobData.release(), size));
m_eventQueue->dispatch(MessageEvent::create(blob.release(), SecurityOrigin::create(m_url)->toString()));
break;
}
case BinaryTypeArrayBuffer:
RefPtr<ArrayBuffer> arrayBuffer = ArrayBuffer::create(binaryData->data(), binaryData->size());
if (!arrayBuffer) {
// Failed to allocate an ArrayBuffer. We need to crash the renderer
// since there's no way defined in the spec to tell this to the
// user.
CRASH();
}
m_eventQueue->dispatch(MessageEvent::create(arrayBuffer.release(), SecurityOrigin::create(m_url)->toString()));
break;
}
}
示例3: didReceiveDataUrl
// For data url's
void WebUrlLoaderClient::didReceiveDataUrl(PassOwnPtr<std::string> str)
{
if (!isActive() || !str->size())
return;
// didReceiveData will take a copy of the data
m_resourceHandle->client()->didReceiveData(m_resourceHandle.get(), str->data(), str->size(), str->size());
}
示例4: mainThreadSendArrayBuffer
void WorkerThreadableWebSocketChannel::mainThreadSendArrayBuffer(ScriptExecutionContext* context, Peer* peer, PassOwnPtr<Vector<char> > data)
{
ASSERT(isMainThread());
ASSERT_UNUSED(context, context->isDocument());
ASSERT(peer);
RefPtr<ArrayBuffer> arrayBuffer = ArrayBuffer::create(data->data(), data->size());
peer->send(*arrayBuffer);
}
示例5: ASSERT
void WorkerThreadableWebSocketChannel::Peer::sendArrayBuffer(PassOwnPtr<Vector<char> > data)
{
ASSERT(isMainThread());
if (!m_mainWebSocketChannel || !m_workerClientWrapper) {
m_syncHelper->setSendRequestResult(WebSocketChannel::SendFail);
} else {
RefPtr<ArrayBuffer> binaryData = ArrayBuffer::create(data->data(), data->size());
WebSocketChannel::SendResult sendRequestResult = m_mainWebSocketChannel->send(*binaryData, 0, binaryData->byteLength());
m_syncHelper->setSendRequestResult(sendRequestResult);
}
m_syncHelper->signalWorkerThread();
}
示例6: didReceiveBinaryData
void WebSocket::didReceiveBinaryData(PassOwnPtr<Vector<char>> binaryData)
{
LOG(Network, "WebSocket %p didReceiveBinaryData() %lu byte binary message", this, static_cast<unsigned long>(binaryData->size()));
switch (m_binaryType) {
case BinaryTypeBlob: {
// FIXME: We just received the data from NetworkProcess, and are sending it back. This is inefficient.
RefPtr<Blob> blob = Blob::create(std::move(*binaryData), emptyString());
dispatchEvent(MessageEvent::create(blob.release(), SecurityOrigin::create(m_url)->toString()));
break;
}
case BinaryTypeArrayBuffer:
dispatchEvent(MessageEvent::create(ArrayBuffer::create(binaryData->data(), binaryData->size()), SecurityOrigin::create(m_url)->toString()));
break;
}
}
示例7: didReceiveBinaryData
void WebSocket::didReceiveBinaryData(PassOwnPtr<Vector<char> > binaryData)
{
switch (m_binaryType) {
case BinaryTypeBlob: {
size_t size = binaryData->size();
RefPtr<RawData> rawData = RawData::create();
binaryData->swap(*rawData->mutableData());
OwnPtr<BlobData> blobData = BlobData::create();
blobData->appendData(rawData.release(), 0, BlobDataItem::toEndOfFile);
RefPtr<Blob> blob = Blob::create(blobData.release(), size);
dispatchEvent(MessageEvent::create(blob.release()));
break;
}
case BinaryTypeArrayBuffer:
dispatchEvent(MessageEvent::create(ArrayBuffer::create(binaryData->data(), binaryData->size())));
break;
}
}
示例8: didReceiveBinaryData
void WebSocket::didReceiveBinaryData(PassOwnPtr<Vector<char> > binaryData)
{
LOG(Network, "WebSocket %p didReceiveBinaryData() %lu byte binary message", this, static_cast<unsigned long>(binaryData->size()));
switch (m_binaryType) {
case BinaryTypeBlob: {
size_t size = binaryData->size();
RefPtr<RawData> rawData = RawData::create();
binaryData->swap(*rawData->mutableData());
OwnPtr<BlobData> blobData = BlobData::create();
blobData->appendData(rawData.release(), 0, BlobDataItem::toEndOfFile);
RefPtr<Blob> blob = Blob::create(blobData.release(), size);
dispatchEvent(MessageEvent::create(blob.release(), SecurityOrigin::create(m_url)->toString()));
break;
}
case BinaryTypeArrayBuffer:
dispatchEvent(MessageEvent::create(ArrayBuffer::create(binaryData->data(), binaryData->size()), SecurityOrigin::create(m_url)->toString()));
break;
}
}
示例9: workerGlobalScopeDidReceiveData
static void workerGlobalScopeDidReceiveData(ScriptExecutionContext* context, RefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, PassOwnPtr<Vector<char> > vectorData)
{
ASSERT_UNUSED(context, context->isWorkerGlobalScope());
workerClientWrapper->didReceiveData(vectorData->data(), vectorData->size());
}
示例10: appendRawBytesFromMainThread
void BackgroundHTMLParser::appendRawBytesFromMainThread(PassOwnPtr<Vector<char>> buffer)
{
ASSERT(m_decoder);
updateDocument(m_decoder->decode(buffer->data(), buffer->size()));
}