当前位置: 首页>>代码示例>>C++>>正文


C++ callOnMainThread函数代码示例

本文整理汇总了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);
}
开发者ID:Zirias,项目名称:webkitfltk,代码行数:8,代码来源:CurlDownload.cpp

示例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);
}
开发者ID:1833183060,项目名称:wke,代码行数:8,代码来源:NetworkStateNotifierWin.cpp

示例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);
}
开发者ID:hnney,项目名称:webkit,代码行数:9,代码来源:IDBTransactionBackendOperations.cpp

示例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());
    });
}
开发者ID:LianYue1,项目名称:webkit,代码行数:9,代码来源:UserMediaRequest.cpp

示例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);
}
开发者ID:rzr,项目名称:blink-crosswalk,代码行数:9,代码来源:WebCLEvent.cpp

示例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();
    });
}
开发者ID:houzhenggang,项目名称:webkit,代码行数:56,代码来源:StorageTracker.cpp

示例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);
    });
}
开发者ID:ZeusbaseWeb,项目名称:webkit,代码行数:10,代码来源:IDBServerConnectionLevelDB.cpp

示例8: viewportController

void ThreadedCompositor::didChangeVisibleRect()
{
    FloatRect visibleRect = viewportController()->visibleContentsRect();
    float scale = viewportController()->pageScaleFactor();
    callOnMainThread([=] {
        m_client->setVisibleContentsRect(visibleRect, FloatPoint::zero(), scale);
    });

    scheduleDisplayImmediately();
}
开发者ID:runt18,项目名称:webkit,代码行数:10,代码来源:ThreadedCompositor.cpp

示例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);
    });
}
开发者ID:cheekiatng,项目名称:webkit,代码行数:10,代码来源:ScrollingTreeIOS.cpp

示例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));
}
开发者ID:MYSHLIFE,项目名称:webkit,代码行数:10,代码来源:ScrollingTreeIOS.cpp

示例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;
    });
}
开发者ID:jeff-jenness,项目名称:webkit,代码行数:10,代码来源:FormDataStreamCFNet.cpp

示例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);
        });
    }
}
开发者ID:caiolima,项目名称:webkit,代码行数:10,代码来源:ThreadableBlobRegistry.cpp

示例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);
}
开发者ID:AndriyKalashnykov,项目名称:webkit,代码行数:10,代码来源:CurlDownload.cpp

示例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();
    });
}
开发者ID:valbok,项目名称:WebKitForWayland,代码行数:10,代码来源:AudioContext.cpp

示例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);
    });
}
开发者ID:nickooms,项目名称:webkit,代码行数:10,代码来源:UserMediaRequest.cpp


注:本文中的callOnMainThread函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。