Ejemplo n.º 1
0
simplest::Simple simplest::Simple::create()  {
    if(instanceCount() == 0)
        return Simple();
    Simple result = popFreeSimple();
    if(!result.isValid())
    {
        if(getUsed() >= instanceCount())
            reallocInstances(instanceCount() << 1);
        result = Simple(getUsed());
        setUsed(getUsed() + 1);
    }
    result.reset();
    result.onCreate();
    return result;
}
Ejemplo n.º 2
0
testlist::Parent testlist::Parent::create()  {
    if(instanceCount() == 0)
        return Parent();
    Parent result = popFreeParent();
    if(!result.isValid())
    {
        if(getUsed() >= instanceCount())
            reallocInstances(instanceCount() << 1);
        result = Parent(getUsed());
        setUsed(getUsed() + 1);
    }
    result.reset();
    result.onCreate();
    return result;
}
Ejemplo n.º 3
0
testlist::Child testlist::Child::create()  {
    if(instanceCount() == 0)
        return Child();
    Child result = popFreeChild();
    if(!result.isValid())
    {
        if(getUsed() >= instanceCount())
            reallocInstances(instanceCount() << 1);
        result = Child(getUsed());
        setUsed(getUsed() + 1);
    }
    result.reset();
    result.onCreate();
    return result;
}
Ejemplo n.º 4
0
void DrawExecution::drawArraysInstanced() const
{
    gl::glBindVertexArray(m_drawImpl.glVertexArray);
    gl::glDrawArraysInstanced(m_drawImpl.state.rasterizerState().primitive(),
                                        0u,
                                        vertexCount(),
                                        instanceCount());
}
Ejemplo n.º 5
0
void DrawExecution::drawElementsInstanced() const
{
    gl::glBindVertexArray(m_drawImpl.glVertexArray);
    gl::glDrawElementsInstanced(m_drawImpl.state.rasterizerState().primitive(),
                                elementCount(),
                                elementType(),
                                nullptr,
                                instanceCount());
}
// 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();
        }
    }
}