本文整理汇总了C++中MojRefCountedPtr::GetPriority方法的典型用法代码示例。如果您正苦于以下问题:C++ MojRefCountedPtr::GetPriority方法的具体用法?C++ MojRefCountedPtr::GetPriority怎么用?C++ MojRefCountedPtr::GetPriority使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MojRefCountedPtr
的用法示例。
在下文中一共展示了MojRefCountedPtr::GetPriority方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DownloadPart
void ImapSession::DownloadPart(const MojObject& folderId, const MojObject& emailId, const MojObject& partId, const MojRefCountedPtr<DownloadListener>& listener, Command::Priority priority)
{
MojRefCountedPtr<FetchPartCommand> command(new FetchPartCommand(*this, folderId, emailId, partId, priority));
// Look for an active command
MojRefCountedPtr<ImapCommand> activeCommand = FindActiveCommand(command);
if(activeCommand.get()) {
MojLogDebug(m_log, "attaching download request to existing active command");
if(listener.get())
static_cast<FetchPartCommand*>(activeCommand.get())->AddDownloadListener(listener);
return;
}
// Look for a pending command with equal or higher priority
// TODO: requeue if a higher priority is needed
MojRefCountedPtr<ImapCommand> pendingCommand = FindPendingCommand(command);
if(pendingCommand.get() && pendingCommand->GetPriority() >= priority) {
MojLogDebug(m_log, "attaching download request to existing pending command");
if(listener.get())
static_cast<FetchPartCommand*>(pendingCommand.get())->AddDownloadListener(listener);
// Poke the queue in case it's not already running
CheckQueue();
return;
}
// Otherwise, use the new command
if(listener.get())
command->AddDownloadListener(listener);
// If this is a high priority request, set m_recentUserInteraction to true
if (priority >= Command::HighPriority) {
m_recentUserInteraction = true;
}
m_commandManager->QueueCommand(command, false);
CheckQueue();
}