After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 675302 - Delay tab loading on session restore
Delay tab loading on session restore
Status: RESOLVED FIXED
Product: epiphany
Classification: Core
Component: General
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Gustavo Noronha (kov)
Epiphany Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-05-02 15:07 UTC by Xan Lopez
Modified: 2013-02-12 16:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
WIP I'm working on (11.91 KB, patch)
2013-02-01 04:02 UTC, Gustavo Noronha (kov)
none Details | Review
Patch (13.62 KB, patch)
2013-02-04 03:48 UTC, Gustavo Noronha (kov)
reviewed Details | Review
Patch using a signal emitted by the session (17.65 KB, patch)
2013-02-08 22:11 UTC, Gustavo Noronha (kov)
none Details | Review
Earlier patch with just the other comments addressed, but using switched_to (12.94 KB, patch)
2013-02-08 22:13 UTC, Gustavo Noronha (kov)
none Details | Review
Much better! (17.14 KB, patch)
2013-02-09 18:46 UTC, Gustavo Noronha (kov)
accepted-commit_now Details | Review
Patch with test (24.08 KB, patch)
2013-02-11 15:01 UTC, Gustavo Noronha (kov)
none Details | Review
Patch with test (24.08 KB, patch)
2013-02-11 18:30 UTC, Gustavo Noronha (kov)
committed Details | Review

Description Xan Lopez 2012-05-02 15:07:03 UTC
Do not load all the restored tabs at once, but only the focused tab in each restored window. The others can be loaded when they are actually focused, if ever. Firefox seems to be doing this since version 13, looks like a good idea to me.
Comment 1 Xan Lopez 2012-05-02 15:07:37 UTC
Also, when we switch to the overview no-tabs UI, this will make absolute sense anyways, so it seems to be the way to go.
Comment 2 Gustavo Noronha (kov) 2013-02-01 04:02:45 UTC
Created attachment 234948 [details] [review]
WIP I'm working on

Not finished yet, think I need to use the stored favicon instead of using the loading spinner, like Firefox does. Also, I made set_{address,title} public, but I'll actually do something like what we have for error pages, instead. Uploading here so I can maybe get some early feedback =)
Comment 3 Gustavo Noronha (kov) 2013-02-04 03:48:10 UTC
Created attachment 235130 [details] [review]
Patch

OK, this is worthier of review =)
Comment 4 Xan Lopez 2013-02-05 17:57:21 UTC
Review of attachment 235130 [details] [review]:

Looks great in general, thanks for hacking on it.

::: embed/ephy-embed.c
@@ +419,3 @@
 
+  if (priv->delayed_request)
+    g_clear_object (&priv->delayed_request);

This is not needed if we do g_clear_object

@@ +1196,3 @@
+
+  g_clear_object (&embed->priv->delayed_request);
+}

Can't we just do this automatically when the embed gets focus, becomes drawable (ie, visible + shown), or something like that? Feels like we should be able to avoid the notebook telling us.

@@ +1211,3 @@
+  return (gboolean)embed->priv->delayed_request;
+}
+

Should add g_return_if_fail to the methods where needed.

::: embed/ephy-web-view.c
@@ +2384,3 @@
+                               const char *uri,
+                               const char *title)
+{

Also missing g_return_if...

@@ +2387,3 @@
+  char *html = g_markup_printf_escaped ("<head><title>%s</title></head>", title);
+
+  /* We want onlye the actual load to be the one recorded in history, but

s/onlye/only/

::: src/ephy-session.c
@@ +1014,3 @@
+		 */
+		embed = EPHY_EMBED (gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), context->active_tab));
+		ephy_embed_notify_switched_to (embed);

See my comment in EphyEmbed, if EphyEmbed does by itself this is also not needed.

