netsurf: branch master updated. release/3.2-519-gb7b1bfe
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/b7b1bfe54865fd3e1d52f...
...commit http://git.netsurf-browser.org/netsurf.git/commit/b7b1bfe54865fd3e1d52f96...
...tree http://git.netsurf-browser.org/netsurf.git/tree/b7b1bfe54865fd3e1d52f96e6...
The branch, master has been updated
via b7b1bfe54865fd3e1d52f96e6f424961771a7eef (commit)
via c5a8620ef98c09cd7a62955b80edffbe2be38d88 (commit)
via 84261a8199b883dd562f3ba7301d432a59df7253 (commit)
via c4e37fb03dc416c42283215b6f227445cbe43ae9 (commit)
from e4437ad76b175e7ed19551e70ebae45d156a7154 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=b7b1bfe54865fd3e1d5...
commit b7b1bfe54865fd3e1d52f96e6f424961771a7eef
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Don't include browser_private.h
diff --git a/amiga/arexx.c b/amiga/arexx.c
index 35ce089..35cdfb0 100644
--- a/amiga/arexx.c
+++ b/amiga/arexx.c
@@ -28,7 +28,7 @@
#include <reaction/reaction_macros.h>
#include "utils/nsoption.h"
-#include "desktop/browser_private.h"
+#include "desktop/browser.h"
#include "desktop/gui_window.h"
#include "desktop/version.h"
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=c5a8620ef98c09cd7a6...
commit c5a8620ef98c09cd7a62955b80edffbe2be38d88
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Remove what seems a redundant check for bw->download.
diff --git a/amiga/arexx.c b/amiga/arexx.c
index bbb196a..35ce089 100644
--- a/amiga/arexx.c
+++ b/amiga/arexx.c
@@ -243,15 +243,13 @@ STATIC VOID rx_open(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unu
dln->node.ln_Name = strdup((char *)cmd->ac_ArgList[0]);
dln->node.ln_Type = NT_USER;
AddTail(&gw->dllist, (struct Node *)dln);
- if(!gw->bw->download) {
- browser_window_navigate(gw->bw,
- url,
- NULL,
- BW_NAVIGATE_DOWNLOAD,
- NULL,
- NULL,
- NULL);
- }
+ browser_window_navigate(gw->bw,
+ url,
+ NULL,
+ BW_NAVIGATE_DOWNLOAD,
+ NULL,
+ NULL,
+ NULL);
}
else if(cmd->ac_ArgList[2])
{
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=84261a8199b883dd562...
commit 84261a8199b883dd562f3ba7301d432a59df7253
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Use browser_window_get_url instead of poking inside bw at contents.
diff --git a/amiga/arexx.c b/amiga/arexx.c
index 70ad6c3..bbb196a 100644
--- a/amiga/arexx.c
+++ b/amiga/arexx.c
@@ -317,7 +317,7 @@ STATIC VOID rx_save(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unu
FWrite(fh, source_data, 1, source_size);
FClose(fh);
- SetComment((char *)cmd->ac_ArgList[0], nsurl_access(hlcache_handle_get_url(gw->bw->current_content)));
+ SetComment((char *)cmd->ac_ArgList[0], nsurl_access(browser_window_get_url(gw->bw)));
}
ami_reset_pointer(gw->shared);
@@ -344,9 +344,9 @@ STATIC VOID rx_geturl(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((u
if((cmd->ac_ArgList[0]) && (cmd->ac_ArgList[1]))
gw = ami_find_tab(*(ULONG *)cmd->ac_ArgList[0], *(ULONG *)cmd->ac_ArgList[1]);
- if(gw && gw->bw && gw->bw->current_content)
+ if(gw && gw->bw)
{
- strcpy(result, nsurl_access(hlcache_handle_get_url(gw->bw->current_content)));
+ strcpy(result, nsurl_access(browser_window_get_url(gw->bw)));
}
else
{
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=c4e37fb03dc416c4228...
commit c4e37fb03dc416c42283215b6f227445cbe43ae9
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Use API to get content from browser_window.
diff --git a/amiga/arexx.c b/amiga/arexx.c
index 02c18d7..70ad6c3 100644
--- a/amiga/arexx.c
+++ b/amiga/arexx.c
@@ -312,7 +312,8 @@ STATIC VOID rx_save(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unu
if((fh = FOpen((char *)cmd->ac_ArgList[0], MODE_NEWFILE, 0)))
{
- if((source_data = content_get_source_data(gw->bw->current_content, &source_size)))
+ hlcache_handle *h = browser_window_get_content(gw->bw);
+ if((source_data = content_get_source_data(h, &source_size)))
FWrite(fh, source_data, 1, source_size);
FClose(fh);
-----------------------------------------------------------------------
Summary of changes:
amiga/arexx.c | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)
diff --git a/amiga/arexx.c b/amiga/arexx.c
index 02c18d7..35cdfb0 100644
--- a/amiga/arexx.c
+++ b/amiga/arexx.c
@@ -28,7 +28,7 @@
#include <reaction/reaction_macros.h>
#include "utils/nsoption.h"
-#include "desktop/browser_private.h"
+#include "desktop/browser.h"
#include "desktop/gui_window.h"
#include "desktop/version.h"
@@ -243,15 +243,13 @@ STATIC VOID rx_open(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unu
dln->node.ln_Name = strdup((char *)cmd->ac_ArgList[0]);
dln->node.ln_Type = NT_USER;
AddTail(&gw->dllist, (struct Node *)dln);
- if(!gw->bw->download) {
- browser_window_navigate(gw->bw,
- url,
- NULL,
- BW_NAVIGATE_DOWNLOAD,
- NULL,
- NULL,
- NULL);
- }
+ browser_window_navigate(gw->bw,
+ url,
+ NULL,
+ BW_NAVIGATE_DOWNLOAD,
+ NULL,
+ NULL,
+ NULL);
}
else if(cmd->ac_ArgList[2])
{
@@ -312,11 +310,12 @@ STATIC VOID rx_save(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unu
if((fh = FOpen((char *)cmd->ac_ArgList[0], MODE_NEWFILE, 0)))
{
- if((source_data = content_get_source_data(gw->bw->current_content, &source_size)))
+ hlcache_handle *h = browser_window_get_content(gw->bw);
+ if((source_data = content_get_source_data(h, &source_size)))
FWrite(fh, source_data, 1, source_size);
FClose(fh);
- SetComment((char *)cmd->ac_ArgList[0], nsurl_access(hlcache_handle_get_url(gw->bw->current_content)));
+ SetComment((char *)cmd->ac_ArgList[0], nsurl_access(browser_window_get_url(gw->bw)));
}
ami_reset_pointer(gw->shared);
@@ -343,9 +342,9 @@ STATIC VOID rx_geturl(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((u
if((cmd->ac_ArgList[0]) && (cmd->ac_ArgList[1]))
gw = ami_find_tab(*(ULONG *)cmd->ac_ArgList[0], *(ULONG *)cmd->ac_ArgList[1]);
- if(gw && gw->bw && gw->bw->current_content)
+ if(gw && gw->bw)
{
- strcpy(result, nsurl_access(hlcache_handle_get_url(gw->bw->current_content)));
+ strcpy(result, nsurl_access(browser_window_get_url(gw->bw)));
}
else
{
--
NetSurf Browser
8 years, 5 months
netsurf: branch master updated. release/3.2-515-ge4437ad
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/e4437ad76b175e7ed1955...
...commit http://git.netsurf-browser.org/netsurf.git/commit/e4437ad76b175e7ed19551e...
...tree http://git.netsurf-browser.org/netsurf.git/tree/e4437ad76b175e7ed19551e70...
The branch, master has been updated
via e4437ad76b175e7ed19551e70ebae45d156a7154 (commit)
from 5bf4b3ff2bf0c60faf7b98235eb34f51e98b843f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=e4437ad76b175e7ed19...
commit e4437ad76b175e7ed19551e70ebae45d156a7154
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Store scale in gui_window. Remove a lot of bw dereferencing for scale.
diff --git a/amiga/gui.c b/amiga/gui.c
index 6146c6e..a7595ad 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -1246,8 +1246,8 @@ static bool ami_spacebox_to_ns_coords(struct gui_window_2 *gwin, int *x, int *y,
int ns_x = space_x;
int ns_y = space_y;
- ns_x /= gwin->gw->bw->scale;
- ns_y /= gwin->gw->bw->scale;
+ ns_x /= gwin->gw->scale;
+ ns_y /= gwin->gw->scale;
ns_x += gwin->gw->scrollx;
ns_y += gwin->gw->scrolly;
@@ -1367,11 +1367,11 @@ static struct IBox *ami_ns_rect_to_ibox(struct gui_window_2 *gwin, const struct
return NULL;
}
- ibox->Left = gwin->win->MouseX + (rect->x0 * gwin->gw->bw->scale);
- ibox->Top = gwin->win->MouseY + (rect->y0 * gwin->gw->bw->scale);
+ ibox->Left = gwin->win->MouseX + (rect->x0 * gwin->gw->scale);
+ ibox->Top = gwin->win->MouseY + (rect->y0 * gwin->gw->scale);
- ibox->Width = (rect->x1 - rect->x0) * gwin->gw->bw->scale;
- ibox->Height = (rect->y1 - rect->y0) * gwin->gw->bw->scale;
+ ibox->Width = (rect->x1 - rect->x0) * gwin->gw->scale;
+ ibox->Height = (rect->y1 - rect->y0) * gwin->gw->scale;
if(ibox->Left < bbox->Left) ibox->Left = bbox->Left;
if(ibox->Top < bbox->Top) ibox->Top = bbox->Top;
@@ -1447,8 +1447,8 @@ static void gui_window_get_dimensions(struct gui_window *g, int *width, int *hei
if(scaled)
{
- *width /= g->bw->scale;
- *height /= g->bw->scale;
+ *width /= g->scale;
+ *height /= g->scale;
}
}
@@ -1797,8 +1797,8 @@ static void ami_handle_msg(void)
break;
}
- x = (ULONG)((gwin->win->MouseX - bbox->Left) / gwin->gw->bw->scale);
- y = (ULONG)((gwin->win->MouseY - bbox->Top) / gwin->gw->bw->scale);
+ x = (ULONG)((gwin->win->MouseX - bbox->Left) / gwin->gw->scale);
+ y = (ULONG)((gwin->win->MouseY - bbox->Top) / gwin->gw->scale);
ami_get_hscroll_pos(gwin, (ULONG *)&xs);
ami_get_vscroll_pos(gwin, (ULONG *)&ys);
@@ -1865,8 +1865,8 @@ static void ami_handle_msg(void)
return;
}
- x = (ULONG)((gwin->win->MouseX - bbox->Left) / gwin->gw->bw->scale);
- y = (ULONG)((gwin->win->MouseY - bbox->Top) / gwin->gw->bw->scale);
+ x = (ULONG)((gwin->win->MouseX - bbox->Left) / gwin->gw->scale);
+ y = (ULONG)((gwin->win->MouseY - bbox->Top) / gwin->gw->scale);
ami_get_hscroll_pos(gwin, (ULONG *)&xs);
ami_get_vscroll_pos(gwin, (ULONG *)&ys);
@@ -2287,18 +2287,16 @@ static void ami_handle_msg(void)
break;
case '-':
- if(browser_window_get_scale(gwin->gw->bw) > 0.1)
- browser_window_set_scale(gwin->gw->bw,
- browser_window_get_scale(gwin->gw->bw) - 0.1, false);
+ if(gwin->gw->scale > 0.1)
+ ami_gui_set_scale(gwin->gw, gwin->gw->scale - 0.1);
break;
case '=':
- browser_window_set_scale(gwin->gw->bw, 1.0, false);
+ ami_gui_set_scale(gwin->gw, 1.0);
break;
case '+':
- browser_window_set_scale(gwin->gw->bw,
- browser_window_get_scale(gwin->gw->bw) + 0.1, false);
+ ami_gui_set_scale(gwin->gw, gwin->gw->scale + 0.1);
break;
/* The following aren't available from the menu at the moment */
@@ -3357,6 +3355,18 @@ int ami_gui_count_windows(int window, int *tabs)
return windows;
}
+/**
+ * Set the scale of a gui window
+ *
+ * \param gw gui_window to set scale for
+ * \param scale scale to set
+ */
+void ami_gui_set_scale(struct gui_window *gw, float scale)
+{
+ gw->scale = scale;
+ browser_window_set_scale(gw->bw, scale, true);
+}
+
nserror ami_gui_new_blank_tab(struct gui_window_2 *gwin)
{
nsurl *url;
@@ -3406,7 +3416,7 @@ gui_window_create(struct browser_window *bw,
if (nsoption_bool(kiosk_mode)) flags &= ~GW_CREATE_TAB;
if (nsoption_bool(resize_with_contents)) idcmp_sizeverify = 0;
- bw->scale = 1.0;
+ g->scale = browser_window_get_scale(bw);
/* Offset the new window by titlebar + 1 as per AmigaOS style guide.
* If we don't have a clone window we offset by all windows open. */
@@ -4230,8 +4240,8 @@ static void ami_do_redraw_tiled(struct gui_window_2 *gwin, bool busy,
{
int x, y;
struct rect clip;
- int tile_x_scale = (int)(nsoption_int(redraw_tile_size_x) / gwin->gw->bw->scale);
- int tile_y_scale = (int)(nsoption_int(redraw_tile_size_y) / gwin->gw->bw->scale);
+ int tile_x_scale = (int)(nsoption_int(redraw_tile_size_x) / gwin->gw->scale);
+ int tile_y_scale = (int)(nsoption_int(redraw_tile_size_y) / gwin->gw->scale);
browserglob.shared_pens = &gwin->shared_pens;
@@ -4269,15 +4279,15 @@ static void ami_do_redraw_tiled(struct gui_window_2 *gwin, bool busy,
clip.y0 = 0;
clip.y1 = nsoption_int(redraw_tile_size_y);
if(clip.y1 > height) clip.y1 = height;
- if((((y - sy) * gwin->gw->bw->scale) + clip.y1) > bbox->Height)
- clip.y1 = bbox->Height - ((y - sy) * gwin->gw->bw->scale);
+ if((((y - sy) * gwin->gw->scale) + clip.y1) > bbox->Height)
+ clip.y1 = bbox->Height - ((y - sy) * gwin->gw->scale);
for(x = left; x < (left + width); x += tile_x_scale) {
clip.x0 = 0;
clip.x1 = nsoption_int(redraw_tile_size_x);
if(clip.x1 > width) clip.x1 = width;
- if((((x - sx) * gwin->gw->bw->scale) + clip.x1) > bbox->Width)
- clip.x1 = bbox->Width - ((x - sx) * gwin->gw->bw->scale);
+ if((((x - sx) * gwin->gw->scale) + clip.x1) > bbox->Width)
+ clip.x1 = bbox->Width - ((x - sx) * gwin->gw->scale);
if(browser_window_redraw(gwin->gw->bw,
clip.x0 - (int)x,
@@ -4292,8 +4302,8 @@ static void ami_do_redraw_tiled(struct gui_window_2 *gwin, bool busy,
BLITA_SrcY, 0,
BLITA_DestType, BLITT_RASTPORT,
BLITA_Dest, gwin->win->RPort,
- BLITA_DestX, bbox->Left + (int)((x - sx) * gwin->gw->bw->scale),
- BLITA_DestY, bbox->Top + (int)((y - sy) * gwin->gw->bw->scale),
+ BLITA_DestX, bbox->Left + (int)((x - sx) * gwin->gw->scale),
+ BLITA_DestY, bbox->Top + (int)((y - sy) * gwin->gw->scale),
BLITA_Width, (int)(clip.x1),
BLITA_Height, (int)(clip.y1),
TAG_DONE);
@@ -4348,7 +4358,7 @@ static void ami_do_redraw_limits(struct gui_window *g, struct browser_window *bw
}
ami_do_redraw_tiled(g->shared, busy, x0, y0,
- (x1 - x0) * bw->scale, (y1 - y0) * bw->scale, sx, sy, bbox, &ctx);
+ (x1 - x0) * g->scale, (y1 - y0) * g->scale, sx, sy, bbox, &ctx);
ami_gui_free_space_box(bbox);
@@ -4499,7 +4509,7 @@ static void ami_do_redraw(struct gui_window_2 *gwin)
gwin->redraw_scroll = false;
if(gwin->new_content) gwin->redraw_scroll = false;
-// if(gwin->gw->bw->scale != 1.0) gwin->redraw_scroll = false;
+// if(gwin->gw->scale != 1.0) gwin->redraw_scroll = false;
}
if(gwin->redraw_scroll)
@@ -4655,7 +4665,7 @@ void ami_get_hscroll_pos(struct gui_window_2 *gwin, ULONG *xs)
*xs = 0;
}
- *xs /= gwin->gw->bw->scale;
+ *xs /= gwin->gw->scale;
}
void ami_get_vscroll_pos(struct gui_window_2 *gwin, ULONG *ys)
@@ -4666,7 +4676,7 @@ void ami_get_vscroll_pos(struct gui_window_2 *gwin, ULONG *ys)
*ys = 0;
}
- *ys /= gwin->gw->bw->scale;
+ *ys /= gwin->gw->scale;
}
static bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
@@ -4712,7 +4722,7 @@ static void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
if(g->shared->objects[GID_VSCROLL]) {
RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[GID_VSCROLL],
g->shared->win, NULL,
- SCROLLER_Top, (ULONG)(sy * g->bw->scale),
+ SCROLLER_Top, (ULONG)(sy * g->scale),
TAG_DONE);
}
@@ -4720,7 +4730,7 @@ static void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
{
RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[GID_HSCROLL],
g->shared->win, NULL,
- SCROLLER_Top, (ULONG)(sx * g->bw->scale),
+ SCROLLER_Top, (ULONG)(sx * g->scale),
TAG_DONE);
}
@@ -4757,7 +4767,7 @@ static void gui_window_update_extent(struct gui_window *g)
if(g->shared->objects[GID_VSCROLL]) {
RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[GID_VSCROLL],g->shared->win,NULL,
- SCROLLER_Total, (ULONG)(content_get_height(g->bw->current_content) * g->bw->scale),
+ SCROLLER_Total, (ULONG)(content_get_height(g->bw->current_content) * g->scale),
SCROLLER_Visible, bbox->Height,
TAG_DONE);
}
@@ -4766,7 +4776,7 @@ static void gui_window_update_extent(struct gui_window *g)
{
RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[GID_HSCROLL],
g->shared->win, NULL,
- SCROLLER_Total, (ULONG)(content_get_width(g->bw->current_content) * g->bw->scale),
+ SCROLLER_Total, (ULONG)(content_get_width(g->bw->current_content) * g->scale),
SCROLLER_Visible, bbox->Width,
TAG_DONE);
}
diff --git a/amiga/gui.h b/amiga/gui.h
index af2d659..200ec42 100755
--- a/amiga/gui.h
+++ b/amiga/gui.h
@@ -152,6 +152,7 @@ struct gui_window
char *tabtitle;
struct MinList *deferred_rects;
struct browser_window *bw;
+ float scale;
};
void ami_get_msg(void);
@@ -171,6 +172,7 @@ void ami_gui_update_hotlist_button(struct gui_window_2 *gwin);
nserror ami_gui_new_blank_tab(struct gui_window_2 *gwin);
char *ami_gui_get_cache_favicon_name(nsurl *url, bool only_if_avail);
int ami_gui_count_windows(int window, int *tabs);
+void ami_gui_set_scale(struct gui_window *gw, float scale);
/**
* Compatibility function to get space.gadget render area.
diff --git a/amiga/menu.c b/amiga/menu.c
index 6ba233a..3eb8a98 100644
--- a/amiga/menu.c
+++ b/amiga/menu.c
@@ -1017,8 +1017,8 @@ static void ami_menu_item_browser_scale_decrease(struct Hook *hook, APTR window,
struct gui_window_2 *gwin;
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
- if(browser_window_get_scale(gwin->gw->bw) > 0.1)
- browser_window_set_scale(gwin->gw->bw, browser_window_get_scale(gwin->gw->bw) - 0.1, false);
+ if(gwin->gw->scale > 0.1)
+ ami_gui_set_scale(gwin->gw, gwin->gw->scale - 0.1);
}
static void ami_menu_item_browser_scale_normal(struct Hook *hook, APTR window, struct IntuiMessage *msg)
@@ -1026,7 +1026,7 @@ static void ami_menu_item_browser_scale_normal(struct Hook *hook, APTR window, s
struct gui_window_2 *gwin;
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
- browser_window_set_scale(gwin->gw->bw, 1.0, false);
+ ami_gui_set_scale(gwin->gw, 1.0);
}
static void ami_menu_item_browser_scale_increase(struct Hook *hook, APTR window, struct IntuiMessage *msg)
@@ -1034,7 +1034,7 @@ static void ami_menu_item_browser_scale_increase(struct Hook *hook, APTR window,
struct gui_window_2 *gwin;
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
- browser_window_set_scale(gwin->gw->bw, browser_window_get_scale(gwin->gw->bw) + 0.1, false);
+ ami_gui_set_scale(gwin->gw, gwin->gw->scale + 0.1);
}
static void ami_menu_item_browser_redraw(struct Hook *hook, APTR window, struct IntuiMessage *msg)
-----------------------------------------------------------------------
Summary of changes:
amiga/gui.c | 80 +++++++++++++++++++++++++++++++++-------------------------
amiga/gui.h | 2 ++
amiga/menu.c | 8 +++---
3 files changed, 51 insertions(+), 39 deletions(-)
diff --git a/amiga/gui.c b/amiga/gui.c
index 6146c6e..a7595ad 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -1246,8 +1246,8 @@ static bool ami_spacebox_to_ns_coords(struct gui_window_2 *gwin, int *x, int *y,
int ns_x = space_x;
int ns_y = space_y;
- ns_x /= gwin->gw->bw->scale;
- ns_y /= gwin->gw->bw->scale;
+ ns_x /= gwin->gw->scale;
+ ns_y /= gwin->gw->scale;
ns_x += gwin->gw->scrollx;
ns_y += gwin->gw->scrolly;
@@ -1367,11 +1367,11 @@ static struct IBox *ami_ns_rect_to_ibox(struct gui_window_2 *gwin, const struct
return NULL;
}
- ibox->Left = gwin->win->MouseX + (rect->x0 * gwin->gw->bw->scale);
- ibox->Top = gwin->win->MouseY + (rect->y0 * gwin->gw->bw->scale);
+ ibox->Left = gwin->win->MouseX + (rect->x0 * gwin->gw->scale);
+ ibox->Top = gwin->win->MouseY + (rect->y0 * gwin->gw->scale);
- ibox->Width = (rect->x1 - rect->x0) * gwin->gw->bw->scale;
- ibox->Height = (rect->y1 - rect->y0) * gwin->gw->bw->scale;
+ ibox->Width = (rect->x1 - rect->x0) * gwin->gw->scale;
+ ibox->Height = (rect->y1 - rect->y0) * gwin->gw->scale;
if(ibox->Left < bbox->Left) ibox->Left = bbox->Left;
if(ibox->Top < bbox->Top) ibox->Top = bbox->Top;
@@ -1447,8 +1447,8 @@ static void gui_window_get_dimensions(struct gui_window *g, int *width, int *hei
if(scaled)
{
- *width /= g->bw->scale;
- *height /= g->bw->scale;
+ *width /= g->scale;
+ *height /= g->scale;
}
}
@@ -1797,8 +1797,8 @@ static void ami_handle_msg(void)
break;
}
- x = (ULONG)((gwin->win->MouseX - bbox->Left) / gwin->gw->bw->scale);
- y = (ULONG)((gwin->win->MouseY - bbox->Top) / gwin->gw->bw->scale);
+ x = (ULONG)((gwin->win->MouseX - bbox->Left) / gwin->gw->scale);
+ y = (ULONG)((gwin->win->MouseY - bbox->Top) / gwin->gw->scale);
ami_get_hscroll_pos(gwin, (ULONG *)&xs);
ami_get_vscroll_pos(gwin, (ULONG *)&ys);
@@ -1865,8 +1865,8 @@ static void ami_handle_msg(void)
return;
}
- x = (ULONG)((gwin->win->MouseX - bbox->Left) / gwin->gw->bw->scale);
- y = (ULONG)((gwin->win->MouseY - bbox->Top) / gwin->gw->bw->scale);
+ x = (ULONG)((gwin->win->MouseX - bbox->Left) / gwin->gw->scale);
+ y = (ULONG)((gwin->win->MouseY - bbox->Top) / gwin->gw->scale);
ami_get_hscroll_pos(gwin, (ULONG *)&xs);
ami_get_vscroll_pos(gwin, (ULONG *)&ys);
@@ -2287,18 +2287,16 @@ static void ami_handle_msg(void)
break;
case '-':
- if(browser_window_get_scale(gwin->gw->bw) > 0.1)
- browser_window_set_scale(gwin->gw->bw,
- browser_window_get_scale(gwin->gw->bw) - 0.1, false);
+ if(gwin->gw->scale > 0.1)
+ ami_gui_set_scale(gwin->gw, gwin->gw->scale - 0.1);
break;
case '=':
- browser_window_set_scale(gwin->gw->bw, 1.0, false);
+ ami_gui_set_scale(gwin->gw, 1.0);
break;
case '+':
- browser_window_set_scale(gwin->gw->bw,
- browser_window_get_scale(gwin->gw->bw) + 0.1, false);
+ ami_gui_set_scale(gwin->gw, gwin->gw->scale + 0.1);
break;
/* The following aren't available from the menu at the moment */
@@ -3357,6 +3355,18 @@ int ami_gui_count_windows(int window, int *tabs)
return windows;
}
+/**
+ * Set the scale of a gui window
+ *
+ * \param gw gui_window to set scale for
+ * \param scale scale to set
+ */
+void ami_gui_set_scale(struct gui_window *gw, float scale)
+{
+ gw->scale = scale;
+ browser_window_set_scale(gw->bw, scale, true);
+}
+
nserror ami_gui_new_blank_tab(struct gui_window_2 *gwin)
{
nsurl *url;
@@ -3406,7 +3416,7 @@ gui_window_create(struct browser_window *bw,
if (nsoption_bool(kiosk_mode)) flags &= ~GW_CREATE_TAB;
if (nsoption_bool(resize_with_contents)) idcmp_sizeverify = 0;
- bw->scale = 1.0;
+ g->scale = browser_window_get_scale(bw);
/* Offset the new window by titlebar + 1 as per AmigaOS style guide.
* If we don't have a clone window we offset by all windows open. */
@@ -4230,8 +4240,8 @@ static void ami_do_redraw_tiled(struct gui_window_2 *gwin, bool busy,
{
int x, y;
struct rect clip;
- int tile_x_scale = (int)(nsoption_int(redraw_tile_size_x) / gwin->gw->bw->scale);
- int tile_y_scale = (int)(nsoption_int(redraw_tile_size_y) / gwin->gw->bw->scale);
+ int tile_x_scale = (int)(nsoption_int(redraw_tile_size_x) / gwin->gw->scale);
+ int tile_y_scale = (int)(nsoption_int(redraw_tile_size_y) / gwin->gw->scale);
browserglob.shared_pens = &gwin->shared_pens;
@@ -4269,15 +4279,15 @@ static void ami_do_redraw_tiled(struct gui_window_2 *gwin, bool busy,
clip.y0 = 0;
clip.y1 = nsoption_int(redraw_tile_size_y);
if(clip.y1 > height) clip.y1 = height;
- if((((y - sy) * gwin->gw->bw->scale) + clip.y1) > bbox->Height)
- clip.y1 = bbox->Height - ((y - sy) * gwin->gw->bw->scale);
+ if((((y - sy) * gwin->gw->scale) + clip.y1) > bbox->Height)
+ clip.y1 = bbox->Height - ((y - sy) * gwin->gw->scale);
for(x = left; x < (left + width); x += tile_x_scale) {
clip.x0 = 0;
clip.x1 = nsoption_int(redraw_tile_size_x);
if(clip.x1 > width) clip.x1 = width;
- if((((x - sx) * gwin->gw->bw->scale) + clip.x1) > bbox->Width)
- clip.x1 = bbox->Width - ((x - sx) * gwin->gw->bw->scale);
+ if((((x - sx) * gwin->gw->scale) + clip.x1) > bbox->Width)
+ clip.x1 = bbox->Width - ((x - sx) * gwin->gw->scale);
if(browser_window_redraw(gwin->gw->bw,
clip.x0 - (int)x,
@@ -4292,8 +4302,8 @@ static void ami_do_redraw_tiled(struct gui_window_2 *gwin, bool busy,
BLITA_SrcY, 0,
BLITA_DestType, BLITT_RASTPORT,
BLITA_Dest, gwin->win->RPort,
- BLITA_DestX, bbox->Left + (int)((x - sx) * gwin->gw->bw->scale),
- BLITA_DestY, bbox->Top + (int)((y - sy) * gwin->gw->bw->scale),
+ BLITA_DestX, bbox->Left + (int)((x - sx) * gwin->gw->scale),
+ BLITA_DestY, bbox->Top + (int)((y - sy) * gwin->gw->scale),
BLITA_Width, (int)(clip.x1),
BLITA_Height, (int)(clip.y1),
TAG_DONE);
@@ -4348,7 +4358,7 @@ static void ami_do_redraw_limits(struct gui_window *g, struct browser_window *bw
}
ami_do_redraw_tiled(g->shared, busy, x0, y0,
- (x1 - x0) * bw->scale, (y1 - y0) * bw->scale, sx, sy, bbox, &ctx);
+ (x1 - x0) * g->scale, (y1 - y0) * g->scale, sx, sy, bbox, &ctx);
ami_gui_free_space_box(bbox);
@@ -4499,7 +4509,7 @@ static void ami_do_redraw(struct gui_window_2 *gwin)
gwin->redraw_scroll = false;
if(gwin->new_content) gwin->redraw_scroll = false;
-// if(gwin->gw->bw->scale != 1.0) gwin->redraw_scroll = false;
+// if(gwin->gw->scale != 1.0) gwin->redraw_scroll = false;
}
if(gwin->redraw_scroll)
@@ -4655,7 +4665,7 @@ void ami_get_hscroll_pos(struct gui_window_2 *gwin, ULONG *xs)
*xs = 0;
}
- *xs /= gwin->gw->bw->scale;
+ *xs /= gwin->gw->scale;
}
void ami_get_vscroll_pos(struct gui_window_2 *gwin, ULONG *ys)
@@ -4666,7 +4676,7 @@ void ami_get_vscroll_pos(struct gui_window_2 *gwin, ULONG *ys)
*ys = 0;
}
- *ys /= gwin->gw->bw->scale;
+ *ys /= gwin->gw->scale;
}
static bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
@@ -4712,7 +4722,7 @@ static void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
if(g->shared->objects[GID_VSCROLL]) {
RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[GID_VSCROLL],
g->shared->win, NULL,
- SCROLLER_Top, (ULONG)(sy * g->bw->scale),
+ SCROLLER_Top, (ULONG)(sy * g->scale),
TAG_DONE);
}
@@ -4720,7 +4730,7 @@ static void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
{
RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[GID_HSCROLL],
g->shared->win, NULL,
- SCROLLER_Top, (ULONG)(sx * g->bw->scale),
+ SCROLLER_Top, (ULONG)(sx * g->scale),
TAG_DONE);
}
@@ -4757,7 +4767,7 @@ static void gui_window_update_extent(struct gui_window *g)
if(g->shared->objects[GID_VSCROLL]) {
RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[GID_VSCROLL],g->shared->win,NULL,
- SCROLLER_Total, (ULONG)(content_get_height(g->bw->current_content) * g->bw->scale),
+ SCROLLER_Total, (ULONG)(content_get_height(g->bw->current_content) * g->scale),
SCROLLER_Visible, bbox->Height,
TAG_DONE);
}
@@ -4766,7 +4776,7 @@ static void gui_window_update_extent(struct gui_window *g)
{
RefreshSetGadgetAttrs((struct Gadget *)(APTR)g->shared->objects[GID_HSCROLL],
g->shared->win, NULL,
- SCROLLER_Total, (ULONG)(content_get_width(g->bw->current_content) * g->bw->scale),
+ SCROLLER_Total, (ULONG)(content_get_width(g->bw->current_content) * g->scale),
SCROLLER_Visible, bbox->Width,
TAG_DONE);
}
diff --git a/amiga/gui.h b/amiga/gui.h
index af2d659..200ec42 100755
--- a/amiga/gui.h
+++ b/amiga/gui.h
@@ -152,6 +152,7 @@ struct gui_window
char *tabtitle;
struct MinList *deferred_rects;
struct browser_window *bw;
+ float scale;
};
void ami_get_msg(void);
@@ -171,6 +172,7 @@ void ami_gui_update_hotlist_button(struct gui_window_2 *gwin);
nserror ami_gui_new_blank_tab(struct gui_window_2 *gwin);
char *ami_gui_get_cache_favicon_name(nsurl *url, bool only_if_avail);
int ami_gui_count_windows(int window, int *tabs);
+void ami_gui_set_scale(struct gui_window *gw, float scale);
/**
* Compatibility function to get space.gadget render area.
diff --git a/amiga/menu.c b/amiga/menu.c
index 6ba233a..3eb8a98 100644
--- a/amiga/menu.c
+++ b/amiga/menu.c
@@ -1017,8 +1017,8 @@ static void ami_menu_item_browser_scale_decrease(struct Hook *hook, APTR window,
struct gui_window_2 *gwin;
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
- if(browser_window_get_scale(gwin->gw->bw) > 0.1)
- browser_window_set_scale(gwin->gw->bw, browser_window_get_scale(gwin->gw->bw) - 0.1, false);
+ if(gwin->gw->scale > 0.1)
+ ami_gui_set_scale(gwin->gw, gwin->gw->scale - 0.1);
}
static void ami_menu_item_browser_scale_normal(struct Hook *hook, APTR window, struct IntuiMessage *msg)
@@ -1026,7 +1026,7 @@ static void ami_menu_item_browser_scale_normal(struct Hook *hook, APTR window, s
struct gui_window_2 *gwin;
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
- browser_window_set_scale(gwin->gw->bw, 1.0, false);
+ ami_gui_set_scale(gwin->gw, 1.0);
}
static void ami_menu_item_browser_scale_increase(struct Hook *hook, APTR window, struct IntuiMessage *msg)
@@ -1034,7 +1034,7 @@ static void ami_menu_item_browser_scale_increase(struct Hook *hook, APTR window,
struct gui_window_2 *gwin;
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
- browser_window_set_scale(gwin->gw->bw, browser_window_get_scale(gwin->gw->bw) + 0.1, false);
+ ami_gui_set_scale(gwin->gw, gwin->gw->scale + 0.1);
}
static void ami_menu_item_browser_redraw(struct Hook *hook, APTR window, struct IntuiMessage *msg)
--
NetSurf Browser
8 years, 5 months
netsurf: branch master updated. release/3.2-514-g5bf4b3f
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/5bf4b3ff2bf0c60faf7b9...
...commit http://git.netsurf-browser.org/netsurf.git/commit/5bf4b3ff2bf0c60faf7b982...
...tree http://git.netsurf-browser.org/netsurf.git/tree/5bf4b3ff2bf0c60faf7b98235...
The branch, master has been updated
via 5bf4b3ff2bf0c60faf7b98235eb34f51e98b843f (commit)
from 0f6f0a01698dd8c68e377718cc99ba9327da0b81 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=5bf4b3ff2bf0c60faf7...
commit 5bf4b3ff2bf0c60faf7b98235eb34f51e98b843f
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
move the low bandwidth check to allow for an average over a much longer time
diff --git a/content/llcache.c b/content/llcache.c
index f60523d..6a0c096 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -31,8 +31,6 @@
*
* \todo Improve writeout bandwidth limiting.
*
- * \todo Implement minimum writeout bandwidth limit.
- *
*/
#include <stdlib.h>
@@ -228,28 +226,47 @@ struct llcache_s {
/** The target upper bound for the RAM cache size */
uint32_t limit;
- /** The minimum lifetime to consider sending objects to
- * backing store.
+ /** Whether or not our users are caught up */
+ bool all_caught_up;
+
+
+ /* backing store elements */
+
+
+ /**
+ * The minimum lifetime to consider sending objects to backing
+ * store.
*/
int minimum_lifetime;
- /** The time over which to apply the bandwidth calculations in ms */
+ /**
+ * The time over which to apply the bandwidth calculations in ms
+ */
unsigned long time_quantum;
- /** The minimum bandwidth to allow the backing store to use in
+ /**
+ * The minimum bandwidth to allow the backing store to use in
* bytes/second. Below this the backing store will be
* disabled.
*/
size_t minimum_bandwidth;
- /** The maximum bandwidth to allow the backing store to
- * use in bytes/second
+ /**
+ * The maximum bandwidth to allow the backing store to use in
+ * bytes/second
*/
size_t maximum_bandwidth;
+ /**
+ * Total number of bytes written to backing store.
+ */
+ uint64_t total_written;
+
+ /**
+ * Total nuber of miliseconds taken to write to backing store.
+ */
+ uint64_t total_elapsed;
- /** Whether or not our users are caught up */
- bool all_caught_up;
};
/** low level cache state */
@@ -257,6 +274,7 @@ static struct llcache_s *llcache = NULL;
/* forward referenced callback function */
static void llcache_fetch_callback(const fetch_msg *msg, void *p);
+
/* forward referenced catch up function */
static void llcache_users_not_caught_up(void);
@@ -266,11 +284,11 @@ static void llcache_users_not_caught_up(void);
******************************************************************************/
/**
- * Create a new object user
+ * Create a new object user.
*
- * \param cb Callback routine
- * \param pw Private data for callback
- * \param user Pointer to location to receive result
+ * \param cb Callback routine.
+ * \param pw Private data for callback.
+ * \param user Pointer to location to receive result.
* \return NSERROR_OK on success, appropriate error otherwise
*/
static nserror llcache_object_user_new(llcache_handle_callback cb, void *pw,
@@ -2379,6 +2397,26 @@ write_backing_store(struct llcache_object *object,
}
/**
+ * Check for overall write performance.
+ *
+ * If the overall write bandwidth has fallen below a useful level for
+ * the backing store to be effective disable it.
+ *
+ * \param p The context pointer passed to the callback.
+ */
+static void llcache_persist_slowcheck(void *p)
+{
+ unsigned long total_bandwidth; /* total bandwidth */
+ total_bandwidth = (llcache->total_written * 1000) / llcache->total_elapsed;
+
+ if (total_bandwidth < llcache->minimum_bandwidth) {
+ LOG(("Cannot write minimum bandwidth"));
+ warn_user("LowDiscWriteBandwidth", 0);
+ guit->llcache->finalise();
+ }
+}
+
+/**
* Possibly write objects data to backing store.
*
* \param p The context pointer passed to the callback.
@@ -2402,7 +2440,7 @@ static void llcache_persist(void *p)
ret = build_candidate_list(&lst, &lst_count);
if (ret != NSERROR_OK) {
- LOG(("Unable to construct candidate list for persisatnt writeout"));
+ LLCACHE_LOG(("Unable to construct candidate list for persisatnt writeout"));
return;
}
@@ -2419,7 +2457,8 @@ static void llcache_persist(void *p)
total_written += written;
total_elapsed += elapsed;
total_bandwidth = (total_written * 1000) / total_elapsed;
- LOG(("Wrote %d bytes in %dms bw:%d %s",
+
+ LLCACHE_LOG(("Wrote %d bytes in %dms bw:%d %s",
written, elapsed, (written * 1000) / elapsed,
nsurl_access(lst[idx]->url) ));
@@ -2433,9 +2472,13 @@ static void llcache_persist(void *p)
* object was very large.
*/
if (total_bandwidth < llcache->minimum_bandwidth) {
- LOG(("Cannot write minimum bandwidth"));
- warn_user("LowDiscWriteBandwidth", 0);
- guit->llcache->finalise();
+ /* Writeout was slow in this time quantum.
+ * Schedule a check in the future to see if
+ * overall performance is too slow to be useful.
+ */
+ guit->browser->schedule(llcache->time_quantum * 100,
+ llcache_persist_slowcheck,
+ NULL);
break;
} else {
if (total_bandwidth > llcache->maximum_bandwidth) {
@@ -2478,10 +2521,13 @@ static void llcache_persist(void *p)
}
}
- LOG(("writeout size:%d time:%d bandwidth:%dbytes/s",
+ llcache->total_written += total_written;
+ llcache->total_elapsed += total_elapsed;
+
+ LLCACHE_LOG(("writeout size:%d time:%d bandwidth:%dbytes/s",
total_written, total_elapsed, total_bandwidth));
- LOG(("Rescheduling writeout in %dms", next));
+ LLCACHE_LOG(("Rescheduling writeout in %dms", next));
guit->browser->schedule(next, llcache_persist, NULL);
}
@@ -3225,7 +3271,9 @@ llcache_initialise(const struct llcache_parameters *prm)
void llcache_finalise(void)
{
llcache_object *object, *next;
+ unsigned long total_bandwidth; /* total bandwidth */
+ total_bandwidth = (llcache->total_written * 1000) / llcache->total_elapsed;
/* Clean uncached objects */
for (object = llcache->uncached_objects; object != NULL; object = next) {
llcache_object_user *user, *next_user;
@@ -3271,6 +3319,9 @@ void llcache_finalise(void)
/* backing store finalisation */
guit->llcache->finalise();
+ LOG(("Backing store average bandwidth %lu bytes/second",
+ total_bandwidth));
+
free(llcache);
llcache = NULL;
}
-----------------------------------------------------------------------
Summary of changes:
content/llcache.c | 93 +++++++++++++++++++++++++++++++++++++++++------------
1 file changed, 72 insertions(+), 21 deletions(-)
diff --git a/content/llcache.c b/content/llcache.c
index f60523d..6a0c096 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -31,8 +31,6 @@
*
* \todo Improve writeout bandwidth limiting.
*
- * \todo Implement minimum writeout bandwidth limit.
- *
*/
#include <stdlib.h>
@@ -228,28 +226,47 @@ struct llcache_s {
/** The target upper bound for the RAM cache size */
uint32_t limit;
- /** The minimum lifetime to consider sending objects to
- * backing store.
+ /** Whether or not our users are caught up */
+ bool all_caught_up;
+
+
+ /* backing store elements */
+
+
+ /**
+ * The minimum lifetime to consider sending objects to backing
+ * store.
*/
int minimum_lifetime;
- /** The time over which to apply the bandwidth calculations in ms */
+ /**
+ * The time over which to apply the bandwidth calculations in ms
+ */
unsigned long time_quantum;
- /** The minimum bandwidth to allow the backing store to use in
+ /**
+ * The minimum bandwidth to allow the backing store to use in
* bytes/second. Below this the backing store will be
* disabled.
*/
size_t minimum_bandwidth;
- /** The maximum bandwidth to allow the backing store to
- * use in bytes/second
+ /**
+ * The maximum bandwidth to allow the backing store to use in
+ * bytes/second
*/
size_t maximum_bandwidth;
+ /**
+ * Total number of bytes written to backing store.
+ */
+ uint64_t total_written;
+
+ /**
+ * Total nuber of miliseconds taken to write to backing store.
+ */
+ uint64_t total_elapsed;
- /** Whether or not our users are caught up */
- bool all_caught_up;
};
/** low level cache state */
@@ -257,6 +274,7 @@ static struct llcache_s *llcache = NULL;
/* forward referenced callback function */
static void llcache_fetch_callback(const fetch_msg *msg, void *p);
+
/* forward referenced catch up function */
static void llcache_users_not_caught_up(void);
@@ -266,11 +284,11 @@ static void llcache_users_not_caught_up(void);
******************************************************************************/
/**
- * Create a new object user
+ * Create a new object user.
*
- * \param cb Callback routine
- * \param pw Private data for callback
- * \param user Pointer to location to receive result
+ * \param cb Callback routine.
+ * \param pw Private data for callback.
+ * \param user Pointer to location to receive result.
* \return NSERROR_OK on success, appropriate error otherwise
*/
static nserror llcache_object_user_new(llcache_handle_callback cb, void *pw,
@@ -2379,6 +2397,26 @@ write_backing_store(struct llcache_object *object,
}
/**
+ * Check for overall write performance.
+ *
+ * If the overall write bandwidth has fallen below a useful level for
+ * the backing store to be effective disable it.
+ *
+ * \param p The context pointer passed to the callback.
+ */
+static void llcache_persist_slowcheck(void *p)
+{
+ unsigned long total_bandwidth; /* total bandwidth */
+ total_bandwidth = (llcache->total_written * 1000) / llcache->total_elapsed;
+
+ if (total_bandwidth < llcache->minimum_bandwidth) {
+ LOG(("Cannot write minimum bandwidth"));
+ warn_user("LowDiscWriteBandwidth", 0);
+ guit->llcache->finalise();
+ }
+}
+
+/**
* Possibly write objects data to backing store.
*
* \param p The context pointer passed to the callback.
@@ -2402,7 +2440,7 @@ static void llcache_persist(void *p)
ret = build_candidate_list(&lst, &lst_count);
if (ret != NSERROR_OK) {
- LOG(("Unable to construct candidate list for persisatnt writeout"));
+ LLCACHE_LOG(("Unable to construct candidate list for persisatnt writeout"));
return;
}
@@ -2419,7 +2457,8 @@ static void llcache_persist(void *p)
total_written += written;
total_elapsed += elapsed;
total_bandwidth = (total_written * 1000) / total_elapsed;
- LOG(("Wrote %d bytes in %dms bw:%d %s",
+
+ LLCACHE_LOG(("Wrote %d bytes in %dms bw:%d %s",
written, elapsed, (written * 1000) / elapsed,
nsurl_access(lst[idx]->url) ));
@@ -2433,9 +2472,13 @@ static void llcache_persist(void *p)
* object was very large.
*/
if (total_bandwidth < llcache->minimum_bandwidth) {
- LOG(("Cannot write minimum bandwidth"));
- warn_user("LowDiscWriteBandwidth", 0);
- guit->llcache->finalise();
+ /* Writeout was slow in this time quantum.
+ * Schedule a check in the future to see if
+ * overall performance is too slow to be useful.
+ */
+ guit->browser->schedule(llcache->time_quantum * 100,
+ llcache_persist_slowcheck,
+ NULL);
break;
} else {
if (total_bandwidth > llcache->maximum_bandwidth) {
@@ -2478,10 +2521,13 @@ static void llcache_persist(void *p)
}
}
- LOG(("writeout size:%d time:%d bandwidth:%dbytes/s",
+ llcache->total_written += total_written;
+ llcache->total_elapsed += total_elapsed;
+
+ LLCACHE_LOG(("writeout size:%d time:%d bandwidth:%dbytes/s",
total_written, total_elapsed, total_bandwidth));
- LOG(("Rescheduling writeout in %dms", next));
+ LLCACHE_LOG(("Rescheduling writeout in %dms", next));
guit->browser->schedule(next, llcache_persist, NULL);
}
@@ -3225,7 +3271,9 @@ llcache_initialise(const struct llcache_parameters *prm)
void llcache_finalise(void)
{
llcache_object *object, *next;
+ unsigned long total_bandwidth; /* total bandwidth */
+ total_bandwidth = (llcache->total_written * 1000) / llcache->total_elapsed;
/* Clean uncached objects */
for (object = llcache->uncached_objects; object != NULL; object = next) {
llcache_object_user *user, *next_user;
@@ -3271,6 +3319,9 @@ void llcache_finalise(void)
/* backing store finalisation */
guit->llcache->finalise();
+ LOG(("Backing store average bandwidth %lu bytes/second",
+ total_bandwidth));
+
free(llcache);
llcache = NULL;
}
--
NetSurf Browser
8 years, 5 months
netsurf: branch master updated. release/3.2-513-g0f6f0a0
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/0f6f0a01698dd8c68e377...
...commit http://git.netsurf-browser.org/netsurf.git/commit/0f6f0a01698dd8c68e37771...
...tree http://git.netsurf-browser.org/netsurf.git/tree/0f6f0a01698dd8c68e377718c...
The branch, master has been updated
via 0f6f0a01698dd8c68e377718cc99ba9327da0b81 (commit)
from 57cd5c77b2f5e685b35dae6374bb7f5a168c52c9 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=0f6f0a01698dd8c68e3...
commit 0f6f0a01698dd8c68e377718cc99ba9327da0b81
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
Improve message split generation
This changes the message splitting code to ensure that a translation
is generated for every different key using a specified language as a
fallback if no translation is available.
This also allows for a messages to be generated when there is no
fallback at all and when the translation is the same as the fallback
language
diff --git a/resources/FatMessages b/resources/FatMessages
index 378510a..38b9126 100644
--- a/resources/FatMessages
+++ b/resources/FatMessages
@@ -14,41 +14,35 @@
#
# Key:Value
#
+# Blank lines and lines starting with a # character are treated as comments and
+# ignored.
+#
# Contents of Key _must_ be representable in the US-ASCII character set and
-# should not be modified for translation purposes.
+# should not be modified for translation purposes.
#
# Values must be UTF-8 encoded strings. When these strings are displayed in
-# NetSurf's user interface, they are converted to the system's local character
-# set. As a result of this conversion process, unrepresentable characters are
-# stripped from the displayed string.
-#
-# Blank lines and lines starting with a # character are treated as comments and
-# ignored.
+# NetSurf's user interface, they are converted to the system's local character
+# set. As a result of this conversion process, unrepresentable characters are
+# stripped from the displayed string.
#
# This file gets processed by utils/split-messages.pl at build-time, which gets
-# told the language and the platform. It then emits only messages that are
-# in the right language, and are either in the specific platform or 'all'.
+# told the language and the platform. It then emits only messages that are
+# in the right language, and are either in the specific platform or 'all'.
+#
+# The split-messages tool requires keys for all languages to be
+# grouped together but language order is not important. If a key for a
+# specific language is ommited the default language value will be used
+# instead (currently en)
#
# If you find something tagged 'all', but it is only relevant to a specific
-# front end, please change it. Currently, we have 'all', 'ro', 'gtk' and
-# 'ami'.
+# front end, please change it. Currently, we have 'all', 'ro', 'gtk' and
+# 'ami'.
#
# Globals
en.all.NetSurf:NetSurf
-de.all.NetSurf:NetSurf
-fr.all.NetSurf:NetSurf
-it.all.NetSurf:NetSurf
-nl.all.NetSurf:NetSurf
en.all.NetSurfCopyright:Copyright © 2003 - 2014 The NetSurf Developers
-de.all.NetSurfCopyright:Copyright © 2003 - 2014 The NetSurf Developers
-fr.all.NetSurfCopyright:Copyright © 2003 - 2014 The NetSurf Developers
-it.all.NetSurfCopyright:Copyright © 2003 - 2014 The NetSurf Developers
-nl.all.NetSurfCopyright:Copyright © 2003 - 2014 The NetSurf Developers
en.ami.NetSurfDesc:Small as a mouse, fast as a cheetah and available for free. NetSurf is a multi-platform web browser.
-de.ami.NetSurfDesc:Small as a mouse, fast as a cheetah and available for free. NetSurf is a multi-platform web browser.
-fr.ami.NetSurfDesc:Small as a mouse, fast as a cheetah and available for free. NetSurf is a multi-platform web browser.
it.ami.NetSurfDesc:Piccolo come un mouse, veloce come un ghepardo. NetSurf è un browser web opensource e multi-piattaforma.
-nl.ami.NetSurfDesc:Small as a mouse, fast as a cheetah and available for free. NetSurf is a multi-platform web browser.
# Menus
# =====
@@ -59,9 +53,6 @@ nl.ami.NetSurfDesc:Small as a mouse, fast as a cheetah and available for free. N
# Iconbar menu
#
en.all.Info:Info
-de.all.Info:Info
-fr.all.Info:Info
-it.all.Info:Info
nl.all.Info:Informatie
en.ro.AppHelp:Help... F1
de.ro.AppHelp:Hilfe... F1
@@ -72,7 +63,6 @@ en.all.Open:Open
de.all.Open:Öffnen
fr.all.Open:Ouvrir
it.all.Open:Apri
-nl.all.Open:Open
en.all.Choices:Choices...
de.all.Choices:Einstellungen...
fr.all.Choices:Préférences...
@@ -128,9 +118,6 @@ nl.ro.Help:Hulp
# Main -> Page menu
#
en.ro.PageInfo:Info ^F1
-de.ro.PageInfo:Info ^F1
-fr.ro.PageInfo:Info ^F1
-it.ro.PageInfo:Info ^F1
nl.ro.PageInfo:Informatie ^F1
en.ro.Save:Save F3
de.ro.Save:Speichern F3
@@ -171,17 +158,8 @@ nl.ro.ViewSrc:Bekijk HTML... F8
# Main -> Page -> Export menu
#
en.ro.Draw:Draw ⇑^F3
-de.ro.Draw:Draw ⇑^F3
-fr.ro.Draw:Draw ⇑^F3
-it.ro.Draw:Draw ⇑^F3
-nl.ro.Draw:Draw ⇑^F3
en.all.PDF:PDF
-de.all.PDF:PDF
-fr.all.PDF:PDF
-it.all.PDF:PDF
-nl.all.PDF:PDF
en.ro.Text:Text ^F3
-de.ro.Text:Text ^F3
fr.ro.Text:Texte ^F3
it.ro.Text:Testo ^F3
nl.ro.Text:Tekst ^F3
@@ -189,17 +167,8 @@ nl.ro.Text:Tekst ^F3
# Main -> Page -> Save location menu
#
en.ro.URI:Acorn URI
-de.ro.URI:Acorn URI
-fr.ro.URI:Acorn URI
-it.ro.URI:Acorn URI
-nl.ro.URI:Acorn URI
en.ro.URL:ANT URL
-de.ro.URL:ANT URL
-fr.ro.URL:ANT URL
-it.ro.URL:ANT URL
-nl.ro.URL:ANT URL
en.all.LinkText:Text
-de.all.LinkText:Text
fr.all.LinkText:Texte
it.all.LinkText:Testo
nl.all.LinkText:Tekst
@@ -207,9 +176,6 @@ nl.all.LinkText:Tekst
# Main -> Object -> Object menu
#
en.all.ObjInfo:Info
-de.all.ObjInfo:Info
-fr.all.ObjInfo:Info
-it.all.ObjInfo:Info
nl.all.ObjInfo:Informatie
en.all.ObjSave:Save
de.all.ObjSave:Speichern
@@ -230,39 +196,23 @@ nl.all.ObjReload:Herlaad
# Main -> Object -> Object -> Export menu
#
en.all.Sprite:Sprite
-de.all.Sprite:Sprite
-fr.all.Sprite:Sprite
-it.all.Sprite:Sprite
-nl.all.Sprite:Sprite
en.all.ObjDraw:Draw
-de.all.ObjDraw:Draw
-fr.all.ObjDraw:Draw
-it.all.ObjDraw:Draw
-nl.all.ObjDraw:Draw
# Main -> Object -> Link menu
en.all.LinkSave:Save
de.all.LinkSave:Speichern
-fr.all.LinkSave:Save
it.all.LinkSave:Salva
-nl.all.LinkSave:Save
en.all.LinkDload:Download target
de.all.LinkDload:Ziel speichern
-fr.all.LinkDload:Download target
it.all.LinkDload:Salva file in
-nl.all.LinkDload:Download target
en.all.LinkNew:New window
de.all.LinkNew:Neues Fenster
-fr.all.LinkNew:New window
it.all.LinkNew:Nuova finestra
-nl.all.LinkNew:New window
# Main -> Selection menu
en.all.SelSave:Save
de.all.SelSave:Speichern
-fr.all.SelSave:Save
it.all.SelSave:Salva
-nl.all.SelSave:Save
# Main -> Navigate menu
#
@@ -377,20 +327,15 @@ nl.all.RenderAll:Buffer alle weergaven
# Main -> Utilities menu
#
en.all.Hotlist:Hotlist
-de.all.Hotlist:Hotlist
fr.all.Hotlist:Favoris
it.all.Hotlist:Segnalibri
nl.all.Hotlist:Bladwijzers
en.all.History:History
-de.all.History:History
fr.all.History:Historique
it.all.History:Cronologia locale
nl.all.History:Historie
en.all.Cookies:Cookies
-de.all.Cookies:Cookies
-fr.all.Cookies:Cookies
it.all.Cookies:Cookie
-nl.all.Cookies:Cookies
en.ro.FindText:Find text F4
de.ro.FindText:Text suchen F4
fr.ro.FindText:Recherche de texte F4
@@ -481,15 +426,10 @@ fr.ro.HelpInfo:Information utilisateur
it.ro.HelpInfo:Informazioni utente
nl.ro.HelpInfo:Gebruikers informatie
en.all.HelpCredits:Credits
-de.all.HelpCredits:Credits
-fr.all.HelpCredits:Credits
it.all.HelpCredits:Ringraziamenti
-nl.all.HelpCredits:Credits
en.all.HelpLicence:Licence
de.all.HelpLicence:Lizenz
-fr.all.HelpLicence:Licence
it.all.HelpLicence:Licenza
-nl.all.HelpLicence:Licence
en.ro.HelpInter:Interactive help
de.ro.HelpInter:interaktive Hilfe
fr.ro.HelpInter:Aide interactive
@@ -538,9 +478,7 @@ it.ro.Cut:Taglia dalla clipboard ^X
nl.ro.Cut:Cut to clipboard ^X
en.ro.Paste:Paste from clipboard ^V
de.ro.Paste:Einfügen ^V
-fr.ro.Paste:Paste from clipboard ^V
it.ro.Paste:Incolla sulla clipboard ^V
-nl.ro.Paste:Paste from clipboard ^V
# Selection Menu
#
@@ -583,15 +521,9 @@ fr.all.Collapse:Regrouper
it.all.Collapse:Raggruppa
nl.all.Collapse:Inklappen
en.all.Tree:Tree
-de.all.Tree:Tree
-fr.all.Tree:Tree
it.all.Tree:Albero
-nl.all.Tree:Tree
en.all.TreeExport:Export...
-de.all.TreeExport:Export...
-fr.all.TreeExport:Export...
it.all.TreeExport:Esporta...
-nl.all.TreeExport:Export...
# New hotlist entry menu
#
@@ -5894,9 +5826,7 @@ it.all.CacheMemory:Memoria cache
nl.all.CacheMemory:Memory cache
en.all.CacheDisc:Disc cache
de.all.CacheDisc:Festplatten Cache
-fr.all.CacheDisc:Disc cache
it.all.CacheDisc:Cache su disco
-nl.all.CacheDisc:Disc cache
en.all.Size:Size
de.all.Size:Größe
fr.all.Size:Size
@@ -5951,10 +5881,7 @@ nl.ami.TabAlways:Always show tabs
#
en.all.Downloads:Downloads
-de.all.Downloads:Downloads
-fr.all.Downloads:Downloads
it.all.Downloads:Trasferimenti
-nl.all.Downloads:Downloads
en.all.ConfirmOverwrite:Request confirmation when overwriting
de.all.ConfirmOverwrite:vor Überschreiben nachfragen
fr.all.ConfirmOverwrite:Request confirmation when overwriting
@@ -6012,24 +5939,16 @@ it.all.Enable:Attivi
nl.all.Enable:Enable
en.all.Sticky:Sticky
de.all.Sticky:Klebrig
-fr.all.Sticky:Sticky
it.all.Sticky:Fissi
-nl.all.Sticky:Sticky
en.all.Behaviour:Behaviour
de.all.Behaviour:Verhalten
-fr.all.Behaviour:Behaviour
it.all.Behaviour:Comportamento generale
-nl.all.Behaviour:Behaviour
en.all.OptionNoWindow:Do not open window on startup
de.all.OptionNoWindow:Kein Fenster beim Start öffnen
-fr.all.OptionNoWindow:Do not open window on startup
it.all.OptionNoWindow:Non aprire la finestra all'avvio (avvio da AmiDock)
-nl.all.OptionNoWindow:Do not open window on startup
en.all.OptionNoQuit:Do not quit when last window closed
de.all.OptionNoQuit:Nicht beenden beim Schließen des letzten Fensters
-fr.all.OptionNoQuit:Do not quit when last window closed
it.all.OptionNoQuit:Iconifica su AmiDock alla chiusura di NetSurf
-nl.all.OptionNoQuit:Do not quit when last window closed
# Export
#
@@ -6041,54 +5960,32 @@ it.all.Margins:Margini
nl.all.Margins:Margins
en.all.Top:Top
de.all.Top:Oben
-fr.all.Top:Top
it.all.Top:Superiore
-nl.all.Top:Top
en.all.Left:Left
de.all.Left:Links
-fr.all.Left:Left
it.all.Left:Sinistro
-nl.all.Left:Left
en.all.Right:Right
de.all.Right:Rechts
-fr.all.Right:Right
it.all.Right:Destro
-nl.all.Right:Right
en.all.Bottom:Bottom
de.all.Bottom:Unten
-fr.all.Bottom:Bottom
it.all.Bottom:Inferiore
-nl.all.Bottom:Bottom
en.all.MM:mm
-de.all.MM:mm
-fr.all.MM:mm
-it.all.MM:mm
-nl.all.MM:mm
en.all.Scaling:Scaling
de.all.Scaling:Skalierung
-fr.all.Scaling:Scaling
it.all.Scaling:Scala
-nl.all.Scaling:Scaling
en.all.Scale:Scale
de.all.Scale:Skalieren
-fr.all.Scale:Scale
it.all.Scale:Scalati
-nl.all.Scale:Scale
en.all.Appearance:Appearance
de.all.Appearance:Aussehen
-fr.all.Appearance:Appearance
it.all.Appearance:Aspetto
-nl.all.Appearance:Appearance
en.all.SuppressImages:Suppress images
de.all.SuppressImages:Bilder unterbinden
-fr.all.SuppressImages:Suppress images
it.all.SuppressImages:Sopprimi immagini
-nl.all.SuppressImages:Suppress images
en.all.RemoveBackground:Remove background
de.all.RemoveBackground:Hintergrund entfernen
-fr.all.RemoveBackground:Remove background
it.all.RemoveBackground:Rimuovi sfondo
-nl.all.RemoveBackground:Remove background
en.all.FitPage:Fit page
de.all.FitPage:Seite einpassen
fr.all.FitPage:Fit page
@@ -6096,14 +5993,10 @@ it.all.FitPage:Adatta pagina
nl.all.FitPage:Fit page
en.all.CompressPDF:Compress PDF
de.all.CompressPDF:PDF komprimieren
-fr.all.CompressPDF:Compress PDF
it.all.CompressPDF:Comprimi PDF
-nl.all.CompressPDF:Compress PDF
en.all.SetPassword:Set password
de.all.SetPassword:Passwort festlegen
-fr.all.SetPassword:Set password
it.all.SetPassword:Imposta Password
-nl.all.SetPassword:Set password
# Unused tokens
@@ -6129,7 +6022,6 @@ it.all.ExportAs:Esporta come...
nl.all.ExportAs:Exporteer als
en.all.AnimImg:Animations
de.all.AnimImg:Animationen
-fr.all.AnimImg:Animations
it.all.AnimImg:Animazioni
nl.all.AnimImg:Animatie
en.all.DitherImg:Dither images
diff --git a/utils/split-messages.pl b/utils/split-messages.pl
index 45e5539..570ae03 100644
--- a/utils/split-messages.pl
+++ b/utils/split-messages.pl
@@ -8,10 +8,10 @@
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
-#
+#
# * The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
-#
+#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -39,12 +39,14 @@ use constant GETOPT_SPEC =>
qw( output|o=s
input|i=s
lang|l=s
+ dlang|d=s
plat|platform|p=s
format|fmt|f=s
+ warning|W=s
help|h|? );
# default option values:
-my %opt = qw( plat any format messages );
+my %opt = qw( dlang en plat any format messages warning none );
sub input_stream ();
sub output_stream ();
@@ -80,7 +82,7 @@ sub main ()
}
# double check the options are sane (and we weren't asked for the help)
- if( !$opt_ok || $opt{help} || $opt{lang} !~ /^[a-z]{2}$/ )
+ if( !$opt_ok || $opt{help} || $opt{lang} !~ /^[a-z]{2}$/ || $opt{dlang} !~ /^[a-z]{2}$/ )
{
usage();
}
@@ -88,27 +90,87 @@ sub main ()
# we are good to go:
print( $output $header );
+ my $cur_key;
+
+ my $dlang_key;
+ my $dlang_val;
+
+ my $tran_out = 1;
+ my $tran_val;
+ my $tran_key;
+
while (<$input>)
{
+ # skip comment and empty lines
/^#/ && next;
/^\s*$/ && next;
- # only parsing thinsg that look like message lines:
+
+ # only parsing things that look like message lines:
if( /^([a-z]{2}).([^.]+).([^:]+):(.*)/ )
{
my( $lang, $plat, $key, $val ) = ( $1, $2, $3, $4 );
- if( $lang ne $opt{lang} ) { next };
- if( $opt{plat} eq 'any' ||
- $opt{plat} eq $plat ||
- 'all' eq $plat )
+ # skip the line if it is not for our target platform
+ if( $opt{plat} ne 'any' &&
+ $opt{plat} ne $plat &&
+ 'all' ne $plat )
{
- print( $output $format->( $key, $val ) );
+ next;
}
- }
- else
- {
- warn( "Malformed entry: $_" );
- }
+
+ # On key change ensure a translation has been generated
+ if ($cur_key ne $key)
+ {
+ if ($tran_out == 0)
+ {
+ # No translaton for previous key
+ if ($cur_key eq $dlang_key)
+ {
+ print( $output $format->( $dlang_key, $dlang_val ) );
+ if( $opt{warning} eq "fb" )
+ {
+ warn( "warning: $dlang_key missing translation in $opt{lang} using $opt{dlang} instead" );
+ }
+ }
+ else
+ {
+ # No translation and nothing in default language
+ warn( "warning: $dlang_key missing translation in $opt{lang} and no fallback in $opt{dlang}" );
+ }
+ }
+ else
+ {
+ if (($opt{dlang} ne $opt{lang} ) && ($tran_key eq $dlang_key) && ($tran_val eq $dlang_val))
+ {
+ if( $opt{warning} eq "dup" )
+ {
+ warn( "warning: $tran_key value in $opt{lang} is same as in default $opt{dlang}" );
+ }
+ }
+ }
+ $cur_key = $key;
+ $tran_out = 0;
+ }
+
+ # capture the key/value in the default language
+ if( $lang eq $opt{dlang} )
+ {
+ $dlang_key = $key;
+ $dlang_val = $val;
+ }
+
+ # output if its the target language
+ if( $lang eq $opt{lang} ) {
+ print( $output $format->( $key, $val ) );
+ $tran_out = 1;
+ $tran_val = $val;
+ $tran_key = $key;
+ }
+ }
+ else
+ {
+ warn( "Malformed entry: $_" );
+ }
}
print( $output $footer );
@@ -121,16 +183,18 @@ sub usage ()
my @fmt = map { s/::$//; $_ } keys(%{$::{'msgfmt::'}});
print(STDERR <<TXT );
usage:
- $0 -l lang-code \
- [-o output-file] [-i input-file] [-p platform] [-f format]
+ $0 -l lang-code [-d def-lang-code] [-W warning] \
+ [-o output-file] [-i input-file] [-p platform] [-f format]
$0 -l lang-code ... [input-file [output-file]]
- lang-code : en fr ko ... (no default)
- platform : any gtk ami (default 'any')
- format : @fmt (default 'messages')
- input-file : defaults to standard input
- output-file: defaults to standard output
+ lang-code : en fr ko ... (no default)
+ def-lang-code : en fr ko ... (default 'en')
+ warning : none, all (default 'none')
+ platform : any gtk ami (default 'any')
+ format : @fmt (default 'messages')
+ input-file : defaults to standard input
+ output-file : defaults to standard output
TXT
exit(1);
}
@@ -139,12 +203,12 @@ sub input_stream ()
{
if( $opt{input} )
{
- my $ifh;
+ my $ifh;
- sysopen( $ifh, $opt{input}, O_RDONLY ) ||
- die( "$0: Failed to open input file $opt{input}: $!\n" );
+ sysopen( $ifh, $opt{input}, O_RDONLY ) ||
+ die( "$0: Failed to open input file $opt{input}: $!\n" );
- return $ifh;
+ return $ifh;
}
return \*STDIN;
@@ -154,12 +218,12 @@ sub output_stream ()
{
if( $opt{output} )
{
- my $ofh;
+ my $ofh;
- sysopen( $ofh, $opt{output}, O_CREAT|O_EXCL|O_APPEND|O_WRONLY ) ||
- die( "$0: Failed to open output file $opt{output}: $!\n" );
+ sysopen( $ofh, $opt{output}, O_CREAT|O_EXCL|O_APPEND|O_WRONLY ) ||
+ die( "$0: Failed to open output file $opt{output}: $!\n" );
- return $ofh;
+ return $ofh;
}
return \*STDOUT;
@@ -197,8 +261,8 @@ sub static_section ($)
sub format { return join( ":", @_ ) . "\n" }
sub header
{
- my $in = $opt{input} || '-stdin-';
- return <<TXT;
+ my $in = $opt{input} || '-stdin-';
+ return <<TXT;
# This messages file is automatically generated from $in
# at build-time. Please go and edit that instead of this.\n
TXT
@@ -232,8 +296,8 @@ TXT
sub footer { qq|</resources>| }
sub format
{
- use HTML::Entities qw(encode_entities);
- my $escaped = encode_entities( $_[1], '<>&"' );
- qq| <string name="$_[0]">$escaped</string>\n|;
+ use HTML::Entities qw(encode_entities);
+ my $escaped = encode_entities( $_[1], '<>&"' );
+ qq| <string name="$_[0]">$escaped</string>\n|;
}
}
-----------------------------------------------------------------------
Summary of changes:
resources/FatMessages | 140 ++++++-----------------------------------------
utils/split-messages.pl | 134 +++++++++++++++++++++++++++++++++------------
2 files changed, 115 insertions(+), 159 deletions(-)
diff --git a/resources/FatMessages b/resources/FatMessages
index 378510a..38b9126 100644
--- a/resources/FatMessages
+++ b/resources/FatMessages
@@ -14,41 +14,35 @@
#
# Key:Value
#
+# Blank lines and lines starting with a # character are treated as comments and
+# ignored.
+#
# Contents of Key _must_ be representable in the US-ASCII character set and
-# should not be modified for translation purposes.
+# should not be modified for translation purposes.
#
# Values must be UTF-8 encoded strings. When these strings are displayed in
-# NetSurf's user interface, they are converted to the system's local character
-# set. As a result of this conversion process, unrepresentable characters are
-# stripped from the displayed string.
-#
-# Blank lines and lines starting with a # character are treated as comments and
-# ignored.
+# NetSurf's user interface, they are converted to the system's local character
+# set. As a result of this conversion process, unrepresentable characters are
+# stripped from the displayed string.
#
# This file gets processed by utils/split-messages.pl at build-time, which gets
-# told the language and the platform. It then emits only messages that are
-# in the right language, and are either in the specific platform or 'all'.
+# told the language and the platform. It then emits only messages that are
+# in the right language, and are either in the specific platform or 'all'.
+#
+# The split-messages tool requires keys for all languages to be
+# grouped together but language order is not important. If a key for a
+# specific language is ommited the default language value will be used
+# instead (currently en)
#
# If you find something tagged 'all', but it is only relevant to a specific
-# front end, please change it. Currently, we have 'all', 'ro', 'gtk' and
-# 'ami'.
+# front end, please change it. Currently, we have 'all', 'ro', 'gtk' and
+# 'ami'.
#
# Globals
en.all.NetSurf:NetSurf
-de.all.NetSurf:NetSurf
-fr.all.NetSurf:NetSurf
-it.all.NetSurf:NetSurf
-nl.all.NetSurf:NetSurf
en.all.NetSurfCopyright:Copyright © 2003 - 2014 The NetSurf Developers
-de.all.NetSurfCopyright:Copyright © 2003 - 2014 The NetSurf Developers
-fr.all.NetSurfCopyright:Copyright © 2003 - 2014 The NetSurf Developers
-it.all.NetSurfCopyright:Copyright © 2003 - 2014 The NetSurf Developers
-nl.all.NetSurfCopyright:Copyright © 2003 - 2014 The NetSurf Developers
en.ami.NetSurfDesc:Small as a mouse, fast as a cheetah and available for free. NetSurf is a multi-platform web browser.
-de.ami.NetSurfDesc:Small as a mouse, fast as a cheetah and available for free. NetSurf is a multi-platform web browser.
-fr.ami.NetSurfDesc:Small as a mouse, fast as a cheetah and available for free. NetSurf is a multi-platform web browser.
it.ami.NetSurfDesc:Piccolo come un mouse, veloce come un ghepardo. NetSurf è un browser web opensource e multi-piattaforma.
-nl.ami.NetSurfDesc:Small as a mouse, fast as a cheetah and available for free. NetSurf is a multi-platform web browser.
# Menus
# =====
@@ -59,9 +53,6 @@ nl.ami.NetSurfDesc:Small as a mouse, fast as a cheetah and available for free. N
# Iconbar menu
#
en.all.Info:Info
-de.all.Info:Info
-fr.all.Info:Info
-it.all.Info:Info
nl.all.Info:Informatie
en.ro.AppHelp:Help... F1
de.ro.AppHelp:Hilfe... F1
@@ -72,7 +63,6 @@ en.all.Open:Open
de.all.Open:Öffnen
fr.all.Open:Ouvrir
it.all.Open:Apri
-nl.all.Open:Open
en.all.Choices:Choices...
de.all.Choices:Einstellungen...
fr.all.Choices:Préférences...
@@ -128,9 +118,6 @@ nl.ro.Help:Hulp
# Main -> Page menu
#
en.ro.PageInfo:Info ^F1
-de.ro.PageInfo:Info ^F1
-fr.ro.PageInfo:Info ^F1
-it.ro.PageInfo:Info ^F1
nl.ro.PageInfo:Informatie ^F1
en.ro.Save:Save F3
de.ro.Save:Speichern F3
@@ -171,17 +158,8 @@ nl.ro.ViewSrc:Bekijk HTML... F8
# Main -> Page -> Export menu
#
en.ro.Draw:Draw ⇑^F3
-de.ro.Draw:Draw ⇑^F3
-fr.ro.Draw:Draw ⇑^F3
-it.ro.Draw:Draw ⇑^F3
-nl.ro.Draw:Draw ⇑^F3
en.all.PDF:PDF
-de.all.PDF:PDF
-fr.all.PDF:PDF
-it.all.PDF:PDF
-nl.all.PDF:PDF
en.ro.Text:Text ^F3
-de.ro.Text:Text ^F3
fr.ro.Text:Texte ^F3
it.ro.Text:Testo ^F3
nl.ro.Text:Tekst ^F3
@@ -189,17 +167,8 @@ nl.ro.Text:Tekst ^F3
# Main -> Page -> Save location menu
#
en.ro.URI:Acorn URI
-de.ro.URI:Acorn URI
-fr.ro.URI:Acorn URI
-it.ro.URI:Acorn URI
-nl.ro.URI:Acorn URI
en.ro.URL:ANT URL
-de.ro.URL:ANT URL
-fr.ro.URL:ANT URL
-it.ro.URL:ANT URL
-nl.ro.URL:ANT URL
en.all.LinkText:Text
-de.all.LinkText:Text
fr.all.LinkText:Texte
it.all.LinkText:Testo
nl.all.LinkText:Tekst
@@ -207,9 +176,6 @@ nl.all.LinkText:Tekst
# Main -> Object -> Object menu
#
en.all.ObjInfo:Info
-de.all.ObjInfo:Info
-fr.all.ObjInfo:Info
-it.all.ObjInfo:Info
nl.all.ObjInfo:Informatie
en.all.ObjSave:Save
de.all.ObjSave:Speichern
@@ -230,39 +196,23 @@ nl.all.ObjReload:Herlaad
# Main -> Object -> Object -> Export menu
#
en.all.Sprite:Sprite
-de.all.Sprite:Sprite
-fr.all.Sprite:Sprite
-it.all.Sprite:Sprite
-nl.all.Sprite:Sprite
en.all.ObjDraw:Draw
-de.all.ObjDraw:Draw
-fr.all.ObjDraw:Draw
-it.all.ObjDraw:Draw
-nl.all.ObjDraw:Draw
# Main -> Object -> Link menu
en.all.LinkSave:Save
de.all.LinkSave:Speichern
-fr.all.LinkSave:Save
it.all.LinkSave:Salva
-nl.all.LinkSave:Save
en.all.LinkDload:Download target
de.all.LinkDload:Ziel speichern
-fr.all.LinkDload:Download target
it.all.LinkDload:Salva file in
-nl.all.LinkDload:Download target
en.all.LinkNew:New window
de.all.LinkNew:Neues Fenster
-fr.all.LinkNew:New window
it.all.LinkNew:Nuova finestra
-nl.all.LinkNew:New window
# Main -> Selection menu
en.all.SelSave:Save
de.all.SelSave:Speichern
-fr.all.SelSave:Save
it.all.SelSave:Salva
-nl.all.SelSave:Save
# Main -> Navigate menu
#
@@ -377,20 +327,15 @@ nl.all.RenderAll:Buffer alle weergaven
# Main -> Utilities menu
#
en.all.Hotlist:Hotlist
-de.all.Hotlist:Hotlist
fr.all.Hotlist:Favoris
it.all.Hotlist:Segnalibri
nl.all.Hotlist:Bladwijzers
en.all.History:History
-de.all.History:History
fr.all.History:Historique
it.all.History:Cronologia locale
nl.all.History:Historie
en.all.Cookies:Cookies
-de.all.Cookies:Cookies
-fr.all.Cookies:Cookies
it.all.Cookies:Cookie
-nl.all.Cookies:Cookies
en.ro.FindText:Find text F4
de.ro.FindText:Text suchen F4
fr.ro.FindText:Recherche de texte F4
@@ -481,15 +426,10 @@ fr.ro.HelpInfo:Information utilisateur
it.ro.HelpInfo:Informazioni utente
nl.ro.HelpInfo:Gebruikers informatie
en.all.HelpCredits:Credits
-de.all.HelpCredits:Credits
-fr.all.HelpCredits:Credits
it.all.HelpCredits:Ringraziamenti
-nl.all.HelpCredits:Credits
en.all.HelpLicence:Licence
de.all.HelpLicence:Lizenz
-fr.all.HelpLicence:Licence
it.all.HelpLicence:Licenza
-nl.all.HelpLicence:Licence
en.ro.HelpInter:Interactive help
de.ro.HelpInter:interaktive Hilfe
fr.ro.HelpInter:Aide interactive
@@ -538,9 +478,7 @@ it.ro.Cut:Taglia dalla clipboard ^X
nl.ro.Cut:Cut to clipboard ^X
en.ro.Paste:Paste from clipboard ^V
de.ro.Paste:Einfügen ^V
-fr.ro.Paste:Paste from clipboard ^V
it.ro.Paste:Incolla sulla clipboard ^V
-nl.ro.Paste:Paste from clipboard ^V
# Selection Menu
#
@@ -583,15 +521,9 @@ fr.all.Collapse:Regrouper
it.all.Collapse:Raggruppa
nl.all.Collapse:Inklappen
en.all.Tree:Tree
-de.all.Tree:Tree
-fr.all.Tree:Tree
it.all.Tree:Albero
-nl.all.Tree:Tree
en.all.TreeExport:Export...
-de.all.TreeExport:Export...
-fr.all.TreeExport:Export...
it.all.TreeExport:Esporta...
-nl.all.TreeExport:Export...
# New hotlist entry menu
#
@@ -5894,9 +5826,7 @@ it.all.CacheMemory:Memoria cache
nl.all.CacheMemory:Memory cache
en.all.CacheDisc:Disc cache
de.all.CacheDisc:Festplatten Cache
-fr.all.CacheDisc:Disc cache
it.all.CacheDisc:Cache su disco
-nl.all.CacheDisc:Disc cache
en.all.Size:Size
de.all.Size:Größe
fr.all.Size:Size
@@ -5951,10 +5881,7 @@ nl.ami.TabAlways:Always show tabs
#
en.all.Downloads:Downloads
-de.all.Downloads:Downloads
-fr.all.Downloads:Downloads
it.all.Downloads:Trasferimenti
-nl.all.Downloads:Downloads
en.all.ConfirmOverwrite:Request confirmation when overwriting
de.all.ConfirmOverwrite:vor Überschreiben nachfragen
fr.all.ConfirmOverwrite:Request confirmation when overwriting
@@ -6012,24 +5939,16 @@ it.all.Enable:Attivi
nl.all.Enable:Enable
en.all.Sticky:Sticky
de.all.Sticky:Klebrig
-fr.all.Sticky:Sticky
it.all.Sticky:Fissi
-nl.all.Sticky:Sticky
en.all.Behaviour:Behaviour
de.all.Behaviour:Verhalten
-fr.all.Behaviour:Behaviour
it.all.Behaviour:Comportamento generale
-nl.all.Behaviour:Behaviour
en.all.OptionNoWindow:Do not open window on startup
de.all.OptionNoWindow:Kein Fenster beim Start öffnen
-fr.all.OptionNoWindow:Do not open window on startup
it.all.OptionNoWindow:Non aprire la finestra all'avvio (avvio da AmiDock)
-nl.all.OptionNoWindow:Do not open window on startup
en.all.OptionNoQuit:Do not quit when last window closed
de.all.OptionNoQuit:Nicht beenden beim Schließen des letzten Fensters
-fr.all.OptionNoQuit:Do not quit when last window closed
it.all.OptionNoQuit:Iconifica su AmiDock alla chiusura di NetSurf
-nl.all.OptionNoQuit:Do not quit when last window closed
# Export
#
@@ -6041,54 +5960,32 @@ it.all.Margins:Margini
nl.all.Margins:Margins
en.all.Top:Top
de.all.Top:Oben
-fr.all.Top:Top
it.all.Top:Superiore
-nl.all.Top:Top
en.all.Left:Left
de.all.Left:Links
-fr.all.Left:Left
it.all.Left:Sinistro
-nl.all.Left:Left
en.all.Right:Right
de.all.Right:Rechts
-fr.all.Right:Right
it.all.Right:Destro
-nl.all.Right:Right
en.all.Bottom:Bottom
de.all.Bottom:Unten
-fr.all.Bottom:Bottom
it.all.Bottom:Inferiore
-nl.all.Bottom:Bottom
en.all.MM:mm
-de.all.MM:mm
-fr.all.MM:mm
-it.all.MM:mm
-nl.all.MM:mm
en.all.Scaling:Scaling
de.all.Scaling:Skalierung
-fr.all.Scaling:Scaling
it.all.Scaling:Scala
-nl.all.Scaling:Scaling
en.all.Scale:Scale
de.all.Scale:Skalieren
-fr.all.Scale:Scale
it.all.Scale:Scalati
-nl.all.Scale:Scale
en.all.Appearance:Appearance
de.all.Appearance:Aussehen
-fr.all.Appearance:Appearance
it.all.Appearance:Aspetto
-nl.all.Appearance:Appearance
en.all.SuppressImages:Suppress images
de.all.SuppressImages:Bilder unterbinden
-fr.all.SuppressImages:Suppress images
it.all.SuppressImages:Sopprimi immagini
-nl.all.SuppressImages:Suppress images
en.all.RemoveBackground:Remove background
de.all.RemoveBackground:Hintergrund entfernen
-fr.all.RemoveBackground:Remove background
it.all.RemoveBackground:Rimuovi sfondo
-nl.all.RemoveBackground:Remove background
en.all.FitPage:Fit page
de.all.FitPage:Seite einpassen
fr.all.FitPage:Fit page
@@ -6096,14 +5993,10 @@ it.all.FitPage:Adatta pagina
nl.all.FitPage:Fit page
en.all.CompressPDF:Compress PDF
de.all.CompressPDF:PDF komprimieren
-fr.all.CompressPDF:Compress PDF
it.all.CompressPDF:Comprimi PDF
-nl.all.CompressPDF:Compress PDF
en.all.SetPassword:Set password
de.all.SetPassword:Passwort festlegen
-fr.all.SetPassword:Set password
it.all.SetPassword:Imposta Password
-nl.all.SetPassword:Set password
# Unused tokens
@@ -6129,7 +6022,6 @@ it.all.ExportAs:Esporta come...
nl.all.ExportAs:Exporteer als
en.all.AnimImg:Animations
de.all.AnimImg:Animationen
-fr.all.AnimImg:Animations
it.all.AnimImg:Animazioni
nl.all.AnimImg:Animatie
en.all.DitherImg:Dither images
diff --git a/utils/split-messages.pl b/utils/split-messages.pl
index 45e5539..570ae03 100644
--- a/utils/split-messages.pl
+++ b/utils/split-messages.pl
@@ -8,10 +8,10 @@
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
-#
+#
# * The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
-#
+#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -39,12 +39,14 @@ use constant GETOPT_SPEC =>
qw( output|o=s
input|i=s
lang|l=s
+ dlang|d=s
plat|platform|p=s
format|fmt|f=s
+ warning|W=s
help|h|? );
# default option values:
-my %opt = qw( plat any format messages );
+my %opt = qw( dlang en plat any format messages warning none );
sub input_stream ();
sub output_stream ();
@@ -80,7 +82,7 @@ sub main ()
}
# double check the options are sane (and we weren't asked for the help)
- if( !$opt_ok || $opt{help} || $opt{lang} !~ /^[a-z]{2}$/ )
+ if( !$opt_ok || $opt{help} || $opt{lang} !~ /^[a-z]{2}$/ || $opt{dlang} !~ /^[a-z]{2}$/ )
{
usage();
}
@@ -88,27 +90,87 @@ sub main ()
# we are good to go:
print( $output $header );
+ my $cur_key;
+
+ my $dlang_key;
+ my $dlang_val;
+
+ my $tran_out = 1;
+ my $tran_val;
+ my $tran_key;
+
while (<$input>)
{
+ # skip comment and empty lines
/^#/ && next;
/^\s*$/ && next;
- # only parsing thinsg that look like message lines:
+
+ # only parsing things that look like message lines:
if( /^([a-z]{2}).([^.]+).([^:]+):(.*)/ )
{
my( $lang, $plat, $key, $val ) = ( $1, $2, $3, $4 );
- if( $lang ne $opt{lang} ) { next };
- if( $opt{plat} eq 'any' ||
- $opt{plat} eq $plat ||
- 'all' eq $plat )
+ # skip the line if it is not for our target platform
+ if( $opt{plat} ne 'any' &&
+ $opt{plat} ne $plat &&
+ 'all' ne $plat )
{
- print( $output $format->( $key, $val ) );
+ next;
}
- }
- else
- {
- warn( "Malformed entry: $_" );
- }
+
+ # On key change ensure a translation has been generated
+ if ($cur_key ne $key)
+ {
+ if ($tran_out == 0)
+ {
+ # No translaton for previous key
+ if ($cur_key eq $dlang_key)
+ {
+ print( $output $format->( $dlang_key, $dlang_val ) );
+ if( $opt{warning} eq "fb" )
+ {
+ warn( "warning: $dlang_key missing translation in $opt{lang} using $opt{dlang} instead" );
+ }
+ }
+ else
+ {
+ # No translation and nothing in default language
+ warn( "warning: $dlang_key missing translation in $opt{lang} and no fallback in $opt{dlang}" );
+ }
+ }
+ else
+ {
+ if (($opt{dlang} ne $opt{lang} ) && ($tran_key eq $dlang_key) && ($tran_val eq $dlang_val))
+ {
+ if( $opt{warning} eq "dup" )
+ {
+ warn( "warning: $tran_key value in $opt{lang} is same as in default $opt{dlang}" );
+ }
+ }
+ }
+ $cur_key = $key;
+ $tran_out = 0;
+ }
+
+ # capture the key/value in the default language
+ if( $lang eq $opt{dlang} )
+ {
+ $dlang_key = $key;
+ $dlang_val = $val;
+ }
+
+ # output if its the target language
+ if( $lang eq $opt{lang} ) {
+ print( $output $format->( $key, $val ) );
+ $tran_out = 1;
+ $tran_val = $val;
+ $tran_key = $key;
+ }
+ }
+ else
+ {
+ warn( "Malformed entry: $_" );
+ }
}
print( $output $footer );
@@ -121,16 +183,18 @@ sub usage ()
my @fmt = map { s/::$//; $_ } keys(%{$::{'msgfmt::'}});
print(STDERR <<TXT );
usage:
- $0 -l lang-code \
- [-o output-file] [-i input-file] [-p platform] [-f format]
+ $0 -l lang-code [-d def-lang-code] [-W warning] \
+ [-o output-file] [-i input-file] [-p platform] [-f format]
$0 -l lang-code ... [input-file [output-file]]
- lang-code : en fr ko ... (no default)
- platform : any gtk ami (default 'any')
- format : @fmt (default 'messages')
- input-file : defaults to standard input
- output-file: defaults to standard output
+ lang-code : en fr ko ... (no default)
+ def-lang-code : en fr ko ... (default 'en')
+ warning : none, all (default 'none')
+ platform : any gtk ami (default 'any')
+ format : @fmt (default 'messages')
+ input-file : defaults to standard input
+ output-file : defaults to standard output
TXT
exit(1);
}
@@ -139,12 +203,12 @@ sub input_stream ()
{
if( $opt{input} )
{
- my $ifh;
+ my $ifh;
- sysopen( $ifh, $opt{input}, O_RDONLY ) ||
- die( "$0: Failed to open input file $opt{input}: $!\n" );
+ sysopen( $ifh, $opt{input}, O_RDONLY ) ||
+ die( "$0: Failed to open input file $opt{input}: $!\n" );
- return $ifh;
+ return $ifh;
}
return \*STDIN;
@@ -154,12 +218,12 @@ sub output_stream ()
{
if( $opt{output} )
{
- my $ofh;
+ my $ofh;
- sysopen( $ofh, $opt{output}, O_CREAT|O_EXCL|O_APPEND|O_WRONLY ) ||
- die( "$0: Failed to open output file $opt{output}: $!\n" );
+ sysopen( $ofh, $opt{output}, O_CREAT|O_EXCL|O_APPEND|O_WRONLY ) ||
+ die( "$0: Failed to open output file $opt{output}: $!\n" );
- return $ofh;
+ return $ofh;
}
return \*STDOUT;
@@ -197,8 +261,8 @@ sub static_section ($)
sub format { return join( ":", @_ ) . "\n" }
sub header
{
- my $in = $opt{input} || '-stdin-';
- return <<TXT;
+ my $in = $opt{input} || '-stdin-';
+ return <<TXT;
# This messages file is automatically generated from $in
# at build-time. Please go and edit that instead of this.\n
TXT
@@ -232,8 +296,8 @@ TXT
sub footer { qq|</resources>| }
sub format
{
- use HTML::Entities qw(encode_entities);
- my $escaped = encode_entities( $_[1], '<>&"' );
- qq| <string name="$_[0]">$escaped</string>\n|;
+ use HTML::Entities qw(encode_entities);
+ my $escaped = encode_entities( $_[1], '<>&"' );
+ qq| <string name="$_[0]">$escaped</string>\n|;
}
}
--
NetSurf Browser
8 years, 5 months
netsurf: branch master updated. release/3.2-512-g57cd5c7
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/57cd5c77b2f5e685b35da...
...commit http://git.netsurf-browser.org/netsurf.git/commit/57cd5c77b2f5e685b35dae6...
...tree http://git.netsurf-browser.org/netsurf.git/tree/57cd5c77b2f5e685b35dae637...
The branch, master has been updated
via 57cd5c77b2f5e685b35dae6374bb7f5a168c52c9 (commit)
from dd9a4af311d652d29e74d4bba1e0a3526a4002da (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=57cd5c77b2f5e685b35...
commit 57cd5c77b2f5e685b35dae6374bb7f5a168c52c9
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
Use translated messgae for low bandwidth error
diff --git a/content/llcache.c b/content/llcache.c
index e80085a..f60523d 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -2434,7 +2434,7 @@ static void llcache_persist(void *p)
*/
if (total_bandwidth < llcache->minimum_bandwidth) {
LOG(("Cannot write minimum bandwidth"));
- warn_user("Disc cache write bandwidth is too slow to be useful, disabling cache", 0);
+ warn_user("LowDiscWriteBandwidth", 0);
guit->llcache->finalise();
break;
} else {
diff --git a/resources/FatMessages b/resources/FatMessages
index da1e30c..378510a 100644
--- a/resources/FatMessages
+++ b/resources/FatMessages
@@ -3039,6 +3039,7 @@ de.all.DirectoryError:Verzeichnis '%s' existiert bereits.
fr.all.DirectoryError:directory '%s' already exists
it.all.DirectoryError:La directory '%s' è già esistente
nl.all.DirectoryError:directory '%s' already exists
+en.all.LowDiscWriteBandwidth:Disc cache write bandwidth is too low: the cache will be disabled. If this occurs frequently the cache should be disabled by setting the configured size to 0.
# Error messages for Amiga version only
en.ami.CompError:Unable to open
-----------------------------------------------------------------------
Summary of changes:
content/llcache.c | 2 +-
resources/FatMessages | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/content/llcache.c b/content/llcache.c
index e80085a..f60523d 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -2434,7 +2434,7 @@ static void llcache_persist(void *p)
*/
if (total_bandwidth < llcache->minimum_bandwidth) {
LOG(("Cannot write minimum bandwidth"));
- warn_user("Disc cache write bandwidth is too slow to be useful, disabling cache", 0);
+ warn_user("LowDiscWriteBandwidth", 0);
guit->llcache->finalise();
break;
} else {
diff --git a/resources/FatMessages b/resources/FatMessages
index da1e30c..378510a 100644
--- a/resources/FatMessages
+++ b/resources/FatMessages
@@ -3039,6 +3039,7 @@ de.all.DirectoryError:Verzeichnis '%s' existiert bereits.
fr.all.DirectoryError:directory '%s' already exists
it.all.DirectoryError:La directory '%s' è già esistente
nl.all.DirectoryError:directory '%s' already exists
+en.all.LowDiscWriteBandwidth:Disc cache write bandwidth is too low: the cache will be disabled. If this occurs frequently the cache should be disabled by setting the configured size to 0.
# Error messages for Amiga version only
en.ami.CompError:Unable to open
--
NetSurf Browser
8 years, 5 months
netsurf: branch master updated. release/3.2-511-gdd9a4af
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/dd9a4af311d652d29e74d...
...commit http://git.netsurf-browser.org/netsurf.git/commit/dd9a4af311d652d29e74d4b...
...tree http://git.netsurf-browser.org/netsurf.git/tree/dd9a4af311d652d29e74d4bba...
The branch, master has been updated
via dd9a4af311d652d29e74d4bba1e0a3526a4002da (commit)
from 5f9c8b02b278f88bfc90adf58fb27867d72df249 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=dd9a4af311d652d29e7...
commit dd9a4af311d652d29e74d4bba1e0a3526a4002da
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Remove unused variable
diff --git a/amiga/schedule.c b/amiga/schedule.c
index 3704b10..1f3badf 100755
--- a/amiga/schedule.c
+++ b/amiga/schedule.c
@@ -31,7 +31,6 @@
#include "amiga/schedule.h"
-static bool scheduler_running = false;
static struct MsgPort *smsgport = NULL; /* to send messages for the scheduler to */
static struct TimeRequest *tioreq;
struct Device *TimerBase;
@@ -517,7 +516,6 @@ nserror ami_scheduler_process_create(struct MsgPort *nsmsgport)
}
LOG(("Scheduler started"));
- scheduler_running = true;
return NSERROR_OK;
}
-----------------------------------------------------------------------
Summary of changes:
amiga/schedule.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/amiga/schedule.c b/amiga/schedule.c
index 3704b10..1f3badf 100755
--- a/amiga/schedule.c
+++ b/amiga/schedule.c
@@ -31,7 +31,6 @@
#include "amiga/schedule.h"
-static bool scheduler_running = false;
static struct MsgPort *smsgport = NULL; /* to send messages for the scheduler to */
static struct TimeRequest *tioreq;
struct Device *TimerBase;
@@ -517,7 +516,6 @@ nserror ami_scheduler_process_create(struct MsgPort *nsmsgport)
}
LOG(("Scheduler started"));
- scheduler_running = true;
return NSERROR_OK;
}
--
NetSurf Browser
8 years, 6 months
netsurf: branch master updated. release/3.2-510-g5f9c8b0
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/5f9c8b02b278f88bfc90a...
...commit http://git.netsurf-browser.org/netsurf.git/commit/5f9c8b02b278f88bfc90adf...
...tree http://git.netsurf-browser.org/netsurf.git/tree/5f9c8b02b278f88bfc90adf58...
The branch, master has been updated
via 5f9c8b02b278f88bfc90adf58fb27867d72df249 (commit)
via 020e1f827241b23ea51017f015a224b7465fa347 (commit)
from 2f41c1ad11e3cafc50922f5a67bca98fd91d5ef4 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=5f9c8b02b278f88bfc9...
commit 5f9c8b02b278f88bfc90adf58fb27867d72df249
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Clear message port variable so we don't errorneously send messages to it.
diff --git a/amiga/schedule.c b/amiga/schedule.c
index beaeba2..3704b10 100755
--- a/amiga/schedule.c
+++ b/amiga/schedule.c
@@ -31,6 +31,7 @@
#include "amiga/schedule.h"
+static bool scheduler_running = false;
static struct MsgPort *smsgport = NULL; /* to send messages for the scheduler to */
static struct TimeRequest *tioreq;
struct Device *TimerBase;
@@ -516,6 +517,7 @@ nserror ami_scheduler_process_create(struct MsgPort *nsmsgport)
}
LOG(("Scheduler started"));
+ scheduler_running = true;
return NSERROR_OK;
}
@@ -531,6 +533,7 @@ void ami_scheduler_process_delete(void)
asmsg->type = AMI_S_EXIT;
PutMsg(smsgport, (struct Message *)asmsg);
+ smsgport = NULL; /* this is freed via another copy of this pointer */
return;
}
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=020e1f827241b23ea51...
commit 020e1f827241b23ea51017f015a224b7465fa347
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Run backing store jobs synchronously in the background.
diff --git a/amiga/fs_backing_store.c b/amiga/fs_backing_store.c
index 2eee04b..95c1b09 100644
--- a/amiga/fs_backing_store.c
+++ b/amiga/fs_backing_store.c
@@ -24,29 +24,169 @@
#include "content/fs_backing_store.c"
-struct ami_backing_store_write {
+struct ami_bsm_store {
nsurl *url;
enum backing_store_flags flags;
uint8_t *data;
size_t datalen;
};
+struct ami_bsm_fetch {
+ nsurl *url;
+ enum backing_store_flags bsflags;
+ uint8_t **data_out;
+ size_t *datalen_out;
+};
+
+struct ami_bsm_invalidate {
+ nsurl *url;
+};
+
+struct ami_bsm_release {
+ nsurl *url;
+ enum backing_store_flags bsflags;
+};
+
+struct ami_backing_store {
+ struct MsgPort *msgport;
+ struct llcache_store_parameters *parameters;
+};
+
+struct ami_backing_store_msg {
+ struct Message msg;
+ int type;
+ nserror error;
+ void *data;
+};
+
+enum {
+ AMI_BSM_STARTUP = 0,
+ AMI_BSM_STORE,
+ AMI_BSM_FETCH,
+ AMI_BSM_INVALIDATE,
+ AMI_BSM_RELEASE,
+ AMI_BSM_FINALISE
+};
+
+struct MsgPort *cachemsgport = NULL;
-static int32 ami_backing_store_write_process(STRPTR args, int32 length, APTR execbase)
+static int32 ami_backing_store_process(STRPTR args, int32 length, APTR execbase)
{
struct Process *proc = (struct Process *)FindTask(NULL);
- struct ami_backing_store_write *absw = proc->pr_Task.tc_UserData;
+ struct ami_backing_store *abs = proc->pr_Task.tc_UserData;
+ struct MsgPort *nsmsgport = abs->msgport;
+ struct MsgPort *backingstoremsgport = AllocSysObjectTags(ASOT_PORT, TAG_END);
+ bool running = true;
+
+ nserror error = filesystem_llcache_table->initialise(abs->parameters);
+
+ /* Send a startup message to the message port we were given when we were created.
+ * This tells NetSurf where to send disk cache messages to, as well as informing
+ * that we are running.
+ */
+
+ struct ami_backing_store_msg *absmsg = AllocSysObjectTags(ASOT_MESSAGE,
+ ASOMSG_Size, sizeof(struct ami_backing_store_msg),
+ ASOMSG_ReplyPort, backingstoremsgport,
+ TAG_END);
+
+ absmsg->type = AMI_BSM_STARTUP;
+ absmsg->error = error;
+
+ PutMsg(nsmsgport, (struct Message *)absmsg);
+
+ /* Main loop for this process */
+
+ while(running) {
+ WaitPort(backingstoremsgport);
+
+ while((absmsg = (struct ami_backing_store_msg *)GetMsg(backingstoremsgport))) {
+ if(absmsg->msg.mn_Node.ln_Type == NT_REPLYMSG) {
+ /* if it's a reply, free stuff */
+ FreeSysObject(ASOT_MESSAGE, absmsg);
+ } else {
+ if(running) {
+ switch(absmsg->type) {
+ case AMI_BSM_STORE:
+ {
+ struct ami_bsm_store *absm = absmsg->data;
+ absmsg->error = filesystem_llcache_table->store(absm->url, absm->flags, absm->data, absm->datalen);
+ FreeVec(absm);
+ FreeSysObject(ASOT_MESSAGE, absmsg); /* don't reply, just free */
+ }
+ break;
+
+ case AMI_BSM_FETCH:
+ {
+ struct ami_bsm_fetch *absm = absmsg->data;
+ absmsg->error = filesystem_llcache_table->fetch(absm->url, absm->bsflags, absm->data_out, absm->datalen_out);
+ ReplyMsg((struct Message *)absmsg); /* need to reply to this one */
+ }
+ break;
+
+ case AMI_BSM_INVALIDATE:
+ {
+ struct ami_bsm_invalidate *absm = absmsg->data;
+ absmsg->error = filesystem_llcache_table->invalidate(absm->url);
+ FreeVec(absm);
+ FreeSysObject(ASOT_MESSAGE, absmsg); /* don't reply, just free */
+ }
+ break;
+
+ case AMI_BSM_RELEASE:
+ {
+ struct ami_bsm_release *absm = absmsg->data;
+ absmsg->error = filesystem_llcache_table->release(absm->url, absm->bsflags);
+ FreeVec(absm);
+ FreeSysObject(ASOT_MESSAGE, absmsg); /* don't reply, just free */
+ }
+ break;
+
+ case AMI_BSM_FINALISE:
+ running = false;
+ absmsg->error = filesystem_llcache_table->finalise();
+ ReplyMsg((struct Message *)absmsg); /* need to reply to this one */
+ break;
+
+ default:
+ // unknown message
+ FreeSysObject(ASOT_MESSAGE, absmsg); /* don't reply, just free */
+ break;
+ }
+ }
+ }
+ }
+ }
- filesystem_llcache_table->store(absw->url, absw->flags, absw->data, absw->datalen);
- FreeVec(absw);
+ FreeSysObject(ASOT_PORT, backingstoremsgport);
return RETURN_OK;
}
+static nserror ami_backing_store_send_reply(int type, void *data, struct MsgPort *msgport)
+{
+ if(cachemsgport == NULL) return NSERROR_INIT_FAILED;
+
+ struct ami_backing_store_msg *absmsg = AllocSysObjectTags(ASOT_MESSAGE,
+ ASOMSG_Size, sizeof(struct ami_backing_store_msg),
+ ASOMSG_ReplyPort, msgport,
+ TAG_END);
+
+ absmsg->type = type;
+ absmsg->data = data;
+
+ PutMsg(cachemsgport, (struct Message *)absmsg);
+
+ return NSERROR_OK;
+}
+
+static nserror ami_backing_store_send(int type, void *data)
+{
+ return ami_backing_store_send_reply(type, data, NULL);
+}
/**
* Place an object in the backing store.
- * This implementation starts a new process and calls the core routine.
*
* @param url The url is used as the unique primary key for the data.
* @param flags The flags to control how the object is stored.
@@ -57,48 +197,197 @@ static int32 ami_backing_store_write_process(STRPTR args, int32 length, APTR exe
static nserror
ami_backing_store_store(nsurl *url,
enum backing_store_flags flags,
- const uint8_t *data,
+ uint8_t *data,
const size_t datalen)
{
- struct ami_backing_store_write *absw =
- AllocVecTagList(sizeof(struct ami_backing_store_write), NULL);
+ struct ami_bsm_store *absm =
+ AllocVecTagList(sizeof(struct ami_bsm_store), NULL);
+
+ if(absm == NULL) return NSERROR_NOMEM;
+
+ absm->url = url;
+ absm->flags = flags;
+ absm->data = data;
+ absm->datalen = datalen;
+
+ return ami_backing_store_send(AMI_BSM_STORE, absm);
+}
+
+/**
+ * Retrive an object from the backing store.
+ *
+ * @param[in] url The url is used as the unique primary key for the data.
+ * @param[in] bsflags The flags to control how the object is retrieved.
+ * @param[out] data_out The objects data.
+ * @param[out] datalen_out The length of the \a data retrieved.
+ * @return NSERROR_OK on success or error code on faliure.
+ */
+static nserror ami_backing_store_fetch(nsurl *url,
+ enum backing_store_flags bsflags,
+ uint8_t **data_out,
+ size_t *datalen_out)
+{
+ struct MsgPort *tempmsgport = AllocSysObjectTags(ASOT_PORT, TAG_END);
+ if(tempmsgport == NULL) return NSERROR_NOMEM;
+
+ struct ami_bsm_fetch *absm =
+ AllocVecTagList(sizeof(struct ami_bsm_fetch), NULL);
+ if(absm == NULL) return NSERROR_NOMEM;
- if(absw == NULL) return NSERROR_NOMEM;
+ absm->url = url;
+ absm->bsflags = bsflags;
+ absm->data_out = data_out;
+ absm->datalen_out = datalen_out;
- absw->url = url;
- absw->flags = flags;
- absw->data = (uint8_t *)data;
- absw->datalen = datalen;
+ nserror error = ami_backing_store_send_reply(AMI_BSM_FETCH, absm, tempmsgport);
+ if(error != NSERROR_OK) return error;
+
+ WaitPort(tempmsgport);
+
+ struct ami_backing_store_msg *absmsg = (struct ami_backing_store_msg *)GetMsg(tempmsgport);
+ error = absmsg->error;
+
+ FreeVec(absm);
+ FreeSysObject(ASOT_MESSAGE, absmsg);
+ FreeSysObject(ASOT_PORT, tempmsgport);
+
+ return error;
+}
+
+
+/**
+ * release a previously fetched or stored memory object.
+ *
+ * @param[in] url The url is used as the unique primary key to invalidate.
+ * @param[in] bsflags The flags to control how the object data is released.
+ * @return NSERROR_OK on success or error code on faliure.
+ */
+static nserror ami_backing_store_release(nsurl *url, enum backing_store_flags bsflags)
+{
+ struct ami_bsm_release *absm =
+ AllocVecTagList(sizeof(struct ami_bsm_release), NULL);
+
+ if(absm == NULL) return NSERROR_NOMEM;
+
+ absm->url = url;
+ absm->bsflags = bsflags;
+
+ return ami_backing_store_send(AMI_BSM_RELEASE, absm);
+}
+
+/**
+ * Invalidate a source object from the backing store.
+ *
+ * The entry (if present in the backing store) must no longer
+ * be returned as a result to the fetch or meta operations.
+ *
+ * @param url The url is used as the unique primary key to invalidate.
+ * @return NSERROR_OK on success or error code on faliure.
+ */
+static nserror ami_backing_store_invalidate(nsurl *url)
+{
+ struct ami_bsm_store *absm =
+ AllocVecTagList(sizeof(struct ami_bsm_invalidate), NULL);
+
+ if(absm == NULL) return NSERROR_NOMEM;
+
+ absm->url = url;
+
+ return ami_backing_store_send(AMI_BSM_INVALIDATE, absm);
+}
+
+/**
+ * Finalise the backing store.
+ *
+ * \todo This will cause the backing store to leak any outstanding memory
+ * allocations. This will probably best be done by a global use count.
+ *
+ * @return NSERROR_OK on success.
+ */
+static nserror ami_backing_store_finalise(void)
+{
+ struct MsgPort *tempmsgport = AllocSysObjectTags(ASOT_PORT, TAG_END);
+ if(tempmsgport == NULL) return NSERROR_NOMEM;
+
+ nserror error = ami_backing_store_send_reply(AMI_BSM_FINALISE, NULL, tempmsgport);
+ if(error != NSERROR_OK) return error;
+
+ LOG(("Waiting for backing store process to exit..."));
+
+ WaitPort(tempmsgport);
+
+ struct ami_backing_store_msg *absmsg = (struct ami_backing_store_msg *)GetMsg(tempmsgport);
+ error = absmsg->error;
+
+ FreeSysObject(ASOT_MESSAGE, absmsg);
+ FreeSysObject(ASOT_PORT, tempmsgport);
+ cachemsgport = NULL;
+
+ return error;
+}
+
+
+/**
+ * Initialise the backing store.
+ *
+ * @param parameters to configure backing store.
+ * @return NSERROR_OK on success or error code on faliure.
+ */
+static nserror
+ami_backing_store_initialise(const struct llcache_store_parameters *parameters)
+{
+ struct MsgPort *tempmsgport = AllocSysObjectTags(ASOT_PORT, TAG_END);
+ struct ami_backing_store *abs =
+ AllocVecTagList(sizeof(struct ami_backing_store), NULL);
+ if(abs == NULL) return NSERROR_NOMEM;
+
+ abs->msgport = tempmsgport;
+ abs->parameters = (struct llcache_store_parameters *)parameters;
struct Process *proc = CreateNewProcTags(
- NP_Name, "NetSurf backing store write process",
- NP_Entry, ami_backing_store_write_process,
+ NP_Name, "NetSurf backing store",
+ NP_Entry, ami_backing_store_process,
NP_Child, TRUE,
NP_StackSize, 16384,
NP_Priority, -1,
- NP_UserData, absw,
+ NP_UserData, abs,
TAG_DONE);
if(proc == NULL) {
- FreeVec(absw);
return NSERROR_NOMEM;
}
- return NSERROR_OK;
-}
+ LOG(("Waiting for backing store process to start up..."));
+
+ WaitPort(tempmsgport);
+
+ struct ami_backing_store_msg *msg = (struct ami_backing_store_msg *)GetMsg(tempmsgport);
+ cachemsgport = msg->msg.mn_ReplyPort;
+ nserror error = msg->error;
+ ReplyMsg((struct Message *)msg);
+ FreeSysObject(ASOT_PORT, tempmsgport);
+ LOG(("Backing store process started. Error code: %d", error));
+
+ return error;
+}
static struct gui_llcache_table amiga_llcache_table = {
+#ifdef NSA_NO_ASYNC_STORE
.initialise = initialise,
.finalise = finalise,
-#ifdef NSA_NO_ASYNC_STORE
.store = store,
-#else
- .store = ami_backing_store_store,
-#endif
.fetch = fetch,
.invalidate = invalidate,
.release = release,
+#else
+ .initialise = ami_backing_store_initialise,
+ .finalise = ami_backing_store_finalise,
+ .store = ami_backing_store_store,
+ .fetch = ami_backing_store_fetch,
+ .invalidate = ami_backing_store_invalidate,
+ .release = ami_backing_store_release,
+#endif
};
struct gui_llcache_table *amiga_filesystem_llcache_table = &amiga_llcache_table;
-----------------------------------------------------------------------
Summary of changes:
amiga/fs_backing_store.c | 337 ++++++++++++++++++++++++++++++++++++++++++----
amiga/schedule.c | 3 +
2 files changed, 316 insertions(+), 24 deletions(-)
diff --git a/amiga/fs_backing_store.c b/amiga/fs_backing_store.c
index 2eee04b..95c1b09 100644
--- a/amiga/fs_backing_store.c
+++ b/amiga/fs_backing_store.c
@@ -24,29 +24,169 @@
#include "content/fs_backing_store.c"
-struct ami_backing_store_write {
+struct ami_bsm_store {
nsurl *url;
enum backing_store_flags flags;
uint8_t *data;
size_t datalen;
};
+struct ami_bsm_fetch {
+ nsurl *url;
+ enum backing_store_flags bsflags;
+ uint8_t **data_out;
+ size_t *datalen_out;
+};
+
+struct ami_bsm_invalidate {
+ nsurl *url;
+};
+
+struct ami_bsm_release {
+ nsurl *url;
+ enum backing_store_flags bsflags;
+};
+
+struct ami_backing_store {
+ struct MsgPort *msgport;
+ struct llcache_store_parameters *parameters;
+};
+
+struct ami_backing_store_msg {
+ struct Message msg;
+ int type;
+ nserror error;
+ void *data;
+};
+
+enum {
+ AMI_BSM_STARTUP = 0,
+ AMI_BSM_STORE,
+ AMI_BSM_FETCH,
+ AMI_BSM_INVALIDATE,
+ AMI_BSM_RELEASE,
+ AMI_BSM_FINALISE
+};
+
+struct MsgPort *cachemsgport = NULL;
-static int32 ami_backing_store_write_process(STRPTR args, int32 length, APTR execbase)
+static int32 ami_backing_store_process(STRPTR args, int32 length, APTR execbase)
{
struct Process *proc = (struct Process *)FindTask(NULL);
- struct ami_backing_store_write *absw = proc->pr_Task.tc_UserData;
+ struct ami_backing_store *abs = proc->pr_Task.tc_UserData;
+ struct MsgPort *nsmsgport = abs->msgport;
+ struct MsgPort *backingstoremsgport = AllocSysObjectTags(ASOT_PORT, TAG_END);
+ bool running = true;
+
+ nserror error = filesystem_llcache_table->initialise(abs->parameters);
+
+ /* Send a startup message to the message port we were given when we were created.
+ * This tells NetSurf where to send disk cache messages to, as well as informing
+ * that we are running.
+ */
+
+ struct ami_backing_store_msg *absmsg = AllocSysObjectTags(ASOT_MESSAGE,
+ ASOMSG_Size, sizeof(struct ami_backing_store_msg),
+ ASOMSG_ReplyPort, backingstoremsgport,
+ TAG_END);
+
+ absmsg->type = AMI_BSM_STARTUP;
+ absmsg->error = error;
+
+ PutMsg(nsmsgport, (struct Message *)absmsg);
+
+ /* Main loop for this process */
+
+ while(running) {
+ WaitPort(backingstoremsgport);
+
+ while((absmsg = (struct ami_backing_store_msg *)GetMsg(backingstoremsgport))) {
+ if(absmsg->msg.mn_Node.ln_Type == NT_REPLYMSG) {
+ /* if it's a reply, free stuff */
+ FreeSysObject(ASOT_MESSAGE, absmsg);
+ } else {
+ if(running) {
+ switch(absmsg->type) {
+ case AMI_BSM_STORE:
+ {
+ struct ami_bsm_store *absm = absmsg->data;
+ absmsg->error = filesystem_llcache_table->store(absm->url, absm->flags, absm->data, absm->datalen);
+ FreeVec(absm);
+ FreeSysObject(ASOT_MESSAGE, absmsg); /* don't reply, just free */
+ }
+ break;
+
+ case AMI_BSM_FETCH:
+ {
+ struct ami_bsm_fetch *absm = absmsg->data;
+ absmsg->error = filesystem_llcache_table->fetch(absm->url, absm->bsflags, absm->data_out, absm->datalen_out);
+ ReplyMsg((struct Message *)absmsg); /* need to reply to this one */
+ }
+ break;
+
+ case AMI_BSM_INVALIDATE:
+ {
+ struct ami_bsm_invalidate *absm = absmsg->data;
+ absmsg->error = filesystem_llcache_table->invalidate(absm->url);
+ FreeVec(absm);
+ FreeSysObject(ASOT_MESSAGE, absmsg); /* don't reply, just free */
+ }
+ break;
+
+ case AMI_BSM_RELEASE:
+ {
+ struct ami_bsm_release *absm = absmsg->data;
+ absmsg->error = filesystem_llcache_table->release(absm->url, absm->bsflags);
+ FreeVec(absm);
+ FreeSysObject(ASOT_MESSAGE, absmsg); /* don't reply, just free */
+ }
+ break;
+
+ case AMI_BSM_FINALISE:
+ running = false;
+ absmsg->error = filesystem_llcache_table->finalise();
+ ReplyMsg((struct Message *)absmsg); /* need to reply to this one */
+ break;
+
+ default:
+ // unknown message
+ FreeSysObject(ASOT_MESSAGE, absmsg); /* don't reply, just free */
+ break;
+ }
+ }
+ }
+ }
+ }
- filesystem_llcache_table->store(absw->url, absw->flags, absw->data, absw->datalen);
- FreeVec(absw);
+ FreeSysObject(ASOT_PORT, backingstoremsgport);
return RETURN_OK;
}
+static nserror ami_backing_store_send_reply(int type, void *data, struct MsgPort *msgport)
+{
+ if(cachemsgport == NULL) return NSERROR_INIT_FAILED;
+
+ struct ami_backing_store_msg *absmsg = AllocSysObjectTags(ASOT_MESSAGE,
+ ASOMSG_Size, sizeof(struct ami_backing_store_msg),
+ ASOMSG_ReplyPort, msgport,
+ TAG_END);
+
+ absmsg->type = type;
+ absmsg->data = data;
+
+ PutMsg(cachemsgport, (struct Message *)absmsg);
+
+ return NSERROR_OK;
+}
+
+static nserror ami_backing_store_send(int type, void *data)
+{
+ return ami_backing_store_send_reply(type, data, NULL);
+}
/**
* Place an object in the backing store.
- * This implementation starts a new process and calls the core routine.
*
* @param url The url is used as the unique primary key for the data.
* @param flags The flags to control how the object is stored.
@@ -57,48 +197,197 @@ static int32 ami_backing_store_write_process(STRPTR args, int32 length, APTR exe
static nserror
ami_backing_store_store(nsurl *url,
enum backing_store_flags flags,
- const uint8_t *data,
+ uint8_t *data,
const size_t datalen)
{
- struct ami_backing_store_write *absw =
- AllocVecTagList(sizeof(struct ami_backing_store_write), NULL);
+ struct ami_bsm_store *absm =
+ AllocVecTagList(sizeof(struct ami_bsm_store), NULL);
+
+ if(absm == NULL) return NSERROR_NOMEM;
+
+ absm->url = url;
+ absm->flags = flags;
+ absm->data = data;
+ absm->datalen = datalen;
+
+ return ami_backing_store_send(AMI_BSM_STORE, absm);
+}
+
+/**
+ * Retrive an object from the backing store.
+ *
+ * @param[in] url The url is used as the unique primary key for the data.
+ * @param[in] bsflags The flags to control how the object is retrieved.
+ * @param[out] data_out The objects data.
+ * @param[out] datalen_out The length of the \a data retrieved.
+ * @return NSERROR_OK on success or error code on faliure.
+ */
+static nserror ami_backing_store_fetch(nsurl *url,
+ enum backing_store_flags bsflags,
+ uint8_t **data_out,
+ size_t *datalen_out)
+{
+ struct MsgPort *tempmsgport = AllocSysObjectTags(ASOT_PORT, TAG_END);
+ if(tempmsgport == NULL) return NSERROR_NOMEM;
+
+ struct ami_bsm_fetch *absm =
+ AllocVecTagList(sizeof(struct ami_bsm_fetch), NULL);
+ if(absm == NULL) return NSERROR_NOMEM;
- if(absw == NULL) return NSERROR_NOMEM;
+ absm->url = url;
+ absm->bsflags = bsflags;
+ absm->data_out = data_out;
+ absm->datalen_out = datalen_out;
- absw->url = url;
- absw->flags = flags;
- absw->data = (uint8_t *)data;
- absw->datalen = datalen;
+ nserror error = ami_backing_store_send_reply(AMI_BSM_FETCH, absm, tempmsgport);
+ if(error != NSERROR_OK) return error;
+
+ WaitPort(tempmsgport);
+
+ struct ami_backing_store_msg *absmsg = (struct ami_backing_store_msg *)GetMsg(tempmsgport);
+ error = absmsg->error;
+
+ FreeVec(absm);
+ FreeSysObject(ASOT_MESSAGE, absmsg);
+ FreeSysObject(ASOT_PORT, tempmsgport);
+
+ return error;
+}
+
+
+/**
+ * release a previously fetched or stored memory object.
+ *
+ * @param[in] url The url is used as the unique primary key to invalidate.
+ * @param[in] bsflags The flags to control how the object data is released.
+ * @return NSERROR_OK on success or error code on faliure.
+ */
+static nserror ami_backing_store_release(nsurl *url, enum backing_store_flags bsflags)
+{
+ struct ami_bsm_release *absm =
+ AllocVecTagList(sizeof(struct ami_bsm_release), NULL);
+
+ if(absm == NULL) return NSERROR_NOMEM;
+
+ absm->url = url;
+ absm->bsflags = bsflags;
+
+ return ami_backing_store_send(AMI_BSM_RELEASE, absm);
+}
+
+/**
+ * Invalidate a source object from the backing store.
+ *
+ * The entry (if present in the backing store) must no longer
+ * be returned as a result to the fetch or meta operations.
+ *
+ * @param url The url is used as the unique primary key to invalidate.
+ * @return NSERROR_OK on success or error code on faliure.
+ */
+static nserror ami_backing_store_invalidate(nsurl *url)
+{
+ struct ami_bsm_store *absm =
+ AllocVecTagList(sizeof(struct ami_bsm_invalidate), NULL);
+
+ if(absm == NULL) return NSERROR_NOMEM;
+
+ absm->url = url;
+
+ return ami_backing_store_send(AMI_BSM_INVALIDATE, absm);
+}
+
+/**
+ * Finalise the backing store.
+ *
+ * \todo This will cause the backing store to leak any outstanding memory
+ * allocations. This will probably best be done by a global use count.
+ *
+ * @return NSERROR_OK on success.
+ */
+static nserror ami_backing_store_finalise(void)
+{
+ struct MsgPort *tempmsgport = AllocSysObjectTags(ASOT_PORT, TAG_END);
+ if(tempmsgport == NULL) return NSERROR_NOMEM;
+
+ nserror error = ami_backing_store_send_reply(AMI_BSM_FINALISE, NULL, tempmsgport);
+ if(error != NSERROR_OK) return error;
+
+ LOG(("Waiting for backing store process to exit..."));
+
+ WaitPort(tempmsgport);
+
+ struct ami_backing_store_msg *absmsg = (struct ami_backing_store_msg *)GetMsg(tempmsgport);
+ error = absmsg->error;
+
+ FreeSysObject(ASOT_MESSAGE, absmsg);
+ FreeSysObject(ASOT_PORT, tempmsgport);
+ cachemsgport = NULL;
+
+ return error;
+}
+
+
+/**
+ * Initialise the backing store.
+ *
+ * @param parameters to configure backing store.
+ * @return NSERROR_OK on success or error code on faliure.
+ */
+static nserror
+ami_backing_store_initialise(const struct llcache_store_parameters *parameters)
+{
+ struct MsgPort *tempmsgport = AllocSysObjectTags(ASOT_PORT, TAG_END);
+ struct ami_backing_store *abs =
+ AllocVecTagList(sizeof(struct ami_backing_store), NULL);
+ if(abs == NULL) return NSERROR_NOMEM;
+
+ abs->msgport = tempmsgport;
+ abs->parameters = (struct llcache_store_parameters *)parameters;
struct Process *proc = CreateNewProcTags(
- NP_Name, "NetSurf backing store write process",
- NP_Entry, ami_backing_store_write_process,
+ NP_Name, "NetSurf backing store",
+ NP_Entry, ami_backing_store_process,
NP_Child, TRUE,
NP_StackSize, 16384,
NP_Priority, -1,
- NP_UserData, absw,
+ NP_UserData, abs,
TAG_DONE);
if(proc == NULL) {
- FreeVec(absw);
return NSERROR_NOMEM;
}
- return NSERROR_OK;
-}
+ LOG(("Waiting for backing store process to start up..."));
+
+ WaitPort(tempmsgport);
+
+ struct ami_backing_store_msg *msg = (struct ami_backing_store_msg *)GetMsg(tempmsgport);
+ cachemsgport = msg->msg.mn_ReplyPort;
+ nserror error = msg->error;
+ ReplyMsg((struct Message *)msg);
+ FreeSysObject(ASOT_PORT, tempmsgport);
+ LOG(("Backing store process started. Error code: %d", error));
+
+ return error;
+}
static struct gui_llcache_table amiga_llcache_table = {
+#ifdef NSA_NO_ASYNC_STORE
.initialise = initialise,
.finalise = finalise,
-#ifdef NSA_NO_ASYNC_STORE
.store = store,
-#else
- .store = ami_backing_store_store,
-#endif
.fetch = fetch,
.invalidate = invalidate,
.release = release,
+#else
+ .initialise = ami_backing_store_initialise,
+ .finalise = ami_backing_store_finalise,
+ .store = ami_backing_store_store,
+ .fetch = ami_backing_store_fetch,
+ .invalidate = ami_backing_store_invalidate,
+ .release = ami_backing_store_release,
+#endif
};
struct gui_llcache_table *amiga_filesystem_llcache_table = &amiga_llcache_table;
diff --git a/amiga/schedule.c b/amiga/schedule.c
index beaeba2..3704b10 100755
--- a/amiga/schedule.c
+++ b/amiga/schedule.c
@@ -31,6 +31,7 @@
#include "amiga/schedule.h"
+static bool scheduler_running = false;
static struct MsgPort *smsgport = NULL; /* to send messages for the scheduler to */
static struct TimeRequest *tioreq;
struct Device *TimerBase;
@@ -516,6 +517,7 @@ nserror ami_scheduler_process_create(struct MsgPort *nsmsgport)
}
LOG(("Scheduler started"));
+ scheduler_running = true;
return NSERROR_OK;
}
@@ -531,6 +533,7 @@ void ami_scheduler_process_delete(void)
asmsg->type = AMI_S_EXIT;
PutMsg(smsgport, (struct Message *)asmsg);
+ smsgport = NULL; /* this is freed via another copy of this pointer */
return;
}
--
NetSurf Browser
8 years, 6 months
netsurf: branch master updated. release/3.2-508-g2f41c1a
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/2f41c1ad11e3cafc50922...
...commit http://git.netsurf-browser.org/netsurf.git/commit/2f41c1ad11e3cafc50922f5...
...tree http://git.netsurf-browser.org/netsurf.git/tree/2f41c1ad11e3cafc50922f5a6...
The branch, master has been updated
via 2f41c1ad11e3cafc50922f5a67bca98fd91d5ef4 (commit)
from c9ee49baa8bbf39bfe1ee619b7c9810a1e4f3256 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=2f41c1ad11e3cafc509...
commit 2f41c1ad11e3cafc50922f5a67bca98fd91d5ef4
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Fix leak
diff --git a/amiga/schedule.c b/amiga/schedule.c
index cab2bee..beaeba2 100755
--- a/amiga/schedule.c
+++ b/amiga/schedule.c
@@ -476,6 +476,7 @@ static int32 ami_scheduler_process(STRPTR args, int32 length, APTR execbase)
}
ami_schedule_free(timermsgport);
+ FreeSysObject(ASOT_PORT, schedulermsgport);
return RETURN_OK;
}
-----------------------------------------------------------------------
Summary of changes:
amiga/schedule.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/amiga/schedule.c b/amiga/schedule.c
index cab2bee..beaeba2 100755
--- a/amiga/schedule.c
+++ b/amiga/schedule.c
@@ -476,6 +476,7 @@ static int32 ami_scheduler_process(STRPTR args, int32 length, APTR execbase)
}
ami_schedule_free(timermsgport);
+ FreeSysObject(ASOT_PORT, schedulermsgport);
return RETURN_OK;
}
--
NetSurf Browser
8 years, 6 months
netsurf: branch master updated. release/3.2-507-gc9ee49b
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/c9ee49baa8bbf39bfe1ee...
...commit http://git.netsurf-browser.org/netsurf.git/commit/c9ee49baa8bbf39bfe1ee61...
...tree http://git.netsurf-browser.org/netsurf.git/tree/c9ee49baa8bbf39bfe1ee619b...
The branch, master has been updated
via c9ee49baa8bbf39bfe1ee619b7c9810a1e4f3256 (commit)
from ba5ade87b2fe5a3c4a4153f0d5a8f73eb04048aa (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=c9ee49baa8bbf39bfe1...
commit c9ee49baa8bbf39bfe1ee619b7c9810a1e4f3256
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
cope with backing store writeout making no progress
diff --git a/content/llcache.c b/content/llcache.c
index e12273e..e80085a 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -2411,63 +2411,71 @@ static void llcache_persist(void *p)
/* obtained a candidate list, make each object persistant in turn */
for (idx = 0; idx < lst_count; idx++) {
ret = write_backing_store(lst[idx], &written, &elapsed);
- if (ret == NSERROR_OK) {
- /* sucessfully wrote object to backing store */
- total_written += written;
- total_elapsed += elapsed;
- total_bandwidth = (total_written * 1000) / total_elapsed;
- LOG(("Wrote %d bytes in %dms bw:%d %s",
- written, elapsed, (written * 1000) / elapsed,
- nsurl_access(lst[idx]->url) ));
-
- /* check to for the time quantum or the size
- * (bandwidth) for this run being exceeded.
- */
- if (total_elapsed > llcache->time_quantum) {
- LOG(("Overran timeslot"));
- /* writeout has exhausted the available time.
- * Either the writeout is slow or the last
- * object was very large.
- */
- if (total_bandwidth < llcache->minimum_bandwidth) {
- LOG(("Cannot write minimum bandwidth"));
- warn_user("Disc cache write bandwidth is too slow to be useful, disabling cache", 0);
- guit->llcache->finalise();
- break;
- } else {
- if (total_bandwidth > llcache->maximum_bandwidth) {
- /* fast writeout of large file
- * so calculate delay as if
- * write happened only at max
- * limit
- */
- next = ((total_written * llcache->time_quantum) / write_limit) - total_elapsed;
- } else {
- next = llcache->time_quantum;
- }
- break;
- }
- } else if (total_written > write_limit) {
- /* The bandwidth limit has been reached. */
+ if (ret != NSERROR_OK) {
+ continue;
+ }
+ /* sucessfully wrote object to backing store */
+ total_written += written;
+ total_elapsed += elapsed;
+ total_bandwidth = (total_written * 1000) / total_elapsed;
+ LOG(("Wrote %d bytes in %dms bw:%d %s",
+ written, elapsed, (written * 1000) / elapsed,
+ nsurl_access(lst[idx]->url) ));
+
+ /* check to for the time quantum or the size
+ * (bandwidth) for this run being exceeded.
+ */
+ if (total_elapsed > llcache->time_quantum) {
+ LOG(("Overran timeslot"));
+ /* writeout has exhausted the available time.
+ * Either the writeout is slow or the last
+ * object was very large.
+ */
+ if (total_bandwidth < llcache->minimum_bandwidth) {
+ LOG(("Cannot write minimum bandwidth"));
+ warn_user("Disc cache write bandwidth is too slow to be useful, disabling cache", 0);
+ guit->llcache->finalise();
+ break;
+ } else {
if (total_bandwidth > llcache->maximum_bandwidth) {
- /* fast writeout of large file so
- * calculate delay as if write
- * happened only at max limit
+ /* fast writeout of large file
+ * so calculate delay as if
+ * write happened only at max
+ * limit
*/
next = ((total_written * llcache->time_quantum) / write_limit) - total_elapsed;
} else {
- next = llcache->time_quantum - total_elapsed;
+ next = llcache->time_quantum;
}
break;
}
+ } else if (total_written > write_limit) {
+ /* The bandwidth limit has been reached. */
+
+ if (total_bandwidth > llcache->maximum_bandwidth) {
+ /* fast writeout of large file so
+ * calculate delay as if write
+ * happened only at max limit
+ */
+ next = ((total_written * llcache->time_quantum) / write_limit) - total_elapsed;
+ } else {
+ next = llcache->time_quantum - total_elapsed;
+ }
+ break;
}
+
}
free(lst);
+ /* Completed list without running out of allowed bytes or time */
if (idx == lst_count) {
- LOG(("Completed writeout list"));
- next = llcache->time_quantum - total_elapsed;
+ /* only reschedule if writing is making any progress at all */
+ if (total_written > 0) {
+ next = llcache->time_quantum - total_elapsed;
+ } else {
+ next = -1;
+ }
}
LOG(("writeout size:%d time:%d bandwidth:%dbytes/s",
-----------------------------------------------------------------------
Summary of changes:
content/llcache.c | 96 +++++++++++++++++++++++++++++------------------------
1 file changed, 52 insertions(+), 44 deletions(-)
diff --git a/content/llcache.c b/content/llcache.c
index e12273e..e80085a 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -2411,63 +2411,71 @@ static void llcache_persist(void *p)
/* obtained a candidate list, make each object persistant in turn */
for (idx = 0; idx < lst_count; idx++) {
ret = write_backing_store(lst[idx], &written, &elapsed);
- if (ret == NSERROR_OK) {
- /* sucessfully wrote object to backing store */
- total_written += written;
- total_elapsed += elapsed;
- total_bandwidth = (total_written * 1000) / total_elapsed;
- LOG(("Wrote %d bytes in %dms bw:%d %s",
- written, elapsed, (written * 1000) / elapsed,
- nsurl_access(lst[idx]->url) ));
-
- /* check to for the time quantum or the size
- * (bandwidth) for this run being exceeded.
- */
- if (total_elapsed > llcache->time_quantum) {
- LOG(("Overran timeslot"));
- /* writeout has exhausted the available time.
- * Either the writeout is slow or the last
- * object was very large.
- */
- if (total_bandwidth < llcache->minimum_bandwidth) {
- LOG(("Cannot write minimum bandwidth"));
- warn_user("Disc cache write bandwidth is too slow to be useful, disabling cache", 0);
- guit->llcache->finalise();
- break;
- } else {
- if (total_bandwidth > llcache->maximum_bandwidth) {
- /* fast writeout of large file
- * so calculate delay as if
- * write happened only at max
- * limit
- */
- next = ((total_written * llcache->time_quantum) / write_limit) - total_elapsed;
- } else {
- next = llcache->time_quantum;
- }
- break;
- }
- } else if (total_written > write_limit) {
- /* The bandwidth limit has been reached. */
+ if (ret != NSERROR_OK) {
+ continue;
+ }
+ /* sucessfully wrote object to backing store */
+ total_written += written;
+ total_elapsed += elapsed;
+ total_bandwidth = (total_written * 1000) / total_elapsed;
+ LOG(("Wrote %d bytes in %dms bw:%d %s",
+ written, elapsed, (written * 1000) / elapsed,
+ nsurl_access(lst[idx]->url) ));
+
+ /* check to for the time quantum or the size
+ * (bandwidth) for this run being exceeded.
+ */
+ if (total_elapsed > llcache->time_quantum) {
+ LOG(("Overran timeslot"));
+ /* writeout has exhausted the available time.
+ * Either the writeout is slow or the last
+ * object was very large.
+ */
+ if (total_bandwidth < llcache->minimum_bandwidth) {
+ LOG(("Cannot write minimum bandwidth"));
+ warn_user("Disc cache write bandwidth is too slow to be useful, disabling cache", 0);
+ guit->llcache->finalise();
+ break;
+ } else {
if (total_bandwidth > llcache->maximum_bandwidth) {
- /* fast writeout of large file so
- * calculate delay as if write
- * happened only at max limit
+ /* fast writeout of large file
+ * so calculate delay as if
+ * write happened only at max
+ * limit
*/
next = ((total_written * llcache->time_quantum) / write_limit) - total_elapsed;
} else {
- next = llcache->time_quantum - total_elapsed;
+ next = llcache->time_quantum;
}
break;
}
+ } else if (total_written > write_limit) {
+ /* The bandwidth limit has been reached. */
+
+ if (total_bandwidth > llcache->maximum_bandwidth) {
+ /* fast writeout of large file so
+ * calculate delay as if write
+ * happened only at max limit
+ */
+ next = ((total_written * llcache->time_quantum) / write_limit) - total_elapsed;
+ } else {
+ next = llcache->time_quantum - total_elapsed;
+ }
+ break;
}
+
}
free(lst);
+ /* Completed list without running out of allowed bytes or time */
if (idx == lst_count) {
- LOG(("Completed writeout list"));
- next = llcache->time_quantum - total_elapsed;
+ /* only reschedule if writing is making any progress at all */
+ if (total_written > 0) {
+ next = llcache->time_quantum - total_elapsed;
+ } else {
+ next = -1;
+ }
}
LOG(("writeout size:%d time:%d bandwidth:%dbytes/s",
--
NetSurf Browser
8 years, 6 months
libnsutils: branch master updated. 228710c55bc4e8f69ad56ad981b25a0c4ce41a4c
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libnsutils.git/shortlog/228710c55bc4e8f69a...
...commit http://git.netsurf-browser.org/libnsutils.git/commit/228710c55bc4e8f69ad5...
...tree http://git.netsurf-browser.org/libnsutils.git/tree/228710c55bc4e8f69ad56a...
The branch, master has been updated
via 228710c55bc4e8f69ad56ad981b25a0c4ce41a4c (commit)
from b6e898b7518777b41d9d82dd3e861a64016cbe0a (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/libnsutils.git/commit/?id=228710c55bc4e8f6...
commit 228710c55bc4e8f69ad56ad981b25a0c4ce41a4c
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
do not report time in future if time did not move forwards.
diff --git a/include/nsutils/time.h b/include/nsutils/time.h
index aa39d94..715d3e4 100644
--- a/include/nsutils/time.h
+++ b/include/nsutils/time.h
@@ -18,15 +18,12 @@
#include <nsutils/errors.h>
/**
- * Get a monotonically incriminating number of milliseconds.
+ * Get a monotonically incrementing number of milliseconds.
*
* Obtain a count of elapsed time in milliseconds from an arbitrary point in
* time. Unlike gettimeofday this will continue linearly across time setting
* and not go backwards.
*
- * \note The read value will always increment by at least 1 on each call meaning
- * times less than 1ms cannot be differentiated.
- *
* \param current The current value of the counter.
* \return NSERROR_OK on success else error code.
*/
diff --git a/src/time.c b/src/time.c
index 10e2705..94139c3 100644
--- a/src/time.c
+++ b/src/time.c
@@ -87,12 +87,10 @@ nsuerror nsu_getmonotonic_ms(uint64_t *current_out)
#endif
/* ensure time never goes backwards */
- if (current > prev) {
+ if (current >= prev) {
*current_out = current;
prev = current;
} else {
- /** \todo is 1ms really correct or can we calculate a delta going forwards? */
- prev += 1;
*current_out = prev;
}
return NSUERROR_OK;
-----------------------------------------------------------------------
Summary of changes:
include/nsutils/time.h | 5 +----
src/time.c | 4 +---
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/include/nsutils/time.h b/include/nsutils/time.h
index aa39d94..715d3e4 100644
--- a/include/nsutils/time.h
+++ b/include/nsutils/time.h
@@ -18,15 +18,12 @@
#include <nsutils/errors.h>
/**
- * Get a monotonically incriminating number of milliseconds.
+ * Get a monotonically incrementing number of milliseconds.
*
* Obtain a count of elapsed time in milliseconds from an arbitrary point in
* time. Unlike gettimeofday this will continue linearly across time setting
* and not go backwards.
*
- * \note The read value will always increment by at least 1 on each call meaning
- * times less than 1ms cannot be differentiated.
- *
* \param current The current value of the counter.
* \return NSERROR_OK on success else error code.
*/
diff --git a/src/time.c b/src/time.c
index 10e2705..94139c3 100644
--- a/src/time.c
+++ b/src/time.c
@@ -87,12 +87,10 @@ nsuerror nsu_getmonotonic_ms(uint64_t *current_out)
#endif
/* ensure time never goes backwards */
- if (current > prev) {
+ if (current >= prev) {
*current_out = current;
prev = current;
} else {
- /** \todo is 1ms really correct or can we calculate a delta going forwards? */
- prev += 1;
*current_out = prev;
}
return NSUERROR_OK;
--
NetSurf generalised utility library
8 years, 6 months