summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMonty Brandenberg <monty@lindenlab.com>2012-07-16 11:53:04 -0400
committerMonty Brandenberg <monty@lindenlab.com>2012-07-16 11:53:04 -0400
commitd238341afaecedfe227141126c4c35dcde4a0671 (patch)
treeb1c3140fdd357c67abbc75d09846ce7c21678b69 /indra/newview
parent5eb5dc6b27c57f1c3e77fc04b471614968620068 (diff)
SH-3189 Remove/improve naive data structures
When releasing HTTP waiters, avoid unnecessary sort activity. For Content-Type in responses, let libcurl do the work and removed my parsing of headers. Drop Content-Encoding as libcurl will deal with that. If anyone is interested, they can parse.
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/lltexturefetch.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index 8314031f14..225ea46558 100755
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -3342,6 +3342,17 @@ void LLTextureFetch::removeHttpWaiter(const LLUUID & tid)
mNetworkQueueMutex.unlock(); // -Mfnq
}
+// Release as many requests as permitted from the WAIT_HTTP_RESOURCE2
+// state to the SEND_HTTP_REQ state based on their current priority.
+//
+// This data structures and code associated with this looks a bit
+// indirect and naive but it's done in the name of safety. An
+// ordered container may become invalid from time to time due to
+// priority changes caused by actions in other threads. State itself
+// could also suffer the same fate with canceled operations. Even
+// done this way, I'm not fully trusting we're truly safe. This
+// module is due for a major refactoring and we'll deal with it then.
+//
// Threads: Ttf
// Locks: -Mw (must not hold any worker when called)
void LLTextureFetch::releaseHttpWaiters()
@@ -3384,12 +3395,15 @@ void LLTextureFetch::releaseHttpWaiters()
tids2.push_back(worker);
}
}
-
- // Sort into priority order
- LLTextureFetchWorker::Compare compare;
- std::sort(tids2.begin(), tids2.end(), compare);
tids.clear();
+ // Sort into priority order, if necessary and only as much as needed
+ if (tids2.size() > mHttpSemaphore)
+ {
+ LLTextureFetchWorker::Compare compare;
+ std::partial_sort(tids2.begin(), tids2.begin() + mHttpSemaphore, tids2.end(), compare);
+ }
+
// Release workers up to the high water mark. Since we aren't
// holding any locks at this point, we can be in competition
// with other callers. Do defensive things like getting