Most popular tags

Welcome to Earthwithsun.com, where you can ask questions and receive answers from other members of the community.

Google Chrome - Did not shut down correctly

(Note: This is just out of curiosity, hope this doesn't sound stupid or anything.)
As I'm sure most of you know, every time Google Chrome is "shut down incorrectly" (eg. cutting the computer's power supply), it will display a yellow bar at the top the very next time it is opened, saying that it wasn't shut down correctly and offering to restore the pages that were last opened. How does it do that? More specifically, how does it detect that it wasn't shut down correctly? Thanks.

1 Answer

It depends on the operating system but one common way for any app to do this is to write to a "logbook" of some sorts every time the app is opened or closed.

In windows this would be the system registry. When chrome opens/closes it writes to the registry that it has successfully opened/closed without any problems. Every time chrome opens it also checks whether there's any discrepancies in the log. If there is a "successfully opened" entry but no matching "successfully closed" entry, then that's when it knows.