summaryrefslogtreecommitdiff
path: root/amiga
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2014-11-22 16:41:29 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2014-11-22 16:41:29 +0000
commit0cd682644ba8a0bc566aa378ca5374c9663f8562 (patch)
tree8c4c2508a0d3442fa0158ec8927cb0dc689c3339 /amiga
parent71cdc991c798e935145b25c4d9df57d19bb05f17 (diff)
downloadnetsurf-0cd682644ba8a0bc566aa378ca5374c9663f8562.tar.gz
netsurf-0cd682644ba8a0bc566aa378ca5374c9663f8562.tar.bz2
Revert "Revert "Write out to the backing store asynchronously.""
This reverts commit 75623179aa7a0259477ef93dcd2a3562c4884c74.
Diffstat (limited to 'amiga')
-rw-r--r--amiga/Makefile.defaults4
-rw-r--r--amiga/Makefile.target2
-rw-r--r--amiga/fs_backing_store.c97
-rw-r--r--amiga/fs_backing_store.h23
-rw-r--r--amiga/gui.c4
5 files changed, 123 insertions, 7 deletions
diff --git a/amiga/Makefile.defaults b/amiga/Makefile.defaults
index 20022bb98..2134e8373 100644
--- a/amiga/Makefile.defaults
+++ b/amiga/Makefile.defaults
@@ -26,10 +26,6 @@ NETSURF_USE_AMIGA_DATATYPES := YES
# Valid options: YES, NO
NETSURF_USE_NSSVG := YES
-# Enable building the source object cache filesystem based backing store.
-# Valid options: YES, NO
-NETSURF_FS_BACKING_STORE := YES
-
# Enable NetSurf's use of Spidermonkey 1.80+
# Only here to stop the build complaining;
# enable NETSURF_USE_MOZJS instead for JavaScript support
diff --git a/amiga/Makefile.target b/amiga/Makefile.target
index bb8b8173d..21a482d95 100644
--- a/amiga/Makefile.target
+++ b/amiga/Makefile.target
@@ -72,7 +72,7 @@ S_AMIGA := gui.c tree.c history.c hotlist.c schedule.c file.c \
sslcert.c gui_options.c print.c theme.c drag.c icon.c libs.c \
datatypes.c dt_picture.c dt_anim.c dt_sound.c plugin_hack.c \
stringview/stringview.c stringview/urlhistory.c \
- agclass/amigaguide_class.c
+ agclass/amigaguide_class.c fs_backing_store.c
S_AMIGA := $(addprefix amiga/,$(S_AMIGA))
# This is the final source build list
diff --git a/amiga/fs_backing_store.c b/amiga/fs_backing_store.c
new file mode 100644
index 000000000..94ab6cc61
--- /dev/null
+++ b/amiga/fs_backing_store.c
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2014 Chris Young <chris@unsatisfactorysoftware.co.uk>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <proto/dos.h>
+#include <proto/exec.h>
+
+#include "content/fs_backing_store.c"
+
+struct ami_backing_store_write {
+ nsurl *url;
+ enum backing_store_flags flags;
+ uint8_t *data;
+ size_t datalen;
+};
+
+
+static int32 ami_backing_store_write_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;
+
+ filesystem_llcache_table->store(absw->url, absw->flags, absw->data, absw->datalen);
+ FreeVec(absw);
+
+ return RETURN_OK;
+}
+
+
+/**
+ * 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.
+ * @param data The objects source data.
+ * @param datalen The length of the \a data.
+ * @return NSERROR_OK on success or error code on faliure.
+ */
+static nserror
+ami_backing_store_store(nsurl *url,
+ enum backing_store_flags flags,
+ const uint8_t *data,
+ const size_t datalen)
+{
+ struct ami_backing_store_write *absw =
+ AllocVecTagList(sizeof(struct ami_backing_store_write), NULL);
+
+ if(absw == NULL) return NSERROR_NOMEM;
+
+ absw->url = url;
+ absw->flags = flags;
+ absw->data = (uint8_t *)data;
+ absw->datalen = datalen;
+
+ struct Process *proc = CreateNewProcTags(
+ NP_Name, "NetSurf backing store write process",
+ NP_Entry, ami_backing_store_write_process,
+ NP_Child, TRUE,
+ NP_StackSize, 16384,
+ NP_Priority, -1,
+ NP_UserData, absw,
+ TAG_DONE);
+
+ if(proc == NULL) {
+ FreeVec(absw);
+ return NSERROR_NOMEM;
+ }
+
+ return NSERROR_OK;
+}
+
+
+static struct gui_llcache_table amiga_llcache_table = {
+ .initialise = initialise,
+ .finalise = finalise,
+ .store = ami_backing_store_store,
+ .fetch = fetch,
+ .invalidate = invalidate,
+};
+
+struct gui_llcache_table *amiga_filesystem_llcache_table = &amiga_llcache_table;
+
diff --git a/amiga/fs_backing_store.h b/amiga/fs_backing_store.h
new file mode 100644
index 000000000..89a67fb79
--- /dev/null
+++ b/amiga/fs_backing_store.h
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2014 Chris Young <chris@unsatisfactorysoftware.co.uk>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef AMIGA_FS_BACKING_STORE_H
+#define AMIGA_FS_BACKING_STORE_H
+extern struct gui_llcache_table *amiga_filesystem_llcache_table;
+#endif
+
diff --git a/amiga/gui.c b/amiga/gui.c
index 461a20dab..6146c6e9a 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -93,7 +93,6 @@
#include "utils/utils.h"
#include "utils/nsurl.h"
#include "utils/file.h"
-#include "content/backing_store.h"
#include "content/fetchers.h"
#include "content/fetchers/resource.h"
#include "content/urldb.h"
@@ -126,6 +125,7 @@
#include "amiga/file.h"
#include "amiga/filetype.h"
#include "amiga/font.h"
+#include "amiga/fs_backing_store.h"
#include "amiga/gui_options.h"
#include "amiga/help.h"
#include "amiga/history.h"
@@ -5310,7 +5310,7 @@ int main(int argc, char** argv)
.utf8 = amiga_utf8_table,
.search = amiga_search_table,
.search_web = &amiga_search_web_table,
- .llcache = filesystem_llcache_table,
+ .llcache = amiga_filesystem_llcache_table,
};
signal(SIGINT, SIG_IGN);