本文整理汇总了C++中LLAssetRequest::mDownCallback方法的典型用法代码示例。如果您正苦于以下问题:C++ LLAssetRequest::mDownCallback方法的具体用法?C++ LLAssetRequest::mDownCallback怎么用?C++ LLAssetRequest::mDownCallback使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLAssetRequest
的用法示例。
在下文中一共展示了LLAssetRequest::mDownCallback方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deletePendingRequestImpl
// virtual
bool LLAssetStorage::deletePendingRequestImpl(LLAssetStorage::request_list_t* requests,
LLAssetType::EType asset_type,
const LLUUID& asset_id)
{
LLAssetRequest* req = findRequest(requests, asset_type, asset_id);
if (req)
{
// Remove the request from this list.
requests->remove(req);
S32 error = LL_ERR_TCP_TIMEOUT;
// Run callbacks.
if (req->mUpCallback)
{
req->mUpCallback(req->getUUID(), req->mUserData, error, LL_EXSTAT_REQUEST_DROPPED);
}
if (req->mDownCallback)
{
req->mDownCallback(mVFS, req->getUUID(), req->getType(), req->mUserData, error, LL_EXSTAT_REQUEST_DROPPED);
}
if (req->mInfoCallback)
{
LLAssetInfo info;
req->mInfoCallback(&info, req->mUserData, error);
}
delete req;
return true;
}
return false;
}
示例2: _cleanupRequests
void LLAssetStorage::_cleanupRequests(BOOL all, S32 error)
{
F64 mt_secs = LLMessageSystem::getMessageTimeSeconds();
request_list_t timed_out;
S32 rt;
for (rt = 0; rt < RT_COUNT; rt++)
{
request_list_t* requests = getRequestList((ERequestType)rt);
for (request_list_t::iterator iter = requests->begin();
iter != requests->end(); )
{
request_list_t::iterator curiter = iter++;
LLAssetRequest* tmp = *curiter;
// if all is true, we want to clean up everything
// otherwise just check for timed out requests
// EXCEPT for upload timeouts
if (all
|| ((RT_DOWNLOAD == rt)
&& LL_ASSET_STORAGE_TIMEOUT < (mt_secs - tmp->mTime)))
{
llwarns << "Asset " << getRequestName((ERequestType)rt) << " request "
<< (all ? "aborted" : "timed out") << " for "
<< tmp->getUUID() << "."
<< LLAssetType::lookup(tmp->getType()) << llendl;
timed_out.push_front(tmp);
iter = requests->erase(curiter);
}
}
}
LLAssetInfo info;
for (request_list_t::iterator iter = timed_out.begin();
iter != timed_out.end(); )
{
request_list_t::iterator curiter = iter++;
LLAssetRequest* tmp = *curiter;
if (tmp->mUpCallback)
{
tmp->mUpCallback(tmp->getUUID(), tmp->mUserData, error, LL_EXSTAT_NONE);
}
if (tmp->mDownCallback)
{
tmp->mDownCallback(mVFS, tmp->getUUID(), tmp->getType(), tmp->mUserData, error, LL_EXSTAT_NONE);
}
if (tmp->mInfoCallback)
{
tmp->mInfoCallback(&info, tmp->mUserData, error);
}
delete tmp;
}
}
示例3: downloadCompleteCallback
void LLAssetStorage::downloadCompleteCallback(
S32 result,
const LLUUID& file_id,
LLAssetType::EType file_type,
void* user_data, LLExtStat ext_status)
{
lldebugs << "LLAssetStorage::downloadCompleteCallback() for " << file_id
<< "," << LLAssetType::lookup(file_type) << llendl;
LLAssetRequest* req = (LLAssetRequest*)user_data;
if(!req)
{
llwarns << "LLAssetStorage::downloadCompleteCallback called without"
"a valid request." << llendl;
return;
}
if (!gAssetStorage)
{
llwarns << "LLAssetStorage::downloadCompleteCallback called without any asset system, aborting!" << llendl;
return;
}
// Inefficient since we're doing a find through a list that may have thousands of elements.
// This is due for refactoring; we will probably change mPendingDownloads into a set.
request_list_t::iterator download_iter = std::find(gAssetStorage->mPendingDownloads.begin(),
gAssetStorage->mPendingDownloads.end(),
req);
// If the LLAssetRequest doesn't exist in the downloads queue, then it either has already been deleted
// by _cleanupRequests, or it's a transfer.
if (download_iter != gAssetStorage->mPendingDownloads.end())
{
req->setUUID(file_id);
req->setType(file_type);
}
if (LL_ERR_NOERR == result)
{
// we might have gotten a zero-size file
LLVFile vfile(gAssetStorage->mVFS, req->getUUID(), req->getType());
if (vfile.getSize() <= 0)
{
llwarns << "downloadCompleteCallback has non-existent or zero-size asset " << req->getUUID() << llendl;
result = LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE;
vfile.remove();
}
}
// find and callback ALL pending requests for this UUID
// SJB: We process the callbacks in reverse order, I do not know if this is important,
// but I didn't want to mess with it.
request_list_t requests;
for (request_list_t::iterator iter = gAssetStorage->mPendingDownloads.begin();
iter != gAssetStorage->mPendingDownloads.end(); )
{
request_list_t::iterator curiter = iter++;
LLAssetRequest* tmp = *curiter;
if ((tmp->getUUID() == file_id) && (tmp->getType()== file_type))
{
requests.push_front(tmp);
iter = gAssetStorage->mPendingDownloads.erase(curiter);
}
}
for (request_list_t::iterator iter = requests.begin();
iter != requests.end(); )
{
request_list_t::iterator curiter = iter++;
LLAssetRequest* tmp = *curiter;
if (tmp->mDownCallback)
{
tmp->mDownCallback(gAssetStorage->mVFS, req->getUUID(), req->getType(), tmp->mUserData, result, ext_status);
}
delete tmp;
}
}