SHARE
TWEET

pidgin-fast-webview

tomkiewicz Nov 15th, 2012 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c
  2. --- a/pidgin/gtkwebview.c
  3. +++ b/pidgin/gtkwebview.c
  4. @@ -705,8 +705,8 @@
  5.         }
  6.  }
  7.  
  8. -static gboolean
  9. -process_load_queue(GtkWebView *webview)
  10. +static void
  11. +process_load_queue_element(GtkWebView *webview)
  12.  {
  13.         GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview);
  14.         int type;
  15. @@ -717,15 +717,6 @@
  16.         WebKitDOMRange *range;
  17.         gboolean require_scroll = FALSE;
  18.  
  19. -       if (priv->is_loading) {
  20. -               priv->loader = 0;
  21. -               return FALSE;
  22. -       }
  23. -       if (!priv->load_queue || g_queue_is_empty(priv->load_queue)) {
  24. -               priv->loader = 0;
  25. -               return FALSE;
  26. -       }
  27. -
  28.         type = GPOINTER_TO_INT(g_queue_pop_head(priv->load_queue));
  29.         str = g_queue_pop_head(priv->load_queue);
  30.  
  31. @@ -783,7 +774,34 @@
  32.         }
  33.  
  34.         g_free(str);
  35. +}
  36.  
  37. +static gboolean
  38. +process_load_queue(GtkWebView *webview)
  39. +{
  40. +       GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview);
  41. +       gint64 start_time;
  42. +
  43. +       if (priv->is_loading) {
  44. +               priv->loader = 0;
  45. +               return FALSE;
  46. +       }
  47. +       if (!priv->load_queue || g_queue_is_empty(priv->load_queue)) {
  48. +               priv->loader = 0;
  49. +               return FALSE;
  50. +       }
  51. +
  52. +       start_time = g_get_monotonic_time();
  53. +       while (!g_queue_is_empty(priv->load_queue)) {
  54. +               process_load_queue_element(webview);
  55. +               if (g_get_monotonic_time() - start_time > 100000) /* 100ms */
  56. +                       break;
  57. +       }
  58. +
  59. +       if (g_queue_is_empty(priv->load_queue)) {
  60. +               priv->loader = 0;
  61. +               return FALSE;
  62. +       }
  63.         return TRUE;
  64.  }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top