::: src/ephy-window.c
@@ +4372,3 @@
+ephy_window_is_empty (EphyWindow *window)
+{
+	return !!!gtk_notebook_get_n_pages (window->priv->notebook);

This method does not seem to be used anywhere (?)
Comment 5 Gustavo Noronha (kov) 2013-02-08 22:11:50 UTC
Created attachment 235550 [details] [review]
Patch using a signal emitted by the session

So this tries to use the map signal and uses a session signal like we discussed. After playing with this a while I am not sure it's worth pursuing. Like you said on IRC, this does not help with keeping the feature fully inside EphyEmbed, and makes EphyEmbed depend on stuff that's in the src/ module, which requires us to add new include paths even, I think this is something we want to avoid. I think the more robust way of managing this for now is to have an explicit notification, for now, and we can revisit this when we switch to the new design, I'll post another patch with that, let me know what you think.
Comment 6 Gustavo Noronha (kov) 2013-02-08 22:13:45 UTC
Created attachment 235551 [details] [review]
Earlier patch with just the other comments addressed, but using switched_to
Comment 7 Xan Lopez 2013-02-08 23:31:09 UTC
Well, I actually said Shell, not Session, so having the signal in EphyEmbedShell would work fine wrt include paths. But yes, as I also said this could defeat purpose anyway, so I'll have a look again at the patch.
Comment 8 Gustavo Noronha (kov) 2013-02-09 16:19:25 UTC
Oh, duh, I thought you meant EphyShell, which would be as problematic as EphySession. Let me play with that idea beofre you get to this again, then. Now that I slept over it, I guess we could even use EphyEmbedSingle for the signal...
Comment 9 Gustavo Noronha (kov) 2013-02-09 18:46:37 UTC
Created attachment 235595 [details] [review]
Much better!

EphyEmbedShell works nicely =)
Comment 10 Xan Lopez 2013-02-10 10:12:20 UTC
Review of attachment 235595 [details] [review]:

I think this looks great. Having a test would be good, I have learned that all the session code is flimsy as hell.

::: embed/ephy-embed.c
@@ +1220,3 @@
+
+  g_object_ref (request);
+  embed->priv->delayed_request = request;

Just a nitpick but it would probably be a good idea here to make sure we don't already have a delayed request set before saving the new one (so just unref one if it exists), and check the request type.
Comment 11 Xan Lopez 2013-02-10 10:13:12 UTC
The only comment I have after testing it is that the "delayed tabs" do not immediately start to show the spinner when you switch to them, so for a second or two it seems that nothing is happening. That should probably be fixed.
Comment 12 Gustavo Noronha (kov) 2013-02-10 19:46:58 UTC
Cool! In theory we should never set a delayed request more than once on an embed, but I guess we might in the future, so I'll add a g_clear_object() there. As for the test, I'll write one, but I think for testing this I'll need to actually display the window, I don't think realizing will be enough for getting the embed mapped. Would it be ok to add infrastructure to run the test inside an xvfb, for that?

Btw, the session test is currently failing for me, because some about:* addresses are coming back from _get_address() with the ephy- prefix and some aren't, should it always have the ephy- prefix or never?
Comment 13 Gustavo Noronha (kov) 2013-02-11 15:01:00 UTC
Created attachment 235708 [details] [review]
Patch with test

Testing by displaying the window works, if you think using Xvfb is a good idea I'll try to figure out why the test is not being able to look up icons and crashing when running under Xvfb heh
Comment 14 Gustavo Noronha (kov) 2013-02-11 18:30:58 UTC
Created attachment 235728 [details] [review]
Patch with test

Testing by displaying the window works, if you think using Xvfb is a good idea I'll try to figure out why the test is not being able to look up icons and crashing when running under Xvfb heh
Comment 15 Xan Lopez 2013-02-11 18:39:03 UTC
I think for now you can land it without the test while we figure out the Xvfb stuff. I went out of my way to make the tests not show windows (see the shell mode, etc), so I'd rather keep it that way. My comment was more like "we should really test this" more than "do not land it without the test".

Also no idea about the test failure you mention, I'm not getting that :S
Comment 16 Gustavo Noronha (kov) 2013-02-12 15:50:26 UTC
OK!
Comment 17 Gustavo Noronha (kov) 2013-02-12 16:00:15 UTC
Comment on attachment 235728 [details] [review]
Patch with test

Landed without the test bits and a missing cast to G_OBJECT as ce7ab1e34804d9f7529bed13267f4619c37e32d9
Comment 18 Gustavo Noronha (kov) 2013-02-12 16:09:53 UTC
I opened bug 693655 to track the test