diff options
author | Gustavo Noronha Silva <gns@gnome.org> | 2013-02-10 02:43:02 +0800 |
---|---|---|
committer | Gustavo Noronha Silva <gns@gnome.org> | 2013-02-12 23:55:51 +0800 |
commit | ce7ab1e34804d9f7529bed13267f4619c37e32d9 (patch) | |
tree | 69f2a2e2dbce017980352b1afd57e1b38c8f278b /src/ephy-session.c | |
parent | 551eb0cec6469ece8e826411d65bf806ec043142 (diff) | |
download | gsoc2013-epiphany-ce7ab1e34804d9f7529bed13267f4619c37e32d9.tar gsoc2013-epiphany-ce7ab1e34804d9f7529bed13267f4619c37e32d9.tar.gz gsoc2013-epiphany-ce7ab1e34804d9f7529bed13267f4619c37e32d9.tar.bz2 gsoc2013-epiphany-ce7ab1e34804d9f7529bed13267f4619c37e32d9.tar.lz gsoc2013-epiphany-ce7ab1e34804d9f7529bed13267f4619c37e32d9.tar.xz gsoc2013-epiphany-ce7ab1e34804d9f7529bed13267f4619c37e32d9.tar.zst gsoc2013-epiphany-ce7ab1e34804d9f7529bed13267f4619c37e32d9.zip |
Only load pages when their tab is switched to upon session restore
Firefox has led the way implementing this behaviour to improve the experience
of restoring a session with lots of tabs. By delaying the loading of pages to
when the user shows interest in them, the time it takes for the browser to
become usable is diminished, and less pages are loaded in parallel, which
improves load time for the first pages the user sees.
It also has the advante of displaying less HTTP Basic Auth dialogs, when the
user has many tabs pointed to the same server.
https://bugzilla.gnome.org/show_bug.cgi?id=675302
Diffstat (limited to 'src/ephy-session.c')
-rw-r--r-- | src/ephy-session.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/ephy-session.c b/src/ephy-session.c index 47dfe08bd..82ecf4149 100644 --- a/src/ephy-session.c +++ b/src/ephy-session.c @@ -631,7 +631,7 @@ session_tab_new (EphyEmbed *embed) } session_tab->title = g_strdup (ephy_web_view_get_title (web_view)); - session_tab->loading = ephy_web_view_is_loading (web_view); + session_tab->loading = ephy_web_view_is_loading (web_view) && !ephy_embed_has_load_pending (embed); return session_tab; } @@ -1102,11 +1102,19 @@ session_parse_embed (SessionParserContext *context, */ if (!was_loading || is_blank_page) { - ephy_shell_new_tab (ephy_shell_get_default (), - context->window, NULL, url, - EPHY_NEW_TAB_IN_EXISTING_WINDOW | - EPHY_NEW_TAB_OPEN_PAGE | - EPHY_NEW_TAB_APPEND_LAST); + EphyNewTabFlags flags; + EphyEmbed *embed; + EphyWebView *web_view; + + flags = EPHY_NEW_TAB_IN_EXISTING_WINDOW; + flags |= EPHY_NEW_TAB_APPEND_LAST; + flags |= EPHY_NEW_TAB_DELAYED_OPEN_PAGE; + + embed = ephy_shell_new_tab (ephy_shell_get_default (), + context->window, NULL, url, flags); + + web_view = ephy_embed_get_web_view (embed); + ephy_web_view_set_placeholder (web_view, url, title); } else if (was_loading && url != NULL) { @@ -1150,6 +1158,7 @@ session_end_element (GMarkupParseContext *ctx, if (strcmp (element_name, "window") == 0) { GtkWidget *notebook; + EphyEmbedShell *shell = ephy_embed_shell_get_default (); notebook = ephy_window_get_notebook (context->window); gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), context->active_tab); @@ -1163,6 +1172,8 @@ session_end_element (GMarkupParseContext *ctx, gtk_widget_show (GTK_WIDGET (context->window)); } + ephy_embed_shell_restored_window (shell); + context->window = NULL; context->active_tab = 0; context->is_first_window = FALSE; |