Exemple #1
0
	HINTERNET GetCache(const std::wstring& proxyName)
	{
		ProxyCache* cache = nullptr;

		if (proxyName.empty())
		{
			// Use global proxy setting
			cache = m_GlobalProxyCache;
		}
		else
		{
			std::wstring key = proxyName;
			_wcslwr(&key[0]);

			auto iter = m_CacheMap.find(key);
			if (iter != m_CacheMap.end())
			{
				cache = (*iter).second;
			}
			else  // cache not found
			{
				// Create new proxy
				ProxyCache* cache = new ProxyCache(CreateProxy(proxyName.c_str()));
				m_CacheMap[key] = cache;
				//DebugLog(L"* ADD: key=%s, handle=0x%p, ref=new", key.c_str(), cache->GetCache());
				return cache->GetCache();
			}
		}

		// Use proxy cache
		cache->AddRef();
		//DebugLog(L"* ADD-REF: key=%s, handle=0x%p, global=%i, ref=%i",
		//	cache->IsGlobal() ? m_GlobalProxyName.c_str() : proxyName.c_str(), cache->GetCache(), cache->IsGlobal(), cache->GetRef());
		return cache->GetCache();
	}
Exemple #2
0
 QGraphicsProxyWidget *UiHelper::CreateInfoWidget()
 {
     QWidget *info = new QWidget();
     info_ui_.setupUi(info);
     info_proxy_ = CreateProxy(info);
     return info_proxy_;
 }
Exemple #3
0
 QGraphicsProxyWidget *UiHelper::CreateToolbar()
 {
     QWidget *toolbar = new QWidget();
     toolbar_ui_.setupUi(toolbar);
     connect(toolbar_ui_.button_exit, SIGNAL(clicked()), SIGNAL(ExitRequest()));
     return CreateProxy(toolbar);
 }
Exemple #4
0
	ProxyCachePool(LPCWSTR globalProxyName = nullptr) :
		m_GlobalProxyName((globalProxyName && *globalProxyName) ? globalProxyName : L"/auto")
	{
		m_GlobalProxyCache = new ProxyCache(CreateProxy(m_GlobalProxyName.c_str()), true);

		_wcslwr(&m_GlobalProxyName[0]);
		m_CacheMap[m_GlobalProxyName] = m_GlobalProxyCache;
		//DebugLog(L"* ADD-GLOBAL: key=%s, handle=0x%p, ref=new", m_GlobalProxyName.c_str(), m_GlobalProxyCache->GetCache());
	}
Exemple #5
0
void BroadPhaseTest::Action()
{
	int32 choice = rand() % 20;

	switch (choice)
	{
	case 0:
		CreateProxy();
		break;

	case 1:
		DestroyProxy();
		break;

	default:
		MoveProxy();
	}
}