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


C++ enqueueEvent函数代码示例

本文整理汇总了C++中enqueueEvent函数的典型用法代码示例。如果您正苦于以下问题:C++ enqueueEvent函数的具体用法?C++ enqueueEvent怎么用?C++ enqueueEvent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了enqueueEvent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: enqueueEvent

void PointerLockController::requestPointerLock(Element* target)
{
    if (!target || !target->inDocument() || m_documentOfRemovedElementWhileWaitingForUnlock) {
        enqueueEvent(EventTypeNames::pointerlockerror, target);
        return;
    }

    UseCounter::countCrossOriginIframe(target->document(), UseCounter::ElementRequestPointerLockIframe);

    if (target->document().isSandboxed(SandboxPointerLock)) {
        // FIXME: This message should be moved off the console once a solution to https://bugs.webkit.org/show_bug.cgi?id=103274 exists.
        target->document().addConsoleMessage(ConsoleMessage::create(SecurityMessageSource, ErrorMessageLevel, "Blocked pointer lock on an element because the element's frame is sandboxed and the 'allow-pointer-lock' permission is not set."));
        enqueueEvent(EventTypeNames::pointerlockerror, target);
        return;
    }

    if (m_element) {
        if (m_element->document() != target->document()) {
            enqueueEvent(EventTypeNames::pointerlockerror, target);
            return;
        }
        enqueueEvent(EventTypeNames::pointerlockchange, target);
        m_element = target;
    } else if (m_page->chromeClient().requestPointerLock()) {
        m_lockPending = true;
        m_element = target;
    } else {
        enqueueEvent(EventTypeNames::pointerlockerror, target);
    }
}
开发者ID:joone,项目名称:chromium-crosswalk,代码行数:30,代码来源:PointerLockController.cpp

示例2: enqueueEvent

void PointerLockController::didLosePointerLock()
{
    enqueueEvent(EventTypeNames::pointerlockchange, m_element ? &m_element->document() : m_documentOfRemovedElementWhileWaitingForUnlock.get());
    enqueueEvent(EventTypeNames::webkitpointerlockchange, m_element ? &m_element->document() : m_documentOfRemovedElementWhileWaitingForUnlock.get());
    clearElement();
    m_documentOfRemovedElementWhileWaitingForUnlock = nullptr;
}
开发者ID:coinpayee,项目名称:blink,代码行数:7,代码来源:PointerLockController.cpp

示例3: LOG

void IDBOpenDBRequest::requestCompleted(const IDBResultData& data)
{
    LOG(IndexedDB, "IDBOpenDBRequest::requestCompleted");

    if (!data.error().isNull()) {
        LOG(IndexedDB, "  with error: (%s) '%s'", data.error().name().utf8().data(), data.error().message().utf8().data());
        m_domError = DOMError::create(data.error().name());
        enqueueEvent(Event::create(eventNames().errorEvent, true, true));
    } else
        enqueueEvent(Event::create(eventNames().successEvent, true, true));
}
开发者ID:rodrigo-speller,项目名称:webkit,代码行数:11,代码来源:IDBOpenDBRequestImpl.cpp

示例4: pollGamepads

 void pollGamepads()
 {
     // This gamepad is an OR-ed version of all the other gamepads. If button
     // 3 is pressed on any attached gamepad, down(gpButton3) will return
     // true. This is handy for singleplayer games.
     GamepadBuffer anyGamepad = { false };
     
     std::size_t availableGamepads = gameControllers.size() + joysticks.size();
     
     for (int i = 0; i < availableGamepads; ++i) {
         GamepadBuffer currentGamepad = { false };
         
         // Poll data from SDL, using either of two API interfaces.
         if (i < gameControllers.size()) {
             SDL_GameController *gameController = gameControllers[i];
             pollGameController(gameController, currentGamepad);
         }
         else {
             SDL_Joystick *joystick = joysticks[i - gameControllers.size()];
             pollJoystick(joystick, currentGamepad);
         }
         
         // Now at the same time, enqueue all events for this particular
         // gamepad, and OR the keyboard state into anyGamepad.
         int offset = gpRangeBegin + gpNumPerGamepad * (i + 1);
         for (int j = 0; j < currentGamepad.size(); ++j) {
             anyGamepad[j] = anyGamepad[j] || currentGamepad[j];
             
             if (currentGamepad[j] && !buttonStates[j + offset]) {
                 buttonStates[j + offset] = true;
                 enqueueEvent(j + offset, true);
             }
             else if (!currentGamepad[j] && buttonStates[j + offset]) {
                 buttonStates[j + offset] = false;
                 enqueueEvent(j + offset, false);
             }
         }
     }
     
     // And lastly, enqueue events for the virtual "any" gamepad.
     for (int j = 0; j < anyGamepad.size(); ++j) {
         if (anyGamepad[j] && !buttonStates[j + gpRangeBegin]) {
             buttonStates[j + gpRangeBegin] = true;
             enqueueEvent(j + gpRangeBegin, true);
         }
         else if (!anyGamepad[j] && buttonStates[j + gpRangeBegin]) {
             buttonStates[j + gpRangeBegin] = false;
             enqueueEvent(j + gpRangeBegin, false);
         }
     }
 }
