Пример #1
0
bool ItemJSBinding::addExtender(ChromiumDLL::JavaScriptExtenderI* extender)
{
	if (!extender)
		return false;

	bool found = false;

	g_ItemLock.lock();

	for (size_t x=0; x<g_vExtenderList.size(); x++)
	{
		if (g_vExtenderList[x] == extender)
		{
			found = true;
			break;
		}
	}

	if (!found)
		g_vExtenderList.push_back(extender);

	g_ItemLock.unlock();

	return !found;
}
Пример #2
0
uint32 ItemJSBinding::AddItem(ScriptCoreItemI* item)
{
	uint32 hash = UTIL::MISC::RSHash_CSTR(gcString("{0}", (uint64)item));

	g_ItemLock.lock();
	g_ItemMap[hash] = item;
	g_ItemLock.unlock();

	return hash;
}
Пример #3
0
void ItemJSBinding::RemoveItem(uint32 itemId)
{
	g_ItemLock.lock();

	auto it = g_ItemMap.find(itemId);

	if (it != g_ItemMap.end())
		g_ItemMap.erase(it);

	g_ItemLock.unlock();
}
Пример #4
0
ScriptCoreItemI* ItemJSBinding::GetItem(uint32 itemId)
{
	ScriptCoreItemI* ret = NULL;

	g_ItemLock.lock();

	auto it = g_ItemMap.find(itemId);

	if (it != g_ItemMap.end())
		ret= it->second;

	g_ItemLock.unlock();

	return ret;
}
Пример #5
0
const char* ItemJSBinding::getRegistrationCode()
{
	DesuraJSBase<ItemJSBinding>::getRegistrationCode();

	g_ItemLock.lock();

	for (size_t x=0; x<g_vExtenderList.size(); x++)
	{
		const char* code = g_vExtenderList[x]->getRegistrationCode();
		m_szRegCode.append(code);
	}

	g_ItemLock.unlock();

	return m_szRegCode.c_str();
}
Пример #6
0
JSObjHandle ItemJSBinding::execute(ChromiumDLL::JavaScriptFunctionArgs* args)
{
	JSObjHandle ret =  DesuraJSBase<ItemJSBinding>::execute(args);
	
	if (!ret->isException() || g_vExtenderList.empty())
		return ret;

	g_ItemLock.lock();

	for (size_t x=0; x<g_vExtenderList.size(); x++)
	{
		ret = g_vExtenderList[x]->execute(args);

		if (!ret->isException())
			break;
	}

	g_ItemLock.unlock();
	return ret;
}
Пример #7
0
	void log(const std::string& message)
	{
		mutex.lock();
		os << "logger: " << message << "\n";
		mutex.unlock();
	}
Пример #8
0
void WildcardManager::needSpecial(WCSpecialInfo *info)
{
	m_WCMutex.lock();
	onNeedSpecialEvent(*info);
	m_WCMutex.unlock();
}