texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]


From: Gavin D. Smith
Date: Sun, 20 Mar 2022 04:55:09 -0400 (EDT)

branch: master
commit 6299d574cecea44359e3aa72fa7a19013454d8e1
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sat May 25 00:31:16 2019 +0100

    use g_object_set_data on WebKitWebPage to record that an index is being 
loaded.  this allows a single web process to be used.
---
 js/wkinfo/extension.c | 11 ++++++-----
 js/wkinfo/main.c      | 14 ++++++++++----
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/js/wkinfo/extension.c b/js/wkinfo/extension.c
index 8d6d75a203..6659f07b65 100644
--- a/js/wkinfo/extension.c
+++ b/js/wkinfo/extension.c
@@ -30,8 +30,6 @@ remove_our_socket (void)
     unlink (our_socket_file);
 }
 
-static int send_index_p = 0;
-
 gboolean
 request_callback (WebKitWebPage     *web_page,
                  WebKitURIRequest  *request,
@@ -42,8 +40,6 @@ request_callback (WebKitWebPage     *web_page,
 
   g_print ("Intercepting link <%s>\n", uri);
 
-  send_index_p = 0;
-  
   const char *p = strchr (uri, '?');
   if (p)
     {
@@ -56,7 +52,10 @@ request_callback (WebKitWebPage     *web_page,
       p++;
       g_print ("request type %s\n", p);
       if (!strcmp (p, "send-index"))
-        send_index_p = 1;
+        {
+          g_object_set_data (G_OBJECT(web_page), "send-index",
+                             GINT_TO_POINTER(1));
+        }
       
     }
 
@@ -174,6 +173,8 @@ document_loaded_callback (WebKitWebPage *web_page,
    g_print ("Found %d links\n",
     webkit_dom_html_collection_get_length (links));
 
+   gint send_index_p
+     = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(web_page), "send-index"));
    if (send_index_p)
      {
        send_index (links, num_links);
diff --git a/js/wkinfo/main.c b/js/wkinfo/main.c
index bcde210f7b..3501b9aa0c 100644
--- a/js/wkinfo/main.c
+++ b/js/wkinfo/main.c
@@ -300,9 +300,16 @@ main(int argc, char* argv[])
     msg ("started\n");
 
 
-    webkit_web_context_set_process_model (
-      webkit_web_context_get_default (),
-      WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES); 
+    /* This is used to use a separate process for the web browser
+       that looks up the index files.  This slows the start-up of the program, 
+       but stops the program from freezing while the index files are 
processed. 
+     */
+    if (1)
+      {
+        webkit_web_context_set_process_model (
+          webkit_web_context_get_default (),
+          WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES); 
+      }
 
     WebKitWebViewGroup *group = webkit_web_view_group_new (NULL);
 
@@ -320,7 +327,6 @@ main(int argc, char* argv[])
     webView = WEBKIT_WEB_VIEW(
                                  webkit_web_view_new_with_group(group));
 
-    // Create an 800x600 window that will contain the browser instance
     GtkWidget *main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
     gtk_window_set_default_size(GTK_WINDOW(main_window), 800, 600);
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]