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 681832 - Save the session asynchronously
Save the session asynchronously
Status: RESOLVED FIXED
Product: epiphany
Classification: Core
Component: General
git master
Other Linux
: Normal normal
: ---
Assigned To: Epiphany Maintainers
Epiphany Maintainers
Depends on: 641739
Blocks:
 
 
Reported: 2012-08-14 12:29 UTC by Carlos Garcia Campos
Modified: 2013-01-09 14:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch (15.11 KB, patch)
2012-08-14 12:29 UTC, Carlos Garcia Campos
none Details | Review
Updated patch for current git master (12.43 KB, patch)
2012-09-03 10:48 UTC, Carlos Garcia Campos
none Details | Review
Use a XML memory writer and save the contents with g_file_replace_contents() (2.07 KB, patch)
2012-09-05 09:14 UTC, Carlos Garcia Campos
committed Details | Review
Updated patch (12.43 KB, patch)
2012-10-08 09:55 UTC, Carlos Garcia Campos
committed Details | Review

Description Carlos Garcia Campos 2012-08-14 12:29:43 UTC
Created attachment 221132 [details] [review]
Patch

Using a thread to avoid doing IO in the main thread and blocking the UI while saving the session.
Comment 1 Carlos Garcia Campos 2012-09-03 10:48:34 UTC
Created attachment 223282 [details] [review]
Updated patch for current git master
Comment 2 Carlos Garcia Campos 2012-09-05 09:14:58 UTC
Created attachment 223505 [details] [review]
Use a XML memory writer and save the contents with g_file_replace_contents()

The code is simpler and g_file_replace_contents() can be cancelled.
Comment 3 Carlos Garcia Campos 2012-10-08 09:55:15 UTC
Created attachment 226028 [details] [review]
Updated patch

Updated for the changes in bug #641734 (ephy_shell_has_windows() has been removed)
Comment 4 Xan Lopez 2013-01-09 11:18:34 UTC
Review of attachment 226028 [details] [review]:

OK, this patch looks great to me. I especially like the cleanups in the write (windows/tabs/data) methods, good job!
Comment 5 Xan Lopez 2013-01-09 11:27:17 UTC
Review of attachment 223505 [details] [review]:

::: src/ephy-session.c
@@ +591,3 @@
+					      buffer->use,
+					      NULL, TRUE, 0, NULL,
+					      cancellable, &error))

The ephy switch_temp_file method goes to some lengths to make sure we can never lose data (making backups, doing the switch atomatically, etc.) Does this thing do the same? I'd say it's important to be really sure we can never screw the session file here.
Comment 6 Carlos Garcia Campos 2013-01-09 11:47:39 UTC
Review of attachment 223505 [details] [review]:

::: src/ephy-session.c
@@ +591,3 @@
+					      buffer->use,
+					      NULL, TRUE, 0, NULL,
+					      cancellable, &error))

Yes, it even has several approaches to make sure the replacement is atomic depending on the platform. I'm also using the make_backup (it's the TRUE you see in the call) option that creates a backup file before replacing it
Comment 7 Carlos Garcia Campos 2013-01-09 11:49:36 UTC
(In reply to comment #6)
> Review of attachment 223505 [details] [review]:
> 
> ::: src/ephy-session.c
> @@ +591,3 @@
> +                          buffer->use,
> +                          NULL, TRUE, 0, NULL,
> +                          cancellable, &error))
> 
> Yes, it even has several approaches to make sure the replacement is atomic
> depending on the platform. I'm also using the make_backup (it's the TRUE you
> see in the call) option that creates a backup file before replacing it

And the major advantage is that it can be cancelled, which happens several times during the startup when there are several tabs in the session.
Comment 8 Xan Lopez 2013-01-09 12:28:28 UTC
Comment on attachment 223505 [details] [review]
Use a XML memory writer and save the contents with g_file_replace_contents()

OK, cool, let's do it.
Comment 9 Carlos Garcia Campos 2013-01-09 14:07:18 UTC
Thanks, pushed both patches to git master.