开发者ID:456z,项目名称:gosu,代码行数:51,代码来源:Input.cpp

示例5: enqueueEvent

void GameState::enqueueRemove(Entity *ptr)
{
    DelayedEvent event;
    event.type = EVENT_REMOVE;
    event.map = 0;
    enqueueEvent(ptr, event);
}
开发者ID:BornHunter,项目名称:CGSF,代码行数:7,代码来源:state.cpp

示例6: ASSERT

void IDBRequest::onSuccessInternal(PassRefPtr<IDBAny> result)
{
    ASSERT(!m_contextStopped);
    ASSERT(!m_pendingCursor);
    setResult(result);
    enqueueEvent(Event::create(EventTypeNames::success));
}
开发者ID:Metrological,项目名称:chromium,代码行数:7,代码来源:IDBRequest.cpp

示例7: LOG

void IDBRequest::onSuccess(PassRefPtr<IDBCursorBackend> prpBackend)
{
    LOG(StorageAPI, "IDBRequest::onSuccess(IDBCursor)");
    if (!shouldEnqueueEvent())
        return;

    DOMRequestState::Scope scope(m_requestState);

    RefPtr<IDBCursorBackend> backend = prpBackend;
    RefPtr<IDBKey> key = backend->key();
    RefPtr<IDBKey> primaryKey = backend->primaryKey();

    Deprecated::ScriptValue value = deserializeIDBValueBuffer(requestState(), backend->valueBuffer(), !!key);

    ASSERT(!m_pendingCursor);
    RefPtr<IDBCursor> cursor;
    switch (m_cursorType) {
    case IndexedDB::CursorType::KeyOnly:
        cursor = IDBCursor::create(backend.release(), m_cursorDirection, this, m_source.get(), m_transaction.get());
        break;
    case IndexedDB::CursorType::KeyAndValue:
        cursor = IDBCursorWithValue::create(backend.release(), m_cursorDirection, this, m_source.get(), m_transaction.get());
        break;
    default:
        ASSERT_NOT_REACHED();
    }
    setResultCursor(cursor, key.release(), primaryKey.release(), value);

    enqueueEvent(createSuccessEvent());
}
开发者ID:boska,项目名称:webkit,代码行数:30,代码来源:IDBRequest.cpp

示例8: IDB_TRACE

void IDBOpenDBRequest::onUpgradeNeeded(int64_t oldVersion, PassOwnPtr<WebIDBDatabase> backend, const IDBDatabaseMetadata& metadata, WebIDBDataLoss dataLoss, String dataLossMessage)
{
    IDB_TRACE("IDBOpenDBRequest::onUpgradeNeeded()");
    if (m_contextStopped || !executionContext()) {
        OwnPtr<WebIDBDatabase> db = backend;
        db->abort(m_transactionId);
        db->close();
        return;
    }
    if (!shouldEnqueueEvent())
        return;

    ASSERT(m_databaseCallbacks);

    IDBDatabase* idbDatabase = IDBDatabase::create(executionContext(), backend, m_databaseCallbacks.release());
    idbDatabase->setMetadata(metadata);

    if (oldVersion == IDBDatabaseMetadata::NoIntVersion) {
        // This database hasn't had an integer version before.
        oldVersion = IDBDatabaseMetadata::DefaultIntVersion;
    }
    IDBDatabaseMetadata oldMetadata(metadata);
    oldMetadata.intVersion = oldVersion;

    m_transaction = IDBTransaction::create(scriptState(), m_transactionId, idbDatabase, this, oldMetadata);
    setResult(IDBAny::create(idbDatabase));

    if (m_version == IDBDatabaseMetadata::NoIntVersion)
        m_version = 1;
    enqueueEvent(IDBVersionChangeEvent::create(EventTypeNames::upgradeneeded, oldVersion, m_version, dataLoss, dataLossMessage));
}
开发者ID:kingysu,项目名称:blink-crosswalk,代码行数:31,代码来源:IDBOpenDBRequest.cpp

