diff options
author | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2013-04-16 00:28:20 +0100 |
---|---|---|
committer | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2013-04-16 00:28:20 +0100 |
commit | 729fa8f98e07dda6502545ca8f4f24e230d6f76d (patch) | |
tree | ce5f1133175315ce4795c2ee9e64f084ef6c4dc7 /amiga | |
parent | 3edaf9ed2ea8bca302cccc218e12bf0b925d2ff3 (diff) | |
parent | d167da308bd8e4b32f4c43de79161efa8d3b1435 (diff) | |
download | netsurf-729fa8f98e07dda6502545ca8f4f24e230d6f76d.tar.gz netsurf-729fa8f98e07dda6502545ca8f4f24e230d6f76d.tar.bz2 |
Merge branch 'chris/scheduled-fetches'
Fixes issue with NetSurf hogging CPU time on AmigaOS
Diffstat (limited to 'amiga')
-rw-r--r-- | amiga/Makefile.target | 2 | ||||
-rw-r--r-- | amiga/download.c | 13 | ||||
-rw-r--r-- | amiga/gui.c | 31 | ||||
-rw-r--r-- | amiga/options.h | 3 |
4 files changed, 13 insertions, 36 deletions
diff --git a/amiga/Makefile.target b/amiga/Makefile.target index dc79479c5..29543c715 100644 --- a/amiga/Makefile.target +++ b/amiga/Makefile.target @@ -2,7 +2,7 @@ # Amiga target setup # ---------------------------------------------------------------------------- -CFLAGS += -std=c99 -Dnsamiga +CFLAGS += -std=c99 -Dnsamiga -DFETCHER_CURLL_SCHEDULED ifneq ($(SUBTARGET),os3) CFLAGS += -U__STRICT_ANSI__ -D__USE_INLINE__ -D__USE_BASETYPE__ diff --git a/amiga/download.c b/amiga/download.c index 16a50d8ff..b9b27ab9f 100644 --- a/amiga/download.c +++ b/amiga/download.c @@ -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); diff --git a/amiga/gui.c b/amiga/gui.c index 998b169b0..fbe46d0b5 100644 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -17,6 +17,7 @@ */ /* NetSurf core includes */ +#include "content/hlcache.h" #include "content/urldb.h" #include "css/utils.h" #include "desktop/browser_private.h" @@ -2459,27 +2460,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) diff --git a/amiga/options.h b/amiga/options.h index de65c3ee0..822a7a3aa 100644 --- a/amiga/options.h +++ b/amiga/options.h @@ -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}, \ |