summaryrefslogtreecommitdiff
path: root/indra/llcorehttp/_httppolicy.h
diff options
context:
space:
mode:
authorMonty Brandenberg <monty@lindenlab.com>2012-06-01 14:07:34 -0400
committerMonty Brandenberg <monty@lindenlab.com>2012-06-01 14:07:34 -0400
commitb8edacd0bb4feacc3ac1d61421e600c75ab87f7c (patch)
tree8f0e359445e324e4694e79526e443d5e6c90fab4 /indra/llcorehttp/_httppolicy.h
parent8fc350125c671baeae6b7f8b1814251009f4f50a (diff)
Major steps towards implementing the policy component.
Identified and reacted to the priority inversion problem we have in texturefetch. Includes the introduction of a priority_queue for the requests that are ready. Start some parameterization in anticipation of having policy_class everywhere. Removed _assert.h which isn't really needed in indra codebase. Implemented async setPriority request (which I hope I can get rid of eventually along with all priorities in this library). Converted to using unsigned int for priority rather than float. Implemented POST and did groundwork for PUT.
Diffstat (limited to 'indra/llcorehttp/_httppolicy.h')
-rw-r--r--indra/llcorehttp/_httppolicy.h28
1 files changed, 20 insertions, 8 deletions
diff --git a/indra/llcorehttp/_httppolicy.h b/indra/llcorehttp/_httppolicy.h
index 192bc73b31..c5e82d0a65 100644
--- a/indra/llcorehttp/_httppolicy.h
+++ b/indra/llcorehttp/_httppolicy.h
@@ -28,18 +28,23 @@
#define _LLCORE_HTTP_POLICY_H_
-#include <vector>
+#include "httprequest.h"
+#include "_httpservice.h"
+#include "_httpreadyqueue.h"
namespace LLCore
{
-
-class HttpService;
+class HttpReadyQueue;
class HttpOpRequest;
/// Implements class-based queuing policies for an HttpService instance.
+///
+/// Threading: Single-threaded. Other than for construction/destruction,
+/// all methods are expected to be invoked in a single thread, typically
+/// a worker thread of some sort.
class HttpPolicy
{
public:
@@ -51,16 +56,23 @@ private:
void operator=(const HttpPolicy &); // Not defined
public:
- void processReadyQueue();
+ /// Give the policy layer some cycles to scan the ready
+ /// queue promoting higher-priority requests to active
+ /// as permited.
+ HttpService::ELoopSpeed processReadyQueue();
+ /// Add request to a ready queue. Caller is expected to have
+ /// provided us with a reference count to hold the request. (No
+ /// additional references will be added.)
void addOp(HttpOpRequest *);
+
+ // Shadows HttpService's method
+ bool changePriority(HttpHandle handle, unsigned int priority);
protected:
- typedef std::vector<HttpOpRequest *> ready_queue_t;
-
-protected:
+ int mReadyInClass[HttpRequest::POLICY_CLASS_LIMIT];
+ HttpReadyQueue mReadyQueue[HttpRequest::POLICY_CLASS_LIMIT];
HttpService * mService; // Naked pointer, not refcounted, not owner
- ready_queue_t mReadyQueue;
}; // end class HttpPolicy