示例9: IDB_TRACE

void IDBTransaction::onAbort(DOMException* error) {
  IDB_TRACE("IDBTransaction::onAbort");
  if (!getExecutionContext()) {
    finished();
    return;
  }

  DCHECK_NE(m_state, Finished);
  if (m_state != Finishing) {
    // Abort was not triggered by front-end.
    DCHECK(error);
    setError(error);

    abortOutstandingRequests();
    revertDatabaseMetadata();

    m_state = Finishing;
  }

  if (isVersionChange())
    m_database->close();

  // Enqueue events before notifying database, as database may close which
  // enqueues more events and order matters.
  enqueueEvent(Event::createBubble(EventTypeNames::abort));
  finished();
}
开发者ID:mirror,项目名称:chromium,代码行数:27,代码来源:IDBTransaction.cpp

示例10: ASSERT

void IDBOpenDBRequest::onError(const IDBResultData& data)
{
    ASSERT(currentThread() == originThreadID());

    m_domError = DOMError::create(data.error().name(), data.error().message());
    enqueueEvent(IDBRequestCompletionEvent::create(eventNames().errorEvent, true, true, *this));
}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:7,代码来源:IDBOpenDBRequest.cpp

示例11: LOG

void LegacyTransaction::onAbort(PassRefPtr<IDBDatabaseError> prpError)
{
    LOG(StorageAPI, "LegacyTransaction::onAbort");
    RefPtr<IDBDatabaseError> error = prpError;
    ASSERT(m_state != Finished);

    if (m_state != Finishing) {
        ASSERT(error.get());
        setError(DOMError::create(error->name()), error->message());

        // Abort was not triggered by front-end, so outstanding requests must
        // be aborted now.
        while (!m_requestList.isEmpty()) {
            RefPtr<LegacyRequest> request = *m_requestList.begin();
            m_requestList.remove(request);
            request->abort();
        }
        m_state = Finishing;
    }

    if (isVersionChange()) {
        for (auto& objectStore : m_objectStoreCleanupMap)
            objectStore.key->setMetadata(objectStore.value);
        m_database->setMetadata(m_previousMetadata);
        m_database->close();
    }
    m_objectStoreCleanupMap.clear();
    closeOpenCursors();

    // Enqueue events before notifying database, as database may close which enqueues more events and order matters.
    enqueueEvent(Event::create(eventNames().abortEvent, true, false));
    m_database->transactionFinished(this);
}
开发者ID:zte-lhg,项目名称:webkit,代码行数:33,代码来源:LegacyTransaction.cpp

示例12: ASSERT

void IDBRequest::onError(PassRefPtr<IDBDatabaseError> error)
{
    ASSERT(!m_errorCode && m_errorMessage.isNull() && !m_result);
    m_errorCode = error->code();
    m_errorMessage = error->message();
    enqueueEvent(Event::create(eventNames().errorEvent, true, true));
}
开发者ID:1833183060,项目名称:wke,代码行数:7,代码来源:IDBRequest.cpp

示例13: enqueueEvent

void IDBDatabase::forceClose()
{
    for (const auto& it : m_transactions)
        it.value->abort(IGNORE_EXCEPTION);
    this->close();
    enqueueEvent(Event::create(EventTypeNames::close));
}
开发者ID:JulienIsorce,项目名称:ChromiumGStreamerBackend,代码行数:7,代码来源:IDBDatabase.cpp

示例14: LOG

void IDBRequest::onError()
{
    LOG(IndexedDB, "IDBRequest::onError");

    ASSERT(!m_idbError.isNull());
    m_domError = DOMError::create(m_idbError.name());
    enqueueEvent(Event::create(eventNames().errorEvent, true, true));
}
开发者ID:sailei1,项目名称:webkit,代码行数:8,代码来源:IDBRequestImpl.cpp

示例15: enqueueEvent

void KviSensitiveThread::terminate()
{
	//qDebug("Entering KviSensitiveThread::terminate (this=%d)",this);
	enqueueEvent(new KviThreadEvent(KVI_THREAD_EVENT_TERMINATE));
	//qDebug("KviSensitiveThread::terminate() : event enqueued waiting (this=%d)",this);
	wait();
	//qDebug("Exiting KviSensitiveThread::terminate (this=%d)",this);
}
开发者ID:CardinalSins,项目名称:KVIrc,代码行数:8,代码来源:KviThread.cpp


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