bool ViewGestureController::SnapshotRemovalTracker::stopWaitingForEvent(Events event, const String& logReason)
{
    ASSERT(hasOneBitSet(event));

    if (!(m_outstandingEvents & event))
        return false;

#if LOG_DISABLED
    UNUSED_PARAM(logReason);
#endif
    log(logReason +  eventsDescription(event));

    m_outstandingEvents &= ~event;

    fireRemovalCallbackIfPossible();
    return true;
}
Exemple #2
0
void WASMModuleParser::parseFunctionPointerTableSection()
{
    uint32_t numberOfFunctionPointerTables;
    READ_COMPACT_UINT32_OR_FAIL(numberOfFunctionPointerTables, "Cannot read the number of function pointer tables.");
    m_module->functionPointerTables().reserveInitialCapacity(numberOfFunctionPointerTables);
    for (uint32_t i = 0; i < numberOfFunctionPointerTables; ++i) {
        WASMFunctionPointerTable functionPointerTable;
        READ_COMPACT_UINT32_OR_FAIL(functionPointerTable.signatureIndex, "Cannot read the signature index.");
        FAIL_IF_FALSE(functionPointerTable.signatureIndex < m_module->signatures().size(), "The signature index is incorrect.");
        uint32_t numberOfElements;
        READ_COMPACT_UINT32_OR_FAIL(numberOfElements, "Cannot read the number of elements of a function pointer table.");
        FAIL_IF_FALSE(hasOneBitSet(numberOfElements), "The number of elements must be a power of two.");
        functionPointerTable.elements.reserveInitialCapacity(numberOfElements);
        for (uint32_t j = 0; j < numberOfElements; ++j) {
            uint32_t element;
            READ_COMPACT_UINT32_OR_FAIL(element, "Cannot read an element of a function pointer table.");
            functionPointerTable.elements.uncheckedAppend(element);
        }
        m_module->functionPointerTables().uncheckedAppend(functionPointerTable);
    }
}
void WASMModuleParser::parseFunctionPointerTableSection()
{
    uint32_t numberOfFunctionPointerTables;
    READ_COMPACT_UINT32_OR_FAIL(numberOfFunctionPointerTables, "Cannot read the number of function pointer tables.");
    m_module->functionPointerTables().reserveInitialCapacity(numberOfFunctionPointerTables);
    for (uint32_t i = 0; i < numberOfFunctionPointerTables; ++i) {
        WASMFunctionPointerTable functionPointerTable;
        READ_COMPACT_UINT32_OR_FAIL(functionPointerTable.signatureIndex, "Cannot read the signature index.");
        FAIL_IF_FALSE(functionPointerTable.signatureIndex < m_module->signatures().size(), "The signature index is incorrect.");
        uint32_t numberOfFunctions;
        READ_COMPACT_UINT32_OR_FAIL(numberOfFunctions, "Cannot read the number of functions of a function pointer table.");
        FAIL_IF_FALSE(hasOneBitSet(numberOfFunctions), "The number of functions must be a power of two.");
        functionPointerTable.functionIndices.reserveInitialCapacity(numberOfFunctions);
        functionPointerTable.functions.reserveInitialCapacity(numberOfFunctions);
        for (uint32_t j = 0; j < numberOfFunctions; ++j) {
            uint32_t functionIndex;
            READ_COMPACT_UINT32_OR_FAIL(functionIndex, "Cannot read a function index of a function pointer table.");
            FAIL_IF_FALSE(functionIndex < m_module->functionDeclarations().size(), "The function index is incorrect.");
            FAIL_IF_FALSE(m_module->functionDeclarations()[functionIndex].signatureIndex == functionPointerTable.signatureIndex, "The signature of the function doesn't match that of the function pointer table.");
            functionPointerTable.functionIndices.uncheckedAppend(functionIndex);
        }
        m_module->functionPointerTables().uncheckedAppend(functionPointerTable);
    }
}