void cserve2_request_cancel_all(Slave_Request *req, Error_Type err);
void cserve2_requests_init(void);
void cserve2_requests_shutdown(void);
+void cserve2_request_dependents_drop(Slave_Request *req, Slave_Request_Type type);
+void cserve2_entry_request_drop(void *data, Slave_Request_Type type);
void cserve2_font_init(void);
void cserve2_font_shutdown(void);
static int max_font_usage = 10 * 4 * 1024; /* in kbytes */
static int font_mem_usage = 0;
+#define MAX_PREEMPTIVE_LOAD_SIZE (320*320*4)
+
#ifdef DEBUG_LOAD_TIME
static int
_timeval_sub(const struct timeval *tv2, const struct timeval *tv1)
_open_request_response(Entry *entry, Slave_Msg_Image_Opened *resp, int *size)
{
File_Data *fd;
+ Slave_Request *req;
_entry_load_finish(entry);
+ req = entry->request;
entry->request = NULL;
fd = _file_data_find(entry->id);
}
fd->valid = EINA_TRUE;
+
+ // If the image is too large, cancel pre-emptive load.
+ if (fd->w * fd->h * 4 >= MAX_PREEMPTIVE_LOAD_SIZE)
+ {
+ DBG("Not pre-loading this image ");
+ cserve2_request_dependents_drop(req, CSERVE2_REQ_IMAGE_SPEC_LOAD);
+ }
+
return _image_opened_msg_create(fd, size);
}
+void
+cserve2_entry_request_drop(void *data, Slave_Request_Type type EINA_UNUSED)
+{
+ Entry *e = data;
+
+ if (!e) return;
+ e->request = NULL;
+}
+
static void
_request_failed(Entry *e, Error_Type type EINA_UNUSED)
{
}
void
+cserve2_request_dependents_drop(Slave_Request *req, Slave_Request_Type type)
+{
+ Slave_Request *dep;
+ Eina_List *l, *l_next;
+
+ if (type != CSERVE2_REQ_IMAGE_SPEC_LOAD)
+ {
+ CRIT("Only CSERVE2_REQ_IMAGE_SPEC_LOAD is supported.");
+ return;
+ }
+
+ EINA_LIST_FOREACH_SAFE(req->dependents, l, l_next, dep)
+ {
+ if (dep->type == type)
+ {
+ req->dependents = eina_list_remove_list(req->dependents, l);
+
+ if (dep->processing)
+ dep->cancelled = EINA_TRUE;
+ else
+ {
+ cserve2_entry_request_drop(dep->data, type);
+ requests[type].waiting = eina_inlist_remove(
+ requests[type].waiting, EINA_INLIST_GET(dep));
+ dep->funcs->msg_free(dep->msg, dep->data);
+ free(dep);
+ }
+ }
+ }
+}
+
+void
cserve2_requests_init(void)
{
DBG("Initializing requests.");
printf("Refcount %d\n", id->refcount);
printf("Sparse alpha %s\n"
"Unused: %s\n"
- "Load requested: %s\n",
+ "Load requested: %s\n"
+ "Valid: %s\n",
id->alpha_sparse ? "YES" : "NO",
id->unused ? "YES" : "NO",
- id->doload ? "YES" : "NO");
+ id->doload ? "YES" : "NO",
+ id->valid ? "YES" : "NO");
printf("Shm Path: '%s'\n",
id->shm_id ? _shared_string_get(id->shm_id) : "");
-
printf("LoadOpts: width %d\n", id->opts.w);
printf(" height %d\n", id->opts.h);
printf(" degree %d\n", id->opts.degree);