本文整理汇总了C++中callOnMainThread函数的典型用法代码示例。如果您正苦于以下问题:C++ callOnMainThread函数的具体用法?C++ callOnMainThread怎么用?C++ callOnMainThread使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了callOnMainThread函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: locker
void CurlDownload::didReceiveData(void* data, int size)
{
MutexLocker locker(m_mutex);
callOnMainThread(MainThreadTask(receivedDataCallback, this, size));
writeDataToFile(static_cast<const char*>(data), size);
}
示例2: callOnMainThread
void CALLBACK NetworkStateNotifier::addrChangeCallback(void* context, BOOLEAN timedOut)
{
// NotifyAddrChange only notifies us of a single address change. Now that we've been notified,
// we need to call it again so we'll get notified the *next* time.
static_cast<NetworkStateNotifier*>(context)->registerForAddressChange();
callOnMainThread(callAddressChanged, context);
}
示例3: LOG
void SetIndexesReadyOperation::perform(std::function<void()> completionCallback)
{
LOG(StorageAPI, "SetIndexesReadyOperation");
for (size_t i = 0; i < m_indexCount; ++i)
m_transaction->didCompletePreemptiveEvent();
callOnMainThread(completionCallback);
}
示例4: protectedThis
void UserMediaRequest::constraintsValidated()
{
RefPtr<UserMediaRequest> protectedThis(this);
callOnMainThread([protectedThis] {
// 2 - The constraints are valid, ask the user for access to media.
if (UserMediaController* controller = protectedThis->m_controller)
controller->requestPermission(*protectedThis.get());
});
}
示例5: callOnMainThread
void WebCLEvent::callbackProxy(cl_event event, cl_int type, void* userData)
{
if (!isMainThread()) {
callOnMainThread(WTF::bind(callbackProxyOnMainThread, event, type, userData));
return;
}
callbackProxyOnMainThread(event, type, userData);
}
示例6: ASSERT
void StorageTracker::syncImportOriginIdentifiers()
{
ASSERT(m_isActive);
ASSERT(!isMainThread());
{
MutexLocker locker(m_databaseMutex);
// Don't force creation of StorageTracker's db just because a tracker
// was initialized. It will be created if local storage dbs are found
// by syncFileSystemAndTrackerDatabse() or the next time a local storage
// db is created by StorageAreaSync.
openTrackerDatabase(false);
if (m_database.isOpen()) {
SQLiteTransactionInProgressAutoCounter transactionCounter;
SQLiteStatement statement(m_database, "SELECT origin FROM Origins");
if (statement.prepare() != SQLResultOk) {
LOG_ERROR("Failed to prepare statement.");
return;
}
int result;
{
MutexLocker lockOrigins(m_originSetMutex);
while ((result = statement.step()) == SQLResultRow)
m_originSet.add(statement.getColumnText(0).isolatedCopy());
}
if (result != SQLResultDone) {
LOG_ERROR("Failed to read in all origins from the database.");
return;
}
}
}
syncFileSystemAndTrackerDatabase();
{
MutexLocker locker(m_clientMutex);
if (m_client) {
MutexLocker locker(m_originSetMutex);
OriginSet::const_iterator end = m_originSet.end();
for (OriginSet::const_iterator it = m_originSet.begin(); it != end; ++it)
m_client->dispatchDidModifyOrigin(*it);
}
}
callOnMainThread([this] {
finishedImportingOriginIdentifiers();
});
}
示例7: ASSERT
void IDBServerConnectionLevelDB::commitTransaction(int64_t transactionID, BoolCallbackFunction successCallback)
{
RefPtr<IDBBackingStoreTransactionLevelDB> transaction = m_backingStoreTransactions.get(transactionID);
ASSERT(transaction);
bool result = transaction->commit();
callOnMainThread([successCallback, result]() {
successCallback(result);
});
}
示例8: viewportController
void ThreadedCompositor::didChangeVisibleRect()
{
FloatRect visibleRect = viewportController()->visibleContentsRect();
float scale = viewportController()->pageScaleFactor();
callOnMainThread([=] {
m_client->setVisibleContentsRect(visibleRect, FloatPoint::zero(), scale);
});
scheduleDisplayImmediately();
}
示例9: callOnMainThread
void ScrollingTreeIOS::currentSnapPointIndicesDidChange(WebCore::ScrollingNodeID nodeID, unsigned horizontal, unsigned vertical)
{
if (!m_scrollingCoordinator)
return;
RefPtr<AsyncScrollingCoordinator> scrollingCoordinator = m_scrollingCoordinator;
callOnMainThread([scrollingCoordinator, nodeID, horizontal, vertical] {
scrollingCoordinator->setActiveScrollSnapIndices(nodeID, horizontal, vertical);
});
}
示例10: setMainFrameScrollPosition
void ScrollingTreeIOS::scrollingTreeNodeDidScroll(ScrollingNodeID nodeID, const FloatPoint& scrollPosition, SetOrSyncScrollingLayerPosition scrollingLayerPositionAction)
{
if (!m_scrollingCoordinator)
return;
if (nodeID == rootNode()->scrollingNodeID())
setMainFrameScrollPosition(scrollPosition);
callOnMainThread(bind(&AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll, m_scrollingCoordinator.get(), nodeID, scrollPosition, isHandlingProgrammaticScroll(), scrollingLayerPositionAction));
}
示例11: formFinalize
static void formFinalize(CFReadStreamRef stream, void* context)
{
FormStreamFields* form = static_cast<FormStreamFields*>(context);
ASSERT_UNUSED(stream, form->formStream == stream);
callOnMainThread([form] {
closeCurrentStream(form);
delete form;
});
}
示例12: blobRegistry
void ThreadableBlobRegistry::registerFileBlobURL(const URL& url, const String& path, const String& contentType)
{
if (isMainThread())
blobRegistry().registerFileBlobURL(url, BlobDataFileReference::create(path), contentType);
else {
callOnMainThread([url = url.isolatedCopy(), path = path.isolatedCopy(), contentType = contentType.isolatedCopy()] {
blobRegistry().registerFileBlobURL(url, BlobDataFileReference::create(path), contentType);
});
}
}
示例13: locker
void CurlDownload::didReceiveData(void* data, int size)
{
MutexLocker locker(m_mutex);
callOnMainThread([this, size] {
didReceiveDataOfLength(size);
});
writeDataToFile(static_cast<const char*>(data), size);
}
示例14: strongThis
void AudioContext::isPlayingAudioDidChange()
{
// Make sure to call Document::updateIsPlayingMedia() on the main thread, since
// we could be on the audio I/O thread here and the call into WebCore could block.
RefPtr<AudioContext> strongThis(this);
callOnMainThread([strongThis] {
if (strongThis->document())
strongThis->document()->updateIsPlayingMedia();
});
}
示例15: protectedThis
void UserMediaRequest::userMediaAccessGranted(const String& videoDeviceUID, const String& audioDeviceUID)
{
m_chosenVideoDeviceUID = videoDeviceUID;
m_chosenAudioDeviceUID = audioDeviceUID;
RefPtr<UserMediaRequest> protectedThis(this);
callOnMainThread([protectedThis] {
// 3 - the user granted access, ask platform to create the media stream descriptors.
RealtimeMediaSourceCenter::singleton().createMediaStream(protectedThis.get(), protectedThis->m_audioConstraints, protectedThis->m_videoConstraints);
});
}