本文整理汇总了C++中ipc::DataReference::size方法的典型用法代码示例。如果您正苦于以下问题:C++ DataReference::size方法的具体用法?C++ DataReference::size怎么用?C++ DataReference::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ipc::DataReference
的用法示例。
在下文中一共展示了DataReference::size方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: 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;
}
示例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: 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);
}
示例5: 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;
}
示例6: 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());
}
示例7: 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);
}
示例8: 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;
}
示例9: 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());
}
示例10: 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);
}
示例11: commitBuffer
void CompositingManagerProxy::commitBuffer(const IPC::Attachment& fd, const IPC::DataReference& bufferData)
{
m_view.viewBackend().commitBuffer(fd.fileDescriptor(), bufferData.data(), bufferData.size());
}
示例12: decode
//.........这里部分代码省略.........
if (!decoder.decode(parameters.urlSchemesRegistered))
return false;
#endif
if (!decoder.decode(parameters.cookiePersistentStoragePath))
return false;
if (!decoder.decode(parameters.cookiePersistentStorageType))
return false;
if (!decoder.decodeEnum(parameters.cookieAcceptPolicy))
return false;
if (!decoder.decode(parameters.ignoreTLSErrors))
return false;
#endif
if (!decoder.decodeEnum(parameters.cacheModel))
return false;
if (!decoder.decode(parameters.shouldAlwaysUseComplexTextCodePath))
return false;
if (!decoder.decode(parameters.shouldUseFontSmoothing))
return false;
if (!decoder.decode(parameters.iconDatabaseEnabled))
return false;
if (!decoder.decode(parameters.terminationTimeout))
return false;
if (!decoder.decode(parameters.languages))
return false;
if (!decoder.decode(parameters.textCheckerState))
return false;
if (!decoder.decode(parameters.fullKeyboardAccessEnabled))
return false;
if (!decoder.decode(parameters.defaultRequestTimeoutInterval))
return false;
#if PLATFORM(COCOA) || USE(CFNETWORK)
if (!decoder.decode(parameters.uiProcessBundleIdentifier))
return false;
#endif
#if PLATFORM(COCOA)
if (!decoder.decode(parameters.presenterApplicationPid))
return false;
if (!decoder.decode(parameters.accessibilityEnhancedUserInterfaceEnabled))
return false;
if (!decoder.decode(parameters.nsURLCacheMemoryCapacity))
return false;
if (!decoder.decode(parameters.nsURLCacheDiskCapacity))
return false;
if (!decoder.decode(parameters.acceleratedCompositingPort))
return false;
if (!decoder.decode(parameters.uiProcessBundleResourcePath))
return false;
if (!decoder.decode(parameters.uiProcessBundleResourcePathExtensionHandle))
return false;
if (!decoder.decode(parameters.shouldForceScreenFontSubstitution))
return false;
if (!decoder.decode(parameters.shouldEnableKerningAndLigaturesByDefault))
return false;
if (!decoder.decode(parameters.shouldEnableJIT))
return false;
if (!decoder.decode(parameters.shouldEnableFTLJIT))
return false;
if (!decoder.decode(parameters.shouldEnableMemoryPressureReliefLogging))
return false;
bool hasBundleParameterData;
if (!decoder.decode(hasBundleParameterData))
return false;
if (hasBundleParameterData) {
IPC::DataReference dataReference;
if (!decoder.decode(dataReference))
return false;
parameters.bundleParameterData = API::Data::create(dataReference.data(), dataReference.size());
}
#endif
#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
if (!decoder.decode(parameters.notificationPermissions))
return false;
#endif
#if ENABLE(NETWORK_PROCESS)
if (!decoder.decode(parameters.usesNetworkProcess))
return false;
#endif
if (!decoder.decode(parameters.plugInAutoStartOriginHashes))
return false;
if (!decoder.decode(parameters.plugInAutoStartOrigins))
return false;
if (!decoder.decode(parameters.memoryCacheDisabled))
return false;
#if ENABLE(SERVICE_CONTROLS)
if (!decoder.decode(parameters.hasImageServices))
return false;
if (!decoder.decode(parameters.hasSelectionServices))
return false;
#endif
return true;
}
示例13: decode
//.........这里部分代码省略.........
return false;
if (!decoder.decode(parameters.urlSchemesRegisteredAsAlwaysRevalidated))
return false;
#if ENABLE(CACHE_PARTITIONING)
if (!decoder.decode(parameters.urlSchemesRegisteredAsCachePartitioned))
return false;
#endif
if (!decoder.decodeEnum(parameters.cacheModel))
return false;
if (!decoder.decode(parameters.shouldAlwaysUseComplexTextCodePath))
return false;
if (!decoder.decode(parameters.shouldEnableMemoryPressureReliefLogging))
return false;
if (!decoder.decode(parameters.shouldSuppressMemoryPressureHandler))
return false;
if (!decoder.decode(parameters.shouldUseFontSmoothing))
return false;
if (!decoder.decode(parameters.resourceLoadStatisticsEnabled))
return false;
if (!decoder.decode(parameters.fontWhitelist))
return false;
if (!decoder.decode(parameters.iconDatabaseEnabled))
return false;
if (!decoder.decode(parameters.terminationTimeout))
return false;
if (!decoder.decode(parameters.languages))
return false;
if (!decoder.decode(parameters.textCheckerState))
return false;
if (!decoder.decode(parameters.fullKeyboardAccessEnabled))
return false;
if (!decoder.decode(parameters.defaultRequestTimeoutInterval))
return false;
#if PLATFORM(COCOA) || USE(CFNETWORK)
if (!decoder.decode(parameters.uiProcessBundleIdentifier))
return false;
#endif
#if PLATFORM(COCOA)
if (!decoder.decode(parameters.presenterApplicationPid))
return false;
if (!decoder.decode(parameters.accessibilityEnhancedUserInterfaceEnabled))
return false;
if (!decoder.decode(parameters.acceleratedCompositingPort))
return false;
if (!decoder.decode(parameters.uiProcessBundleResourcePath))
return false;
if (!decoder.decode(parameters.uiProcessBundleResourcePathExtensionHandle))
return false;
if (!decoder.decode(parameters.shouldEnableJIT))
return false;
if (!decoder.decode(parameters.shouldEnableFTLJIT))
return false;
bool hasBundleParameterData;
if (!decoder.decode(hasBundleParameterData))
return false;
if (hasBundleParameterData) {
IPC::DataReference dataReference;
if (!decoder.decode(dataReference))
return false;
parameters.bundleParameterData = API::Data::create(dataReference.data(), dataReference.size());
}
#endif
#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
if (!decoder.decode(parameters.notificationPermissions))
return false;
#endif
if (!decoder.decode(parameters.plugInAutoStartOriginHashes))
return false;
if (!decoder.decode(parameters.plugInAutoStartOrigins))
return false;
if (!decoder.decode(parameters.memoryCacheDisabled))
return false;
#if ENABLE(SERVICE_CONTROLS)
if (!decoder.decode(parameters.hasImageServices))
return false;
if (!decoder.decode(parameters.hasSelectionServices))
return false;
if (!decoder.decode(parameters.hasRichContentServices))
return false;
#endif
#if ENABLE(NETSCAPE_PLUGIN_API)
if (!decoder.decode(parameters.pluginLoadClientPolicies))
return false;
#endif
#if TARGET_OS_IPHONE || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
if (!IPC::decode(decoder, parameters.networkATSContext))
return false;
#endif
return true;
}