本文整理汇总了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);
}
}
示例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;
}
示例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));
}
示例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);
}
}
}
示例5: enqueueEvent
void GameState::enqueueRemove(Entity *ptr)
{
DelayedEvent event;
event.type = EVENT_REMOVE;
event.map = 0;
enqueueEvent(ptr, event);
}
示例6: ASSERT
void IDBRequest::onSuccessInternal(PassRefPtr<IDBAny> result)
{
ASSERT(!m_contextStopped);
ASSERT(!m_pendingCursor);
setResult(result);
enqueueEvent(Event::create(EventTypeNames::success));
}
示例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());
}
示例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));
}
示例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();
}
示例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));
}
示例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);
}
示例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));
}
示例13: enqueueEvent
void IDBDatabase::forceClose()
{
for (const auto& it : m_transactions)
it.value->abort(IGNORE_EXCEPTION);
this->close();
enqueueEvent(Event::create(EventTypeNames::close));
}
示例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));
}
示例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);
}