Optimize loops calling endInstances()

Thankies to Drake Arconis/Alchemy~
This commit is contained in:
Inusaito Sayori
2015-01-12 18:06:49 -05:00
parent 03e9db98e6
commit 844444c33b
8 changed files with 14 additions and 17 deletions

View File

@@ -59,7 +59,7 @@ void LFFloaterInvPanel::closeAll()
{
// We must make a copy first, because LLInstanceTracker doesn't allow destruction while having iterators to it.
std::vector<LFFloaterInvPanel*> cache;
for (instance_iter i = beginInstances(); i != endInstances(); ++i)
for (instance_iter i = beginInstances(), end(endInstances()); i != end; ++i)
{
cache.push_back(&*i);
}

View File

@@ -981,7 +981,7 @@ void LLFloaterProperties::closeByID(const LLUUID& item_id, const LLUUID &object_
//static
void LLFloaterProperties::dirtyAll()
{
for(instance_iter it = beginInstances();it!=endInstances();++it)
for(instance_iter it = beginInstances(), it_end(endInstances()); it != it_end; ++it)
{
it->dirty();
}

View File

@@ -149,8 +149,7 @@ void LLFloaterWebContent::showInstance(const std::string& window_class, Params&
LLSD key = p;
instance_iter it = beginInstances();
for(;it!=endInstances();++it)
for(instance_iter it(beginInstances()), it_end(endInstances()); it != it_end; ++it)
{
if(it->mKey["window_class"].asString() == window_class)
{
@@ -255,8 +254,7 @@ void LLFloaterWebContent::preCreate(LLFloaterWebContent::Params& p)
std::vector<LLFloaterWebContent*> instances;
instances.reserve(instanceCount());
instance_iter it = beginInstances();
for(;it!=endInstances();++it)
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);

View File

@@ -68,8 +68,7 @@ void LLFloaterWebProfile::showInstance(const std::string& window_class, Params&
LLSD key = p;
instance_iter it = beginInstances();
for(;it!=endInstances();++it)
for(instance_iter it(beginInstances()), it_end(endInstances()); it != it_end; ++it)
{
if(it->mKey["window_class"].asString() == window_class)
{