diff options
author | Vincent Sanders <vince@kyllikki.org> | 2014-03-08 14:13:27 +0000 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2014-03-09 15:37:40 +0000 |
commit | 87f6314dabdc2067a19e01f8b29f9ecc38ed825b (patch) | |
tree | 78f8f8395e3bf3b7ee2c18a7b5a5e6d2d5ca9ddc /beos | |
parent | fb9b171e325488dc9792ee0f3062f15d8ec597ee (diff) | |
download | netsurf-87f6314dabdc2067a19e01f8b29f9ecc38ed825b.tar.gz netsurf-87f6314dabdc2067a19e01f8b29f9ecc38ed825b.tar.bz2 |
move scheduleing into browser operation table
Diffstat (limited to 'beos')
-rw-r--r-- | beos/gui.cpp | 1 | ||||
-rw-r--r-- | beos/gui.h | 3 | ||||
-rw-r--r-- | beos/scaffolding.cpp | 9 | ||||
-rw-r--r-- | beos/schedule.cpp | 26 | ||||
-rw-r--r-- | beos/schedule.h | 7 |
5 files changed, 26 insertions, 20 deletions
diff --git a/beos/gui.cpp b/beos/gui.cpp index 646356acf..365a35642 100644 --- a/beos/gui.cpp +++ b/beos/gui.cpp @@ -1049,6 +1049,7 @@ static struct gui_fetch_table beos_fetch_table = { static struct gui_browser_table beos_browser_table = { gui_poll, + beos_schedule, gui_quit, NULL, //set_search_ico gui_launch_url, diff --git a/beos/gui.h b/beos/gui.h index 24223a18d..642441fdd 100644 --- a/beos/gui.h +++ b/beos/gui.h @@ -51,9 +51,6 @@ virtual void AboutRequested(); virtual bool QuitRequested(); }; - -extern void schedule_run(void); - extern BWindow *wndAbout; extern BWindow *wndTooltip; diff --git a/beos/scaffolding.cpp b/beos/scaffolding.cpp index fa9549c8f..35153b33d 100644 --- a/beos/scaffolding.cpp +++ b/beos/scaffolding.cpp @@ -62,7 +62,6 @@ extern "C" { #include "render/font.h" #include "render/form.h" #include "utils/messages.h" -#include "utils/schedule.h" #include "utils/utils.h" #include "utils/log.h" } @@ -75,7 +74,7 @@ extern "C" { //#include "beos/completion.h" #include "beos/throbber.h" #include "beos/window.h" -//#include "beos/schedule.h" +#include "beos/schedule.h" //#include "beos/download.h" #define TOOLBAR_HEIGHT 32 @@ -1324,7 +1323,7 @@ void nsbeos_throb(void *p) g->top_view->UnlockLooper(); - schedule(10, nsbeos_throb, p); + beos_schedule(100, nsbeos_throb, p); } @@ -2190,7 +2189,7 @@ void gui_window_start_throbber(struct gui_window* _g) nsbeos_window_update_back_forward(g); - schedule(10, nsbeos_throb, g); + beos_schedule(100, nsbeos_throb, g); } void gui_window_stop_throbber(struct gui_window* _g) @@ -2199,7 +2198,7 @@ void gui_window_stop_throbber(struct gui_window* _g) nsbeos_window_update_back_forward(g); - schedule_remove(nsbeos_throb, g); + beos_schedule(-1, nsbeos_throb, g); if (!g->top_view->LockLooper()) return; diff --git a/beos/schedule.cpp b/beos/schedule.cpp index db0992e63..75e349045 100644 --- a/beos/schedule.cpp +++ b/beos/schedule.cpp @@ -23,7 +23,7 @@ #include <List.h> extern "C" { -#include "utils/schedule.h" +#include "beos/schedule.h" #include "desktop/browser.h" #ifdef DEBUG_BEOS_SCHEDULE @@ -65,7 +65,7 @@ nsbeos_schedule_kill_callback(void *_target, void *_match) return false; } -void +static void schedule_remove(void (*callback)(void *p), void *p) { LOG(("schedule_remove() for %p(%p)", cb->callback, cb->context)); @@ -75,22 +75,26 @@ schedule_remove(void (*callback)(void *p), void *p) cb_match.callback = callback; cb_match.context = p; - callbacks->DoForEach(nsbeos_schedule_kill_callback, &cb_match); } -void -schedule(int t, void (*callback)(void *p), void *p) +nserror beos_schedule(int t, void (*callback)(void *p), void *p) { - LOG(("schedule(%d, %p, %p)", t, cb->callback, cb->context)); - if (callbacks == NULL) + LOG(("t:%d cb:%p p:%p", t, cb->callback, cb->context)); + + if (callbacks == NULL) { callbacks = new BList; + } - bigtime_t timeout = system_time() + t * 10 * 1000LL; - const int msec_timeout = t * 10; - _nsbeos_callback_t *cb = (_nsbeos_callback_t *)malloc(sizeof(_nsbeos_callback_t)); /* Kill any pending schedule of this kind. */ schedule_remove(callback, p); + + if (t < 0) { + return NSERROR_OK; + } + + bigtime_t timeout = system_time() + t * 1000LL; + _nsbeos_callback_t *cb = (_nsbeos_callback_t *)malloc(sizeof(_nsbeos_callback_t)); cb->callback = callback; cb->context = p; cb->callback_killed = cb->callback_fired = false; @@ -99,6 +103,8 @@ schedule(int t, void (*callback)(void *p), void *p) earliest_callback_timeout = timeout; } callbacks->AddItem(cb); + + return NSERROR_OK; } bool diff --git a/beos/schedule.h b/beos/schedule.h index 02205baf4..a44615616 100644 --- a/beos/schedule.h +++ b/beos/schedule.h @@ -19,8 +19,11 @@ #ifndef NETSURF_BEOS_CALLBACK_H #define NETSURF_BEOS_CALLBACK_H 1 -typedef void (*beos_callback)(void *p); - extern bigtime_t earliest_callback_timeout; +extern nserror beos_schedule(int t, void (*callback)(void *p), void *p); + +extern void schedule_run(void); + + #endif /* NETSURF_BEOS_CALLBACK_H */ |