本文整理汇总了C++中ipc::DataReference类的典型用法代码示例。如果您正苦于以下问题:C++ DataReference类的具体用法?C++ DataReference怎么用?C++ DataReference使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DataReference类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: adoptGRef
bool ArgumentCoder<CertificateInfo>::decode(ArgumentDecoder& decoder, CertificateInfo& certificateInfo)
{
bool hasCertificate;
if (!decoder.decode(hasCertificate))
return false;
if (!hasCertificate)
return true;
IPC::DataReference certificateDataReference;
if (!decoder.decodeVariableLengthByteArray(certificateDataReference))
return false;
GByteArray* certificateData = g_byte_array_sized_new(certificateDataReference.size());
certificateData = g_byte_array_append(certificateData, certificateDataReference.data(), certificateDataReference.size());
GRefPtr<GByteArray> certificateBytes = adoptGRef(certificateData);
GTlsBackend* backend = g_tls_backend_get_default();
GRefPtr<GTlsCertificate> certificate = adoptGRef(G_TLS_CERTIFICATE(g_initable_new(
g_tls_backend_get_certificate_type(backend), 0, 0, "certificate", certificateBytes.get(), nullptr)));
certificateInfo.setCertificate(certificate.get());
uint32_t tlsErrors;
if (!decoder.decode(tlsErrors))
return false;
certificateInfo.setTLSErrors(static_cast<GTlsCertificateFlags>(tlsErrors));
return true;
}
示例2:
Vector<uint8_t> CompositingManager::authenticate()
{
IPC::DataReference data;
m_connection->sendSync(Messages::CompositingManagerProxy::Authenticate(),
Messages::CompositingManagerProxy::Authenticate::Reply(data), 0);
return data.vector();
}
示例3: createData
static RefPtr<API::Data> createData(const IPC::DataReference& data)
{
if (data.isEmpty())
return 0;
return API::Data::create(data.data(), data.size());
}
示例4: didHandleURIRequest
void WebSoupRequestManager::didHandleURIRequest(const IPC::DataReference& requestData, uint64_t contentLength, const String& mimeType, uint64_t requestID)
{
WebSoupRequestAsyncData* data = m_requestMap.get(requestID);
ASSERT(data);
GRefPtr<GTask> task = data->releaseTask();
ASSERT(task.get());
WebKitSoupRequestGeneric* request = WEBKIT_SOUP_REQUEST_GENERIC(g_task_get_source_object(task.get()));
webkitSoupRequestGenericSetContentLength(request, contentLength ? contentLength : -1);
webkitSoupRequestGenericSetContentType(request, !mimeType.isEmpty() ? mimeType.utf8().data() : 0);
GInputStream* dataStream;
if (!requestData.size()) {
// Empty reply, just create and empty GMemoryInputStream.
dataStream = g_memory_input_stream_new();
m_requestMap.remove(requestID);
} else if (requestData.size() == contentLength) {
// We don't expect more data, so we can just create a GMemoryInputStream with all the data.
dataStream = g_memory_input_stream_new_from_data(g_memdup(requestData.data(), requestData.size()), contentLength, g_free);
m_requestMap.remove(requestID);
} else {
// We expect more data chunks from the UI process.
dataStream = webkitSoupRequestInputStreamNew(contentLength);
data->stream = dataStream;
webkitSoupRequestInputStreamAddData(WEBKIT_SOUP_REQUEST_INPUT_STREAM(dataStream), requestData.data(), requestData.size());
}
g_task_return_pointer(task.get(), dataStream, g_object_unref);
}
示例5: setIconDataForIconURL
void WebIconDatabase::setIconDataForIconURL(const IPC::DataReference& iconData, const String& iconURL)
{
LOG(IconDatabase, "WK2 UIProcess setting icon data (%i bytes) for page URL %s", (int)iconData.size(), iconURL.ascii().data());
if (!m_iconDatabaseImpl)
return;
m_iconDatabaseImpl->setIconDataForIconURL(SharedBuffer::create(iconData.data(), iconData.size()), iconURL);
}
示例6: decode
bool Data::decode(IPC::ArgumentDecoder& decoder, RefPtr<API::Object>& result)
{
IPC::DataReference dataReference;
if (!decoder.decode(dataReference))
return false;
result = create(dataReference.data(), dataReference.size());
return true;
}
示例7: decodeBytes
bool DecoderAdapter::decodeBytes(Vector<uint8_t>& bytes)
{
IPC::DataReference dataReference;
if (!m_decoder.decode(dataReference))
return false;
bytes = dataReference.vector();
return true;
}
示例8: didReceiveData
void WebResourceLoader::didReceiveData(const IPC::DataReference& data, int64_t encodedDataLength)
{
LOG(Network, "(WebProcess) WebResourceLoader::didReceiveData of size %i for '%s'", (int)data.size(), m_coreLoader->url().string().utf8().data());
#if USE(QUICK_LOOK)
if (QuickLookHandle* quickLookHandle = m_coreLoader->documentLoader()->quickLookHandle()) {
if (quickLookHandle->didReceiveData(adoptCF(CFDataCreate(kCFAllocatorDefault, data.data(), data.size())).get()))
return;
}
#endif
m_coreLoader->didReceiveData(reinterpret_cast<const char*>(data.data()), data.size(), encodedDataLength, DataPayloadBytes);
}
示例9: decode
bool NetworkResourceLoadParameters::decode(IPC::ArgumentDecoder& decoder, NetworkResourceLoadParameters& result)
{
if (!decoder.decode(result.identifier))
return false;
if (!decoder.decode(result.webPageID))
return false;
if (!decoder.decode(result.webFrameID))
return false;
if (!decoder.decode(result.sessionID))
return false;
if (!decoder.decode(result.request))
return false;
bool hasHTTPBody;
if (!decoder.decode(hasHTTPBody))
return false;
if (hasHTTPBody) {
IPC::DataReference formData;
if (!decoder.decode(formData))
return false;
DecoderAdapter httpBodyDecoderAdapter(formData.data(), formData.size());
result.request.setHTTPBody(FormData::decode(httpBodyDecoderAdapter));
if (!decoder.decode(result.requestBodySandboxExtensions))
return false;
}
if (result.request.url().isLocalFile()) {
if (!decoder.decode(result.resourceSandboxExtension))
return false;
}
if (!decoder.decodeEnum(result.priority))
return false;
if (!decoder.decodeEnum(result.contentSniffingPolicy))
return false;
if (!decoder.decodeEnum(result.allowStoredCredentials))
return false;
if (!decoder.decodeEnum(result.clientCredentialPolicy))
return false;
if (!decoder.decode(result.shouldClearReferrerOnHTTPSToHTTPRedirect))
return false;
if (!decoder.decode(result.isMainResource))
return false;
return true;
}
示例10: addBackForwardItem
void WebProcessProxy::addBackForwardItem(uint64_t itemID, const String& originalURL, const String& url, const String& title, const IPC::DataReference& backForwardData)
{
MESSAGE_CHECK_URL(originalURL);
MESSAGE_CHECK_URL(url);
WebBackForwardListItemMap::AddResult result = m_backForwardListItemMap.add(itemID, nullptr);
if (result.isNewEntry) {
result.iterator->value = WebBackForwardListItem::create(originalURL, url, title, backForwardData.data(), backForwardData.size(), itemID);
return;
}
// Update existing item.
result.iterator->value->setOriginalURL(originalURL);
result.iterator->value->setURL(url);
result.iterator->value->setTitle(title);
result.iterator->value->setBackForwardData(backForwardData.data(), backForwardData.size());
}
示例11: didLoadData
void CustomProtocolManagerImpl::didLoadData(uint64_t customProtocolID, const IPC::DataReference& dataReference)
{
WebSoupRequestAsyncData* data = m_customProtocolMap.get(customProtocolID);
// The data might have been removed from the request map if a previous chunk failed
// and a new message was sent by the UI process before being notified about the failure.
if (!data)
return;
if (!data->stream) {
GRefPtr<GTask> task = data->releaseTask();
ASSERT(task.get());
goffset soupContentLength = soup_request_get_content_length(SOUP_REQUEST(g_task_get_source_object(task.get())));
uint64_t contentLength = soupContentLength == -1 ? 0 : static_cast<uint64_t>(soupContentLength);
if (!dataReference.size()) {
// Empty reply, just create and empty GMemoryInputStream.
data->stream = g_memory_input_stream_new();
} else if (dataReference.size() == contentLength) {
// We don't expect more data, so we can just create a GMemoryInputStream with all the data.
data->stream = g_memory_input_stream_new_from_data(g_memdup(dataReference.data(), dataReference.size()), contentLength, g_free);
} else {
// We expect more data chunks from the UI process.
data->stream = webkitSoupRequestInputStreamNew(contentLength);
webkitSoupRequestInputStreamAddData(WEBKIT_SOUP_REQUEST_INPUT_STREAM(data->stream.get()), dataReference.data(), dataReference.size());
}
g_task_return_pointer(task.get(), data->stream.get(), g_object_unref);
return;
}
if (data->requestFailed()) {
// ResourceRequest failed or it was cancelled. It doesn't matter here the error or if it was cancelled,
// because that's already handled by the resource handle client, we just want to notify the UI process
// to stop reading data from the user input stream. If UI process already sent all the data we simply
// finish silently.
if (!webkitSoupRequestInputStreamFinished(WEBKIT_SOUP_REQUEST_INPUT_STREAM(data->stream.get())))
m_childProcess->send(Messages::CustomProtocolManagerProxy::StopLoading(customProtocolID), 0);
return;
}
webkitSoupRequestInputStreamAddData(WEBKIT_SOUP_REQUEST_INPUT_STREAM(data->stream.get()), dataReference.data(), dataReference.size());
}
示例12: didPostMessage
void WebUserContentControllerProxy::didPostMessage(IPC::Connection& connection, uint64_t pageID, uint64_t frameID, const WebCore::SecurityOriginData& securityOrigin, uint64_t messageHandlerID, const IPC::DataReference& dataReference)
{
WebPageProxy* page = WebProcessProxy::webPage(pageID);
if (!page)
return;
WebProcessProxy* webProcess = WebProcessProxy::fromConnection(&connection);
WebFrameProxy* frame = webProcess->webFrame(frameID);
if (!frame)
return;
if (!HashMap<uint64_t, RefPtr<WebScriptMessageHandler>>::isValidKey(messageHandlerID))
return;
RefPtr<WebScriptMessageHandler> handler = m_scriptMessageHandlers.get(messageHandlerID);
if (!handler)
return;
auto buffer = dataReference.vector();
RefPtr<WebCore::SerializedScriptValue> value = WebCore::SerializedScriptValue::adopt(buffer);
handler->client().didPostMessage(*page, *frame, securityOrigin, *value);
}
示例13: didReceiveURIRequestData
void WebSoupRequestManager::didReceiveURIRequestData(const IPC::DataReference& requestData, uint64_t requestID)
{
WebSoupRequestAsyncData* data = m_requestMap.get(requestID);
// The data might have been removed from the request map if a previous chunk failed
// and a new message was sent by the UI process before being notified about the failure.
if (!data)
return;
ASSERT(data->stream.get());
if (data->requestFailed()) {
// ResourceRequest failed or it was cancelled. It doesn't matter here the error or if it was cancelled,
// because that's already handled by the resource handle client, we just want to notify the UI process
// to stop reading data from the user input stream. If UI process already sent all the data we simply
// finish silently.
if (!webkitSoupRequestInputStreamFinished(WEBKIT_SOUP_REQUEST_INPUT_STREAM(data->stream.get())))
m_process->parentProcessConnection()->send(Messages::WebSoupRequestManagerProxy::DidFailToLoadURIRequest(requestID), 0);
m_requestMap.remove(requestID);
return;
}
webkitSoupRequestInputStreamAddData(WEBKIT_SOUP_REQUEST_INPUT_STREAM(data->stream.get()), requestData.data(), requestData.size());
if (webkitSoupRequestInputStreamFinished(WEBKIT_SOUP_REQUEST_INPUT_STREAM(data->stream.get())))
m_requestMap.remove(requestID);
}
示例14: decode
bool UserData::decode(IPC::ArgumentDecoder& decoder, RefPtr<API::Object>& result)
{
API::Object::Type type;
if (!decoder.decodeEnum(type))
return false;
switch (type) {
case API::Object::Type::Array: {
uint64_t size;
if (!decoder.decode(size))
return false;
Vector<RefPtr<API::Object>> elements;
for (size_t i = 0; i < size; ++i) {
RefPtr<API::Object> element;
if (!decode(decoder, element))
return false;
elements.append(std::move(element));
}
result = API::Array::create(std::move(elements));
break;
}
case API::Object::Type::Boolean:
if (!API::Boolean::decode(decoder, result))
return false;
break;
case API::Object::Type::Data:
if (!API::Data::decode(decoder, result))
return false;
break;
case API::Object::Type::Dictionary: {
uint64_t size;
if (!decoder.decode(size))
return false;
ImmutableDictionary::MapType map;
for (size_t i = 0; i < size; ++i) {
String key;
if (!decoder.decode(key))
return false;
RefPtr<API::Object> value;
if (!decode(decoder, value))
return false;
if (!map.add(std::move(key), std::move(value)).isNewEntry)
return false;
}
result = ImmutableDictionary::create(std::move(map));
break;
}
case API::Object::Type::Double:
if (!API::Double::decode(decoder, result))
return false;
break;
case API::Object::Type::Error:
if (!API::Error::decode(decoder, result))
return false;
break;
case API::Object::Type::FrameHandle: {
uint64_t frameID;
if (!decoder.decode(frameID))
return false;
result = API::FrameHandle::create(frameID);
break;
}
case API::Object::Type::Null:
result = nullptr;
break;
case API::Object::Type::Point:
if (!API::Point::decode(decoder, result))
return false;
break;
case API::Object::Type::Rect:
if (!API::Rect::decode(decoder, result))
return false;
break;
case API::Object::Type::SerializedScriptValue: {
IPC::DataReference dataReference;
if (!decoder.decode(dataReference))
return false;
auto vector = dataReference.vector();
result = WebSerializedScriptValue::adopt(vector);
break;
}
//.........这里部分代码省略.........
示例15: commitBuffer
void CompositingManagerProxy::commitBuffer(const IPC::Attachment& fd, const IPC::DataReference& bufferData)
{
m_view.viewBackend().commitBuffer(fd.fileDescriptor(), bufferData.data(), bufferData.size());
}