示例#1
0
//static
void LLEventTimer::updateClass() 
{
	std::list<LLEventTimer*> completed_timers;
	for (instance_iter iter = beginInstances(), iter_end = endInstances(); iter != iter_end;)
	{
		LLEventTimer& timer = *iter++;
		F32 et = timer.mEventTimer.getElapsedTimeF32();
		if (timer.mEventTimer.getStarted() && et > timer.mPeriod) {
			timer.mEventTimer.reset();
			if ( timer.tick() )
			{
				completed_timers.push_back( &timer );
			}
		}
	}

	if ( completed_timers.size() > 0 )
	{
		for (std::list<LLEventTimer*>::iterator completed_iter = completed_timers.begin(); 
			 completed_iter != completed_timers.end(); 
			 completed_iter++ ) 
		{
			delete *completed_iter;
		}
	}
}
//static
void LLFloaterWebContent::showInstance(const std::string& window_class, Params& p)
{
    p.window_class(window_class);

    LLSD key = p;

    for(instance_iter it(beginInstances()), it_end(endInstances()); it != it_end; ++it)
    {
        if(it->mKey["window_class"].asString() == window_class)
        {
            if(it->matchesKey(key))
            {
                it->mKey = key;
                it->setKey(p.id());
                it->mAgeTimer.reset();
                it->open();
                return;
            }
        }
    }
    LLFloaterWebContent* old_inst = getInstance(p.id());
    if(old_inst)
    {
        LL_WARNS() << "Replacing unexpected duplicate floater: " << p.id() << LL_ENDL;
        old_inst->mKey = key;
        old_inst->mAgeTimer.reset();
        old_inst->open();
    }
    assert(!old_inst);

    if(!old_inst)
        LLUICtrlFactory::getInstance()->buildFloater(LLFloaterWebContent::create(p), "floater_web_content.xml");
}
示例#3
0
// called once per frame regardless of console visibility
// static
void LLConsole::updateClass()
{	
	for (instance_iter it = beginInstances(); it != endInstances(); ++it)
	{
		it->update();
	} 
}
// static
void LLFloaterWebContent::preCreate(LLFloaterWebContent::Params& p)
{
    LL_DEBUGS() << "url = " << p.url() << ", target = " << p.target() << ", uuid = " << p.id() << LL_ENDL;

    if (!p.id.isProvided())
    {
        p.id = LLUUID::generateNewID().asString();
    }

    if(p.target().empty() || p.target() == "_blank")
    {
        p.target = p.id();
    }

    S32 browser_window_limit = gSavedSettings.getS32("WebContentWindowLimit");
    if(browser_window_limit != 0)
    {
        // showInstance will open a new window.  Figure out how many web browsers are already open,
        // and close the least recently opened one if this will put us over the limit.

        std::vector<LLFloaterWebContent*> instances;
        instances.reserve(instanceCount());
        for(instance_iter it(beginInstances()), it_end(endInstances()); it != it_end; ++it)
        {
            if(it->mKey["window_class"].asString() == p.window_class.getValue())
                instances.push_back(&*it);
        }

        std::sort(instances.begin(), instances.end(), CompareAgeDescending());

        //LLFloaterReg::const_instance_list_t &instances = LLFloaterReg::getFloaterList(p.window_class);
        LL_DEBUGS() << "total instance count is " << instances.size() << LL_ENDL;

        for(std::vector<LLFloaterWebContent*>::const_iterator iter = instances.begin(); iter != instances.end(); iter++)
        {
            LL_DEBUGS() << "    " << (*iter)->mKey["target"] << LL_ENDL;
        }

        if(instances.size() >= (size_t)browser_window_limit)
        {
            // Destroy the least recently opened instance
            (*instances.begin())->close();
        }
    }
}
//static
void LLThreadLocalPointerBase::initAllThreadLocalStorage()
{
	if (!sInitialized)
	{
		for (LLInstanceTracker<LLThreadLocalPointerBase>::instance_iter it = beginInstances(), end_it = endInstances();
			it != end_it;
			++it)
		{
			(*it).initStorage();
		}
		sInitialized = true;
	}
}