本文整理汇总了C++中protector函数的典型用法代码示例。如果您正苦于以下问题:C++ protector函数的具体用法?C++ protector怎么用?C++ protector使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了protector函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: logMessage
void ClientImpl::initiateAuthentication(PendingConnection* pc, struct bufferevent *bev)throw (voltdb::LibEventException) {
logMessage(ClientLogger::DEBUG, "ClientImpl::initiateAuthentication");
FreeBEVOnFailure protector(bev);
bufferevent_setwatermark( bev, EV_READ, 4, HIGH_WATERMARK);
bufferevent_setwatermark( bev, EV_WRITE, 8192, 262144);
if (bufferevent_enable(bev, EV_READ)) {
throw voltdb::LibEventException();
}
AuthenticationRequest authRequest( m_username, "database", m_passwordHash, m_hashScheme );
ScopedByteBuffer bb(authRequest.getSerializedSize());
authRequest.serializeTo(&bb);
struct evbuffer *evbuf = bufferevent_get_output(bev);
if (evbuffer_add( evbuf, bb.bytes(), static_cast<size_t>(bb.remaining()))) {
throw voltdb::LibEventException();
}
protector.success();
}
开发者ID:openet,项目名称:voltdb-client-cpp,代码行数:21,代码来源:ClientImpl.cpp
示例2: ASSERT
void DOMWindowEventQueue::pendingEventTimerFired()
{
ASSERT(!m_pendingEventTimer->isActive());
ASSERT(!m_queuedEvents.isEmpty());
// Insert a marker for where we should stop.
ASSERT(!m_queuedEvents.contains(nullptr));
bool wasAdded = m_queuedEvents.add(nullptr).isNewEntry;
ASSERT_UNUSED(wasAdded, wasAdded); // It should not have already been in the list.
RefPtr<DOMWindowEventQueue> protector(this);
while (!m_queuedEvents.isEmpty()) {
ListHashSet<RefPtr<Event>, 16>::iterator iter = m_queuedEvents.begin();
RefPtr<Event> event = *iter;
m_queuedEvents.remove(iter);
if (!event)
break;
dispatchEvent(event.get());
}
}
开发者ID:kublaj,项目名称:blink,代码行数:21,代码来源:DOMWindowEventQueue.cpp
示例3: VOID_TO_NPVARIANT
void NPObjectMessageReceiver::getProperty(const NPIdentifierData& propertyNameData, bool& returnValue, NPVariantData& resultData)
{
if (!m_npObject->_class->getProperty) {
returnValue = false;
return;
}
NPVariant result;
VOID_TO_NPVARIANT(result);
PluginController::PluginDestructionProtector protector(m_plugin->controller());
returnValue = m_npObject->_class->getProperty(m_npObject, propertyNameData.createNPIdentifier(), &result);
if (!returnValue)
return;
resultData = m_npRemoteObjectMap->npVariantToNPVariantData(result, m_plugin);
releaseNPVariantValue(&result);
}
开发者ID:cheekiatng,项目名称:webkit,代码行数:21,代码来源:NPObjectMessageReceiver.cpp
示例4: myProtector
void Loader::Host::didFinishLoading(SubresourceLoader* loader)
{
RefPtr<Host> myProtector(this);
RequestMap::iterator i = m_requestsLoading.find(loader);
if (i == m_requestsLoading.end())
return;
Request* request = i->second;
m_requestsLoading.remove(i);
DocLoader* docLoader = request->docLoader();
// Prevent the document from being destroyed before we are done with
// the docLoader that it will delete when the document gets deleted.
RefPtr<Document> protector(docLoader->doc());
if (!request->isMultipart())
docLoader->decrementRequestCount();
CachedResource* resource = request->cachedResource();
ASSERT(!resource->resourceToRevalidate());
// If we got a 4xx response, we're pretending to have received a network
// error, so we can't send the successful data() and finish() callbacks.
if (!resource->errorOccurred()) {
docLoader->setLoadInProgress(true);
resource->data(loader->resourceData(), true);
resource->finish();
}
delete request;
docLoader->setLoadInProgress(false);
docLoader->checkForPendingPreloads();
#if REQUEST_DEBUG
KURL u(ParsedURLString, resource->url());
printf("HOST %s COUNT %d RECEIVED %s\n", u.host().latin1().data(), m_requestsLoading.size(), resource->url().latin1().data());
#endif
servePendingRequests();
}
开发者ID:digideskio,项目名称:WebkitAIR,代码行数:40,代码来源:loader.cpp
示例5: protector
bool CoordinatedLayerTreeHost::flushPendingLayerChanges()
{
if (m_waitingForUIProcess)
return false;
TemporaryChange<bool> protector(m_isFlushingLayerChanges, true);
createCompositingLayers();
initializeRootCompositingLayerIfNeeded();
m_rootLayer->flushCompositingStateForThisLayerOnly();
m_nonCompositedContentLayer->flushCompositingStateForThisLayerOnly();
if (m_pageOverlayLayer)
m_pageOverlayLayer->flushCompositingStateForThisLayerOnly();
bool didSync = m_webPage->corePage()->mainFrame()->view()->flushCompositingStateIncludingSubframes();
flushPendingImageBackingChanges();
deleteCompositingLayers();
if (m_shouldSyncFrame) {
didSync = true;
IntSize contentsSize = roundedIntSize(m_nonCompositedContentLayer->size());
IntRect coveredRect = toCoordinatedGraphicsLayer(m_nonCompositedContentLayer.get())->coverRect();
m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::DidRenderFrame(contentsSize, coveredRect));
m_waitingForUIProcess = true;
m_shouldSyncFrame = false;
} else
unlockAnimations();
if (m_forceRepaintAsyncCallbackID) {
m_webPage->send(Messages::WebPageProxy::VoidCallback(m_forceRepaintAsyncCallbackID));
m_forceRepaintAsyncCallbackID = 0;
}
return didSync;
}
开发者ID:XUZHOUWANG,项目名称:webkit,代码行数:40,代码来源:CoordinatedLayerTreeHost.cpp
示例6: protector
void PageAnimator::serviceScriptedAnimations(double monotonicAnimationStartTime)
{
RefPtrWillBeRawPtr<PageAnimator> protector(this);
m_animationFramePending = false;
TemporaryChange<bool> servicing(m_servicingAnimations, true);
WillBeHeapVector<RefPtrWillBeMember<Document>> documents;
for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
if (frame->isLocalFrame())
documents.append(toLocalFrame(frame)->document());
}
for (size_t i = 0; i < documents.size(); ++i) {
if (documents[i]->frame()) {
documents[i]->view()->serviceScrollAnimations(monotonicAnimationStartTime);
if (const FrameView::ScrollableAreaSet* animatingScrollableAreas = documents[i]->view()->animatingScrollableAreas()) {
// Iterate over a copy, since ScrollableAreas may deregister
// themselves during the iteration.
Vector<ScrollableArea*> animatingScrollableAreasCopy;
copyToVector(*animatingScrollableAreas, animatingScrollableAreasCopy);
for (ScrollableArea* scrollableArea : animatingScrollableAreasCopy)
scrollableArea->serviceScrollAnimations(monotonicAnimationStartTime);
}
}
}
for (size_t i = 0; i < documents.size(); ++i) {
DocumentAnimations::updateAnimationTimingForAnimationFrame(*documents[i], monotonicAnimationStartTime);
SVGDocumentExtensions::serviceOnAnimationFrame(*documents[i], monotonicAnimationStartTime);
}
for (size_t i = 0; i < documents.size(); ++i)
documents[i]->serviceScriptedAnimations(monotonicAnimationStartTime);
#if ENABLE(OILPAN)
documents.clear();
#endif
}
开发者ID:kingysu,项目名称:blink-crosswalk,代码行数:39,代码来源:PageAnimator.cpp
示例7: ASSERT
void ResourceLoader::releaseResources()
{
ASSERT(!m_reachedTerminalState);
// It's possible that when we release the handle, it will be
// deallocated and release the last reference to this object.
// We need to retain to avoid accessing the object after it
// has been deallocated and also to avoid reentering this method.
RefPtr<ResourceLoader> protector(this);
m_frame = 0;
// We need to set reachedTerminalState to true before we release
// the resources to prevent a double dealloc of WebView <rdar://problem/4372628>
m_reachedTerminalState = true;
m_identifier = 0;
m_handle = 0;
m_resourceData = 0;
m_deferredRequest = ResourceRequest();
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:22,代码来源:ResourceLoader.cpp
示例8: ASSERT
void UniqueIDBDatabase::performNextDatabaseTask()
{
ASSERT(!isMainThread());
// It is possible that this database might be shutting down on the main thread.
// In this case, immediately after releasing m_databaseTaskMutex, this database might get deleted.
// We take a ref() to make sure the database is still live while this last task is performed.
RefPtr<UniqueIDBDatabase> protector(this);
std::unique_ptr<AsyncTask> task;
{
MutexLocker locker(m_databaseTaskMutex);
// This database might be shutting down on the main thread, in which case the task queue might be empty.
if (m_databaseTasks.isEmpty())
return;
task = m_databaseTasks.takeFirst();
}
task->performTask();
}
开发者ID:Happy-Ferret,项目名称:webkit.js,代码行数:22,代码来源:UniqueIDBDatabase.cpp
示例9: LOG
void WebResourceLoader::didReceiveResource(const ShareableResource::Handle& handle, double finishTime)
{
LOG(Network, "(WebProcess) WebResourceLoader::didReceiveResource for '%s'", m_coreLoader->url().string().utf8().data());
RefPtr<SharedBuffer> buffer = handle.tryWrapInSharedBuffer();
if (!buffer) {
LOG_ERROR("Unable to create buffer from ShareableResource sent from the network process.");
m_coreLoader->didFail(internalError(m_coreLoader->request().url()));
return;
}
RefPtr<WebResourceLoader> protector(this);
// Only send data to the didReceiveData callback if it exists.
if (buffer->size())
m_coreLoader->didReceiveBuffer(buffer.get(), buffer->size(), DataPayloadWholeResource);
if (!m_coreLoader)
return;
m_coreLoader->didFinishLoading(finishTime);
}
开发者ID:harlanlewis,项目名称:webkit,代码行数:22,代码来源:WebResourceLoader.cpp
示例10: protector
bool CompositingCoordinator::flushPendingLayerChanges()
{
TemporaryChange<bool> protector(m_isFlushingLayerChanges, true);
initializeRootCompositingLayerIfNeeded();
bool viewportIsStable = m_page->mainFrame().view()->viewportIsStable();
m_rootLayer->flushCompositingStateForThisLayerOnly(viewportIsStable);
m_client->didFlushRootLayer(m_visibleContentsRect);
if (m_overlayCompositingLayer)
m_overlayCompositingLayer->flushCompositingState(FloatRect(FloatPoint(), m_rootLayer->size()), viewportIsStable);
bool didSync = m_page->mainFrame().view()->flushCompositingStateIncludingSubframes();
toCoordinatedGraphicsLayer(m_rootLayer.get())->updateContentBuffersIncludingSubLayers();
toCoordinatedGraphicsLayer(m_rootLayer.get())->syncPendingStateChangesIncludingSubLayers();
flushPendingImageBackingChanges();
if (m_shouldSyncFrame) {
didSync = true;
if (m_rootCompositingLayer) {
m_state.contentsSize = roundedIntSize(m_rootCompositingLayer->size());
if (CoordinatedGraphicsLayer* contentsLayer = mainContentsLayer())
m_state.coveredRect = contentsLayer->coverRect();
}
m_state.scrollPosition = m_visibleContentsRect.location();
m_client->commitSceneState(m_state);
clearPendingStateChanges();
m_shouldSyncFrame = false;
}
return didSync;
}
开发者ID:nickooms,项目名称:webkit,代码行数:38,代码来源:CompositingCoordinator.cpp
示例11: ASSERT
void EventQueue::pendingEventTimerFired()
{
ASSERT(!m_pendingEventTimer->isActive());
ASSERT(!m_queuedEvents.isEmpty());
m_nodesWithQueuedScrollEvents.clear();
// Insert a marker for where we should stop.
ASSERT(!m_queuedEvents.contains(0));
bool wasAdded = m_queuedEvents.add(0).second;
ASSERT_UNUSED(wasAdded, wasAdded); // It should not have already been in the list.
RefPtr<EventQueue> protector(this);
while (!m_queuedEvents.isEmpty()) {
ListHashSet<RefPtr<Event> >::iterator iter = m_queuedEvents.begin();
RefPtr<Event> event = *iter;
m_queuedEvents.remove(iter);
if (!event)
break;
dispatchEvent(event.get());
}
}
开发者ID:sysrqb,项目名称:chromium-src,代码行数:23,代码来源:EventQueue.cpp
示例12: protector
void PluginProxy::evaluate(const NPVariantData& npObjectAsVariantData, const String& scriptString, bool allowPopups, bool& returnValue, NPVariantData& resultData)
{
PluginController::PluginDestructionProtector protector(controller());
NPVariant npObjectAsVariant = m_connection->npRemoteObjectMap()->npVariantDataToNPVariant(npObjectAsVariantData, this);
if (!NPVARIANT_IS_OBJECT(npObjectAsVariant) || !(NPVARIANT_TO_OBJECT(npObjectAsVariant))) {
returnValue = false;
return;
}
NPVariant result;
returnValue = controller()->evaluate(NPVARIANT_TO_OBJECT(npObjectAsVariant), scriptString, &result, allowPopups);
if (!returnValue)
return;
// Convert the NPVariant to an NPVariantData.
resultData = m_connection->npRemoteObjectMap()->npVariantToNPVariantData(result, this);
// And release the result.
releaseNPVariantValue(&result);
releaseNPVariantValue(&npObjectAsVariant);
}
开发者ID:GaoHuijian,项目名称:webkit,代码行数:23,代码来源:PluginProxy.cpp
示例13: throw
void ClientImpl::initiateConnection(boost::shared_ptr<PendingConnection> &pc) throw (voltdb::ConnectException, voltdb::LibEventException){
std::stringstream ss;
ss << "ClientImpl::initiateConnection to " << pc->m_hostname << ":" << pc->m_port;
logMessage(ClientLogger::INFO, ss.str());
struct bufferevent * bev = bufferevent_socket_new(m_base, -1, BEV_OPT_CLOSE_ON_FREE | BEV_OPT_THREADSAFE);
if (bev == NULL) {
throw ConnectException();
}
FreeBEVOnFailure protector(bev);
bufferevent_setcb(bev, authenticationReadCallback, NULL, authenticationEventCallback, pc.get());
if (bufferevent_socket_connect_hostname(bev, NULL, AF_INET, pc->m_hostname.c_str(), pc->m_port) != 0) {
ss.str("");
ss << "!!!! ClientImpl::initiateConnection to " << pc->m_hostname << ":" << pc->m_port << " failed";
logMessage(ClientLogger::ERROR, ss.str());
throw voltdb::LibEventException();
}
protector.success();
}
开发者ID:openet,项目名称:voltdb-client-cpp,代码行数:23,代码来源:ClientImpl.cpp
示例14: gtk_file_chooser_dialog_new
void FileChooser::openFileChooser(Document* document)
{
FrameView* view = document->view();
if (!view)
return;
GtkWidget* dialog = gtk_file_chooser_dialog_new(_("Upload File"),
GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(view->containingWindow()))),
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL);
// We need this protector because otherwise we can be deleted if the file upload control is detached while
// we're within the gtk_run_dialog call.
RefPtr<FileChooser> protector(this);
String result;
const bool acceptedDialog = gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT;
if (acceptedDialog && stringByAdoptingFileSystemRepresentation(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)), result))
chooseFile(result);
gtk_widget_destroy(dialog);
}
开发者ID:acss,项目名称:owb-mirror,代码行数:23,代码来源:FileChooserGtk.cpp
示例15: ASSERT
void DocumentWriter::end()
{
ASSERT(m_frame->page());
ASSERT(m_frame->document());
// The parser is guaranteed to be released after this point. begin() would
// have to be called again before we can start writing more data.
m_state = FinishedWritingState;
// http://bugs.webkit.org/show_bug.cgi?id=10854
// The frame's last ref may be removed and it can be deleted by checkCompleted(),
// so we'll add a protective refcount
RefPtr<Frame> protector(m_frame);
if (!m_parser)
return;
// FIXME: m_parser->finish() should imply m_parser->flush().
m_parser->flush(this);
if (!m_parser)
return;
m_parser->finish();
m_parser = 0;
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:23,代码来源:DocumentWriter.cpp
示例16: protector
void ResourceLoader::didReceiveData(const char* data, int length, long long encodedDataLength, bool allAtOnce)
{
// The following assertions are not quite valid here, since a subclass
// might override didReceiveData in a way that invalidates them. This
// happens with the steps listed in 3266216
// ASSERT(con == connection);
// ASSERT(!m_reachedTerminalState);
// Protect this in this delegate method since the additional processing can do
// anything including possibly derefing this; one example of this is Radar 3266216.
RefPtr<ResourceLoader> protector(this);
addData(data, length, allAtOnce);
// FIXME: If we get a resource with more than 2B bytes, this code won't do the right thing.
// However, with today's computers and networking speeds, this won't happen in practice.
// Could be an issue with a giant local file.
if (m_options.sendLoadCallbacks == SendCallbacks && m_frame) {
ActionLogScope log_scope(
String::format("recv_data:%s",
m_request.url().lastPathComponent().ascii().data()).ascii().data());
frameLoader()->notifier()->didReceiveData(this, data, length, static_cast<int>(encodedDataLength));
}
}
开发者ID:christofferqa,项目名称:R4,代码行数:23,代码来源:ResourceLoader.cpp
示例17: protector
void NetworkConnectionToWebProcess::writeBlobsToTemporaryFiles(const Vector<String>& blobURLs, uint64_t requestIdentifier)
{
RefPtr<NetworkConnectionToWebProcess> protector(this);
Vector<RefPtr<WebCore::BlobDataFileReference>> fileReferences;
for (auto& url : blobURLs)
fileReferences.appendVector(NetworkBlobRegistry::singleton().filesInBlob(*this, { ParsedURLString, url }));
for (auto& file : fileReferences)
file->prepareForFileAccess();
NetworkBlobRegistry::singleton().writeBlobsToTemporaryFiles(blobURLs, [this, protector, requestIdentifier, fileReferences](const Vector<String>& fileNames) {
for (auto& file : fileReferences)
file->revokeFileAccess();
NetworkProcess::singleton().grantSandboxExtensionsToDatabaseProcessForBlobs(fileNames, [this, protector, requestIdentifier, fileNames]() {
if (!m_connection || !m_connection->isValid())
return;
m_connection->send(Messages::NetworkProcessConnection::DidWriteBlobsToTemporaryFiles(requestIdentifier, fileNames), 0);
});
});
}
开发者ID:edcwconan,项目名称:webkit,代码行数:23,代码来源:NetworkConnectionToWebProcess.cpp
示例18: currentConnectionChange
void WebProcessConnection::didReceiveSyncMessage(IPC::Connection& connection, IPC::Decoder& decoder, std::unique_ptr<IPC::Encoder>& replyEncoder)
{
TemporaryChange<IPC::Connection*> currentConnectionChange(currentConnection, &connection);
uint64_t destinationID = decoder.destinationID();
if (!destinationID) {
didReceiveSyncWebProcessConnectionMessage(connection, decoder, replyEncoder);
return;
}
if (decoder.messageReceiverName() == Messages::NPObjectMessageReceiver::messageReceiverName()) {
m_npRemoteObjectMap->didReceiveSyncMessage(connection, decoder, replyEncoder);
return;
}
PluginControllerProxy* pluginControllerProxy = m_pluginControllers.get(decoder.destinationID());
if (!pluginControllerProxy)
return;
PluginController::PluginDestructionProtector protector(pluginControllerProxy->asPluginController());
pluginControllerProxy->didReceiveSyncPluginControllerProxyMessage(connection, decoder, replyEncoder);
}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:23,代码来源:WebProcessConnection.cpp
示例19: releaseResources
void ResourceLoader::cancel(const ResourceError& error)
{
// If the load has already completed - succeeded, failed, or previously cancelled - do nothing.
if (m_state == Terminated)
return;
if (m_state == Finishing) {
releaseResources();
return;
}
ResourceError nonNullError = error.isNull() ? ResourceError::cancelledError(m_request.url()) : error;
// This function calls out to clients at several points that might do
// something that causes the last reference to this object to go away.
RefPtr<ResourceLoader> protector(this);
WTF_LOG(ResourceLoading, "Cancelled load of '%s'.\n", m_resource->url().string().latin1().data());
if (m_state == Initialized)
m_state = Finishing;
m_resource->setResourceError(nonNullError);
if (m_loader) {
m_connectionState = ConnectionStateCanceled;
m_loader->cancel();
m_loader.clear();
}
if (!m_notifiedLoadComplete) {
m_notifiedLoadComplete = true;
m_host->didFailLoading(m_resource, nonNullError);
}
if (m_state == Finishing)
m_resource->error(Resource::LoadError);
if (m_state != Terminated)
releaseResources();
}
开发者ID:glenkim-dev,项目名称:blink-crosswalk,代码行数:37,代码来源:ResourceLoader.cpp
示例20: GST_DEBUG_OBJECT
void PlaybackPipeline::removeSourceBuffer(RefPtr<SourceBufferPrivateGStreamer> sourceBufferPrivate)
{
GST_DEBUG_OBJECT(m_webKitMediaSrc.get(), "Element removed from MediaSource");
GST_OBJECT_LOCK(m_webKitMediaSrc.get());
WebKitMediaSrcPrivate* priv = m_webKitMediaSrc->priv;
Stream* stream = 0;
GList *l;
for (l = priv->streams; l; l = l->next) {
Stream *tmp = static_cast<Stream*>(l->data);
if (tmp->sourceBuffer == sourceBufferPrivate.get()) {
stream = tmp;
priv->streams = g_list_remove(priv->streams, stream);
break;
}
}
GST_OBJECT_UNLOCK(m_webKitMediaSrc.get());
if (stream) {
if (stream->appsrc)
gst_app_src_end_of_stream(GST_APP_SRC(stream->appsrc));
if (stream->type != Invalid) {
if (WTF::isMainThread())
releaseStreamTrackInfo(stream->parent, stream);
else {
WTF::GMutexLocker<GMutex> lock(stream->parent->priv->streamMutex);
GRefPtr<WebKitMediaSrc> protector(stream->parent);
stream->parent->priv->timeoutSource.schedule([protector, stream] { releaseStreamTrackInfo(protector.get(), stream); });
g_cond_wait(&stream->parent->priv->streamCondition, &stream->parent->priv->streamMutex);
}
}
g_timeout_add(300, (GSourceFunc)freeStreamLater, stream);
}
}
开发者ID:robvogelaar,项目名称:WebKitForWayland,代码行数:37,代码来源:WebKitMediaSourceGStreamer.cpp
注:本文中的protector函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论