Merge branch 'chris/scheduled-fetches'

This commit is contained in:
Chris Young 2013-04-16 00:01:11 +01:00
commit f432efa2b1
3 changed files with 11 additions and 35 deletions

View File

@ -85,7 +85,6 @@ enum {
};
int downloads_in_progress = 0;
BYTE original_task_priority = 0;
struct gui_download_window *gui_download_window_create(download_context *ctx,
struct gui_window *gui)
@ -186,13 +185,6 @@ struct gui_download_window *gui_download_window_create(download_context *ctx,
dw->node = AddObject(window_list,AMINS_DLWINDOW);
dw->node->objstruct = dw;
/* Set task priority to -1.
* NetSurf loops without Wait()ing when downloading,
* so this gives other tasks a bit more CPU time. */
if(downloads_in_progress == 0) {
original_task_priority = SetTaskPri(FindTask(0), (BYTE)nsoption_int(download_task_pri));
LOG(("Now running at priority %d (was %d)", nsoption_int(download_task_pri), original_task_priority));
}
downloads_in_progress++;
return dw;
@ -282,12 +274,7 @@ void gui_download_window_done(struct gui_download_window *dw)
SetComment(dw->fname, dw->url);
if(dw->url) free(dw->url);
/* Set task priority back to what it was originally */
downloads_in_progress--;
if(downloads_in_progress == 0) {
BYTE taskpri = SetTaskPri(FindTask(0), original_task_priority);
LOG(("Now running at priority %d (was %d)", original_task_priority, taskpri));
}
DisposeObject(dw->objects[OID_MAIN]);
DelObject(dw->node);

View File

@ -2459,27 +2459,19 @@ printf("sig recvd %ld (%ld %ld %ld %ld %ld %ld)\n", signal, winsignal , appsig ,
}
}
static void ami_gui_fetch_callback(void *p)
{
/* This doesn't need to do anything - the scheduled event will
* send a message to trigger Wait() to return, thereby causing
* the event function to return, and NetSurf to call
* hlcache_poll() as part of the usual fetch/event loop.
*/
}
void gui_poll(bool active)
{
/* However, down here we are waiting for the user to do something or for a
scheduled event to kick in (the active variable seems to have no real
bearing on reality, but is supposed to indicate that NetSurf wants
control back ASAP, so we poll in that case).
schedule_run checks every event, really they need to be sorted so only
the first event needs to be run on each signal. */
if(active)
{
ami_handle_msg();
ami_handle_appmsg();
ami_handle_applib();
ami_arexx_handle();
schedule_run(TRUE);
}
else
{
ami_get_msg();
}
if(active) schedule(0, ami_gui_fetch_callback, NULL);
ami_get_msg();
}
void ami_change_tab(struct gui_window_2 *gwin, int direction)

View File

@ -48,7 +48,6 @@
char *arexx_shutdown; \
char *download_dir; \
bool download_notify; \
int download_task_pri; \
bool faster_scroll; \
bool scale_quality; \
int dither_quality; \
@ -115,7 +114,6 @@
.arexx_shutdown = NULL, \
.download_dir = NULL, \
.download_notify = false, \
.download_task_pri = -1, \
.faster_scroll = true, \
.scale_quality = false, \
.dither_quality = 1, \
@ -181,7 +179,6 @@
{ "arexx_shutdown", OPTION_STRING, &nsoptions.arexx_shutdown }, \
{ "download_dir", OPTION_STRING, &nsoptions.download_dir }, \
{ "download_notify", OPTION_BOOL, &nsoptions.download_notify}, \
{ "download_task_pri", OPTION_INTEGER, &nsoptions.download_task_pri}, \
{ "faster_scroll", OPTION_BOOL, &nsoptions.faster_scroll}, \
{ "scale_quality", OPTION_BOOL, &nsoptions.scale_quality}, \
{ "dither_quality", OPTION_INTEGER, &nsoptions.dither_quality}, \