本文整理汇总了C++中PassOwnPtr类的典型用法代码示例。如果您正苦于以下问题:C++ PassOwnPtr类的具体用法?C++ PassOwnPtr怎么用?C++ PassOwnPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PassOwnPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addProcessor
void WebSocketExtensionDispatcher::addProcessor(PassOwnPtr<WebSocketExtensionProcessor> processor)
{
for (size_t i = 0; i < m_processors.size(); ++i) {
if (m_processors[i]->extensionToken() == processor->extensionToken())
return;
}
ASSERT(processor->handshakeString().length());
ASSERT(!processor->handshakeString().contains('\n'));
ASSERT(!processor->handshakeString().contains(static_cast<UChar>('\0')));
m_processors.append(processor);
}
示例2: preload
void HTMLResourcePreloader::preload(PassOwnPtr<PreloadRequest> preload)
{
ASSERT(m_document->frame());
ASSERT(m_document->renderView());
ASSERT(m_document->renderView()->style());
if (!preload->media().isEmpty() && !mediaAttributeMatches(m_document->frame(), m_document->renderView()->style(), preload->media()))
return;
CachedResourceRequest request = preload->resourceRequest(m_document);
m_document->cachedResourceLoader()->preload(preload->resourceType(), request, preload->charset());
}
示例3: forEachInternal
void HeaderMap::forEachInternal(PassOwnPtr<HeaderMapForEachCallback> callback, ScriptValue* thisArg)
{
TrackExceptionState exceptionState;
for (HashMap<String, String>::const_iterator it = m_headers.begin(); it != m_headers.end(); ++it) {
if (thisArg)
callback->handleItem(*thisArg, it->value, it->key, this);
else
callback->handleItem(it->value, it->key, this);
if (exceptionState.hadException())
break;
}
}
示例4: forEachInternal
void Headers::forEachInternal(PassOwnPtr<HeadersForEachCallback> callback, ScriptValue* thisArg)
{
TrackExceptionState exceptionState;
for (size_t i = 0; i < m_headerList->size(); ++i) {
if (thisArg)
callback->handleItem(*thisArg, m_headerList->list()[i]->second, m_headerList->list()[i]->first, this);
else
callback->handleItem(m_headerList->list()[i]->second, m_headerList->list()[i]->first, this);
if (exceptionState.hadException())
break;
}
}
示例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: commitNewTreeState
void ScrollingTree::commitNewTreeState(PassOwnPtr<ScrollingTreeState> scrollingTreeState)
{
ASSERT(ScrollingThread::isCurrentThread());
if (scrollingTreeState->changedProperties() & ScrollingTreeState::WheelEventHandlerCount) {
MutexLocker lock(m_mutex);
m_hasWheelEventHandlers = scrollingTreeState->wheelEventHandlerCount();
}
m_rootNode->update(scrollingTreeState.get());
}
示例7: adoptPtrWillBeNoop
PassOwnPtrWillBeRawPtr<MessagePortArray> MessagePort::entanglePorts(ExecutionContext& context, PassOwnPtr<MessagePortChannelArray> channels)
{
if (!channels || !channels->size())
return nullptr;
OwnPtrWillBeRawPtr<MessagePortArray> portArray = adoptPtrWillBeNoop(new MessagePortArray(channels->size()));
for (unsigned i = 0; i < channels->size(); ++i) {
RefPtrWillBeRawPtr<MessagePort> port = MessagePort::create(context);
port->entangle((*channels)[i].release());
(*portArray)[i] = port.release();
}
return portArray.release();
}
示例8: MessagePortArray
PassOwnPtr<MessagePortArray> MessagePort::entanglePorts(ScriptExecutionContext& context, PassOwnPtr<MessagePortChannelArray> channels)
{
if (!channels || !channels->size())
return 0;
MessagePortArray* portArray = new MessagePortArray(channels->size());
for (unsigned int i = 0; i < channels->size(); ++i) {
RefPtr<MessagePort> port = MessagePort::create(context);
port->entangle((*channels)[i].release());
(*portArray)[i] = port.release();
}
return portArray;
}
示例9: postMessageToWorkerContextTask
void WebWorkerClientImpl::postMessageToWorkerContextTask(ScriptExecutionContext* context,
WebWorkerClientImpl* thisPtr,
const String& message,
PassOwnPtr<MessagePortChannelArray> channels)
{
WebMessagePortChannelArray webChannels(channels.get() ? channels->size() : 0);
for (size_t i = 0; i < webChannels.size(); ++i) {
webChannels[i] = (*channels)[i]->channel()->webChannelRelease();
webChannels[i]->setClient(0);
}
thisPtr->m_webWorker->postMessageToWorkerContext(message, webChannels);
}
示例10: perform
bool InspectorHistory::perform(PassOwnPtr<Action> action, ExceptionCode& ec)
{
if (!action->perform(ec))
return false;
if (!action->mergeId().isEmpty() && m_afterLastActionIndex > 0 && action->mergeId() == m_history[m_afterLastActionIndex - 1]->mergeId())
m_history[m_afterLastActionIndex - 1]->merge(action);
else {
m_history.resize(m_afterLastActionIndex);
m_history.append(action);
++m_afterLastActionIndex;
}
return true;
}
示例11: perform
void MainThreadTaskRunner::perform(PassOwnPtr<ExecutionContextTask> task, bool isInspectorTask)
{
if (!isInspectorTask && (m_context->tasksNeedSuspension() || !m_pendingTasks.isEmpty())) {
m_pendingTasks.append(task);
return;
}
const bool instrumenting = !isInspectorTask && !task->taskNameForInstrumentation().isEmpty();
if (instrumenting)
InspectorInstrumentation::willPerformExecutionContextTask(m_context, task.get());
task->performTask(m_context);
if (instrumenting)
InspectorInstrumentation::didPerformExecutionContextTask(m_context);
}
示例12: processIncomingMessage
void Connection::processIncomingMessage(MessageID messageID, PassOwnPtr<ArgumentDecoder> arguments)
{
// Check if this is a sync reply.
if (messageID == MessageID(CoreIPCMessage::SyncMessageReply)) {
MutexLocker locker(m_syncReplyStateMutex);
ASSERT(!m_pendingSyncReplies.isEmpty());
PendingSyncReply& pendingSyncReply = m_pendingSyncReplies.last();
ASSERT(pendingSyncReply.syncRequestID == arguments->destinationID());
pendingSyncReply.replyDecoder = arguments.leakPtr();
pendingSyncReply.didReceiveReply = true;
m_waitForSyncReplySemaphore.signal();
return;
}
// Check if this is a sync message. If it is, and we're waiting for a sync reply this message
// needs to be dispatched. If we don't we'll end up with a deadlock where both sync message senders are
// stuck waiting for a reply.
if (messageID.isSync()) {
MutexLocker locker(m_syncReplyStateMutex);
if (!m_pendingSyncReplies.isEmpty()) {
m_syncMessagesReceivedWhileWaitingForSyncReply.append(IncomingMessage(messageID, arguments));
// The message has been added, now wake up the client thread.
m_waitForSyncReplySemaphore.signal();
return;
}
}
// Check if we're waiting for this message.
{
MutexLocker locker(m_waitForMessageMutex);
HashMap<std::pair<unsigned, uint64_t>, ArgumentDecoder*>::iterator it = m_waitForMessageMap.find(std::make_pair(messageID.toInt(), arguments->destinationID()));
if (it != m_waitForMessageMap.end()) {
it->second = arguments.leakPtr();
m_waitForMessageCondition.signal();
return;
}
}
MutexLocker locker(m_incomingMessagesLock);
m_incomingMessages.append(IncomingMessage(messageID, arguments));
m_clientRunLoop->scheduleWork(WorkItem::create(this, &Connection::dispatchMessages));
}
示例13: preload
void HTMLResourcePreloader::preload(PassOwnPtr<PreloadRequest> preload)
{
Document* executingDocument = m_document->import() ? m_document->import()->master() : m_document;
Document* loadingDocument = m_document;
ASSERT(executingDocument->frame());
ASSERT(executingDocument->renderer());
ASSERT(executingDocument->renderer()->style());
if (!preload->media().isEmpty() && !mediaAttributeMatches(executingDocument->frame(), executingDocument->renderer()->style(), preload->media()))
return;
FetchRequest request = preload->resourceRequest(m_document);
blink::Platform::current()->histogramCustomCounts("WebCore.PreloadDelayMs", static_cast<int>(1000 * (monotonicallyIncreasingTime() - preload->discoveryTime())), 0, 2000, 20);
loadingDocument->fetcher()->preload(preload->resourceType(), request, preload->charset());
}
示例14: postMessageTask
void WebWorkerBase::postMessageTask(ScriptExecutionContext* context,
WebWorkerBase* thisPtr,
String message,
PassOwnPtr<MessagePortChannelArray> channels)
{
if (!thisPtr->client())
return;
WebMessagePortChannelArray webChannels(channels.get() ? channels->size() : 0);
for (size_t i = 0; i < webChannels.size(); ++i) {
webChannels[i] = (*channels)[i]->channel()->webChannelRelease();
webChannels[i]->setClient(0);
}
thisPtr->client()->postMessageToWorkerObject(message, webChannels);
}
示例15: 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
}