r9974 jmb - in /branches/jmb/new-cache/content: content.c content.h
netsurf at semichrome.net
netsurf at semichrome.net
Sat Feb 13 00:18:35 GMT 2010
Author: jmb
Date: Fri Feb 12 18:18:35 2010
New Revision: 9974
URL: http://source.netsurf-browser.org?rev=9974&view=rev
Log:
Modify content_create() API to accommodate new cache scheme.
Make content_destroy() public.
Modified:
branches/jmb/new-cache/content/content.c
branches/jmb/new-cache/content/content.h
Modified: branches/jmb/new-cache/content/content.c
URL: http://source.netsurf-browser.org/branches/jmb/new-cache/content/content.c?rev=9974&r1=9973&r2=9974&view=diff
==============================================================================
--- branches/jmb/new-cache/content/content.c (original)
+++ branches/jmb/new-cache/content/content.c Fri Feb 12 18:18:35 2010
@@ -356,7 +356,6 @@
static void content_update_status(struct content *c);
-static void content_destroy(struct content *c);
/**
@@ -391,7 +390,8 @@
* CONTENT_STATUS_TYPE_UNKNOWN.
*/
-struct content * content_create(const char *url)
+struct content * content_create(llcache_handle *llcache, lwc_context *dict,
+ const char *fallback_charset, bool quirks)
{
struct content *c;
struct content_user *user_sentinel;
@@ -400,13 +400,15 @@
if (!c)
return 0;
- LOG(("url %s -> %p", url, c));
+ LOG(("url %s -> %p", llcache_handle_get_url(llcache), c));
user_sentinel = talloc(c, struct content_user);
if (!user_sentinel) {
talloc_free(c);
return 0;
}
+ c->llcache = llcache;
+ c->dict = lwc_context_ref(dict);
c->type = CONTENT_UNKNOWN;
c->mime_type = 0;
c->status = CONTENT_STATUS_TYPE_UNKNOWN;
@@ -469,10 +471,6 @@
struct content *parent)
{
union content_msg_data msg_data;
- struct content *clone;
- void (*callback)(content_msg msg, struct content *c, intptr_t p1,
- intptr_t p2, union content_msg_data data);
- intptr_t p1, p2;
assert(c != 0);
assert(c->status == CONTENT_STATUS_TYPE_UNKNOWN);
@@ -491,51 +489,6 @@
c->type = type;
c->status = CONTENT_STATUS_LOADING;
-
- if (handler_map[type].no_share && c->user_list->next &&
- c->user_list->next->next) {
- /* type not shareable, and more than one user: split into
- * a content per user */
- const char *referer = NULL;
- struct content *parent = NULL;
-
- while (c->user_list->next->next) {
- clone = content_create(
- llcache_handle_get_url(c->llcache));
- if (!clone) {
- c->type = CONTENT_UNKNOWN;
- c->status = CONTENT_STATUS_ERROR;
- msg_data.error = messages_get("NoMemory");
- content_broadcast(c, CONTENT_MSG_ERROR,
- msg_data);
- return false;
- }
-
- clone->width = c->width;
- clone->height = c->height;
- clone->fresh = c->fresh;
-
- callback = c->user_list->next->next->callback;
- p1 = c->user_list->next->next->p1;
- p2 = c->user_list->next->next->p2;
- if (!content_add_user(clone, callback, p1, p2)) {
- c->type = CONTENT_UNKNOWN;
- c->status = CONTENT_STATUS_ERROR;
- content_destroy(clone);
- msg_data.error = messages_get("NoMemory");
- content_broadcast(c, CONTENT_MSG_ERROR,
- msg_data);
- return false;
- }
- content_remove_user(c, callback, p1, p2);
- msg_data.new_url = NULL;
- content_broadcast(clone, CONTENT_MSG_NEWPTR, msg_data);
- fetchcache_go(clone, referer,
- callback, p1, p2,
- clone->width, clone->height,
- 0, 0, false, parent);
- }
- }
if (handler_map[type].create) {
if (!handler_map[type].create(c, parent, params)) {
Modified: branches/jmb/new-cache/content/content.h
URL: http://source.netsurf-browser.org/branches/jmb/new-cache/content/content.h?rev=9974&r1=9973&r2=9974&view=diff
==============================================================================
--- branches/jmb/new-cache/content/content.h (original)
+++ branches/jmb/new-cache/content/content.h Fri Feb 12 18:18:35 2010
@@ -28,9 +28,13 @@
#include <stdbool.h>
+#include <libwapcaplet/libwapcaplet.h>
+
#include "utils/config.h"
#include "content/content_type.h"
#include "desktop/plot_style.h"
+
+struct llcache_handle;
struct box;
struct browser_window;
@@ -95,7 +99,9 @@
content_type content_lookup(const char *mime_type);
-struct content * content_create(const char *url);
+struct content * content_create(struct llcache_handle *llcache,
+ lwc_context *dict, const char *fallback_charset, bool quirks);
+void content_destroy(struct content *c);
bool content_can_reformat(struct content *c);
bool content_set_type(struct content *c, content_type type,
const char *mime_type, const char *params[],
More information about the netsurf-commits
mailing list