Beispiel #1
0
BOOL WINAPI isVideoFlash (LPCSTR pszWebPageUrl, LPCSTR pszFrameUrl, 
						  LPCSTR pszSwfUrl, LPCSTR pszFlashVars,
						  LPCSTR pszOtherSwfUrls, LPCSTR pszOtherFlashVars)
{
	LOGFN ("isVideoFlash");
	LOG (" Page URL: %s", pszWebPageUrl);
	LOG (" Frame URL: %s", pszFrameUrl);
	LOG (" Swf URL: %s", pszSwfUrl);
	LOG (" Flash Vars: %s", pszFlashVars);
	LOG (" Other Swf URLs: %s", pszOtherSwfUrls);
	LOG (" OtherFlashVars: %s", pszOtherFlashVars);
	
	vmsFindFlvDownloadsResultsCache::ResultPtr result;

	_FlvResCache.CheckNeedCacheReset ();
	result = _FlvResCache.FindResult (pszWebPageUrl, pszFrameUrl, pszSwfUrl, pszFlashVars);

	if (result)
		return result->pTa->get_FlvDownloadCount () != 0;

	vmsFindFlvDownloadsResultsCacheAsyncRequest *pRequest = new vmsFindFlvDownloadsResultsCacheAsyncRequest;
	pRequest->m_strWebPageUrl = pszWebPageUrl;
	pRequest->m_strFrameUrl = pszFrameUrl;
	pRequest->m_strSwfUrl = pszSwfUrl;
	pRequest->m_strFlashVars = pszFlashVars;
	pRequest->m_strOtherSwfUrls = pszOtherSwfUrls;
	pRequest->m_strOtherFlashVars = pszOtherFlashVars;
	if (_AsyncTasks.HasEqualTask (pRequest, NULL))
		return FALSE;

	HANDLE hevDone = CreateEvent (NULL, TRUE, FALSE, NULL);
	pRequest->setOnDoneEvent (hevDone);
	pRequest->setFlags (vmsAsyncTask::RemoveWhenDone);

	tsp_vmsAsyncTask spTask (pRequest);
	_AsyncTasks.AddTask (spTask);

	if (WAIT_TIMEOUT == WaitForSingleObject (hevDone, 300))
		return FALSE;

	result = pRequest->m_result;
	
	return result != NULL && result->pTa->get_FlvDownloadCount () != 0;
}
void V8Platform::CallOnBackgroundThread(v8::Task* pTask, ExpectedRuntime /*runtime*/)
{
    std::shared_ptr<v8::Task> spTask(pTask);
    Concurrency::create_task([spTask] { spTask->Run(); });
}