forked from enlightenment/efl
Add Speculative Load type to requests and a way to
change requests from one type to another SVN revision: 73986
This commit is contained in:
parent
558e2eb267
commit
073da7dfb2
|
@ -211,6 +211,7 @@ typedef enum {
|
|||
typedef enum {
|
||||
CSERVE2_REQ_IMAGE_OPEN = 0,
|
||||
CSERVE2_REQ_IMAGE_LOAD,
|
||||
CSERVE2_REQ_IMAGE_SPEC_LOAD,
|
||||
CSERVE2_REQ_FONT_LOAD,
|
||||
CSERVE2_REQ_FONT_GLYPHS_LOAD,
|
||||
CSERVE2_REQ_LAST
|
||||
|
@ -295,6 +296,7 @@ void cserve2_cache_font_debug(Client *client, unsigned int rid);
|
|||
|
||||
Slave_Request *cserve2_request_add(Slave_Request_Type type, unsigned int rid, Client *client, Slave_Request *dep, Slave_Request_Funcs *funcs, void *data);
|
||||
void cserve2_request_waiter_add(Slave_Request *req, unsigned int rid, Client *client);
|
||||
void cserve2_request_type_set(Slave_Request *req, Slave_Request_Type type);
|
||||
void cserve2_request_cancel(Slave_Request *req, Client *client, Error_Type err);
|
||||
void cserve2_request_cancel_all(Slave_Request *req, Error_Type err);
|
||||
void cserve2_requests_init(void);
|
||||
|
|
|
@ -2035,7 +2035,7 @@ cserve2_cache_image_opts_set(Client *client, Msg_Setopts *msg)
|
|||
fentry = entry->file;
|
||||
fentry->images = eina_list_append(fentry->images, entry);
|
||||
|
||||
entry->base.request = cserve2_request_add(CSERVE2_REQ_IMAGE_LOAD,
|
||||
entry->base.request = cserve2_request_add(CSERVE2_REQ_IMAGE_SPEC_LOAD,
|
||||
0, NULL, fentry->base.request,
|
||||
&_load_funcs, entry);
|
||||
return 0;
|
||||
|
@ -2069,17 +2069,8 @@ cserve2_cache_image_load(Client *client, unsigned int client_image_id, unsigned
|
|||
if (entry->base.request)
|
||||
{
|
||||
cserve2_request_waiter_add(entry->base.request, rid, client);
|
||||
/* do this in *_requests.c. somehow
|
||||
if ((!entry->base.request->processing) && (!entry->doload))
|
||||
{
|
||||
DBG("Removing entry %d from speculative preload and adding "
|
||||
"to normal load queue.", entry->base.id);
|
||||
spload_requests = eina_list_remove(spload_requests,
|
||||
entry->base.request);
|
||||
load_requests = eina_list_append(load_requests,
|
||||
entry->base.request);
|
||||
}
|
||||
*/
|
||||
if (!entry->doload)
|
||||
cserve2_request_type_set(entry->base.request, CSERVE2_REQ_IMAGE_LOAD);
|
||||
}
|
||||
else if (entry->shm)
|
||||
_image_loaded_send(client, entry, rid);
|
||||
|
@ -2121,17 +2112,8 @@ cserve2_cache_image_preload(Client *client, unsigned int client_image_id, unsign
|
|||
if (entry->base.request)
|
||||
{
|
||||
cserve2_request_waiter_add(entry->base.request, rid, client);
|
||||
/* do this in *_requests.c. somehow
|
||||
if ((!entry->base.request->processing) && (!entry->doload))
|
||||
{
|
||||
DBG("Removing entry %d from speculative preload and adding "
|
||||
"to normal load queue.", entry->base.id);
|
||||
spload_requests = eina_list_remove(spload_requests,
|
||||
entry->base.request);
|
||||
load_requests = eina_list_append(load_requests,
|
||||
entry->base.request);
|
||||
}
|
||||
*/
|
||||
if (!entry->doload)
|
||||
cserve2_request_type_set(entry->base.request, CSERVE2_REQ_IMAGE_LOAD);
|
||||
}
|
||||
else if (entry->shm)
|
||||
_image_loaded_send(client, entry, rid);
|
||||
|
|
|
@ -36,13 +36,16 @@ static struct _Request_Match
|
|||
Slave_Request_Type rtype;
|
||||
Slave_Type stype;
|
||||
Slave_Command ctype;
|
||||
int require_spares; /* for speculative operations, will require to leave at
|
||||
least this number of slaves always available */
|
||||
} _request_match[] =
|
||||
{
|
||||
{ CSERVE2_REQ_IMAGE_OPEN, SLAVE_IMAGE, IMAGE_OPEN },
|
||||
{ CSERVE2_REQ_IMAGE_LOAD, SLAVE_IMAGE, IMAGE_LOAD },
|
||||
{ CSERVE2_REQ_FONT_LOAD, SLAVE_FONT, FONT_LOAD },
|
||||
{ CSERVE2_REQ_FONT_GLYPHS_LOAD, SLAVE_FONT, FONT_GLYPHS_LOAD },
|
||||
{ CSERVE2_REQ_LAST, 0, 0 }
|
||||
{ CSERVE2_REQ_IMAGE_OPEN, SLAVE_IMAGE, IMAGE_OPEN, 0 },
|
||||
{ CSERVE2_REQ_IMAGE_LOAD, SLAVE_IMAGE, IMAGE_LOAD, 0 },
|
||||
{ CSERVE2_REQ_IMAGE_SPEC_LOAD, SLAVE_IMAGE, IMAGE_LOAD, 1 },
|
||||
{ CSERVE2_REQ_FONT_LOAD, SLAVE_FONT, FONT_LOAD, 0 },
|
||||
{ CSERVE2_REQ_FONT_GLYPHS_LOAD, SLAVE_FONT, FONT_GLYPHS_LOAD, 0 },
|
||||
{ CSERVE2_REQ_LAST, 0, 0, 0 }
|
||||
};
|
||||
|
||||
static Slave *_create_image_slave(void *data);
|
||||
|
@ -174,6 +177,21 @@ cserve2_request_waiter_add(Slave_Request *req, unsigned int rid, Client *client)
|
|||
_request_waiter_add(req, client, rid);
|
||||
}
|
||||
|
||||
void
|
||||
cserve2_request_type_set(Slave_Request *req, Slave_Request_Type type)
|
||||
{
|
||||
Eina_Inlist **from, **to;
|
||||
|
||||
if (req->processing || (type == req->type))
|
||||
return;
|
||||
|
||||
from = &requests[req->type].waiting;
|
||||
to = &requests[type].waiting;
|
||||
|
||||
*from = eina_inlist_remove(*from, EINA_INLIST_GET(req));
|
||||
*to = eina_inlist_append(*to, EINA_INLIST_GET(req));
|
||||
}
|
||||
|
||||
static void
|
||||
_request_dependents_cancel(Slave_Request *req, Error_Type err)
|
||||
{
|
||||
|
@ -488,7 +506,8 @@ _cserve2_requests_process(void)
|
|||
{
|
||||
Slave_Worker *sw;
|
||||
|
||||
if (eina_list_count(*working) >= max_workers)
|
||||
if (eina_list_count(*working) >=
|
||||
(max_workers - _request_match[j].require_spares))
|
||||
break;
|
||||
|
||||
if (req->locked)
|
||||
|
|
Loading…
Reference in New Issue