Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(886)

Side by Side Diff: chrome/browser/sessions/session_restore.cc

Issue 9963107: Persist sessionStorage on disk. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code review (pkasting) Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/sessions/session_restore.h" 5 #include "chrome/browser/sessions/session_restore.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <list> 8 #include <list>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 base::TimeDelta time_to_process_sessions = 726 base::TimeDelta time_to_process_sessions =
727 base::TimeTicks::Now() - restore_started_; 727 base::TimeTicks::Now() - restore_started_;
728 UMA_HISTOGRAM_CUSTOM_TIMES( 728 UMA_HISTOGRAM_CUSTOM_TIMES(
729 "SessionRestore.TimeToProcessSessions", 729 "SessionRestore.TimeToProcessSessions",
730 time_to_process_sessions, 730 time_to_process_sessions,
731 base::TimeDelta::FromMilliseconds(10), 731 base::TimeDelta::FromMilliseconds(10),
732 base::TimeDelta::FromSeconds(1000), 732 base::TimeDelta::FromSeconds(1000),
733 100); 733 100);
734 734
735 if (windows->empty()) { 735 if (windows->empty()) {
736 // Restore was unsuccessful. 736 // Restore was unsuccessful. The DOM storage system can also delete its
737 // data, since no session restore will happen at a later point in time.
738 content::BrowserContext::GetDefaultDOMStorageContext(profile_)->
739 StartScavengingUnusedSessionStorage();
737 return FinishedTabCreation(false, false); 740 return FinishedTabCreation(false, false);
738 } 741 }
739 742
740 #if defined(OS_CHROMEOS) 743 #if defined(OS_CHROMEOS)
741 chromeos::BootTimesLoader::Get()->AddLoginTimeMarker( 744 chromeos::BootTimesLoader::Get()->AddLoginTimeMarker(
742 "SessionRestore-CreatingTabs-Start", false); 745 "SessionRestore-CreatingTabs-Start", false);
743 #endif 746 #endif
744 StartTabCreation(); 747 StartTabCreation();
745 748
746 // After the for loop this contains the last TABBED_BROWSER. Is null if no 749 // After the for loop this contains the last TABBED_BROWSER. Is null if no
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 #if defined(OS_CHROMEOS) 818 #if defined(OS_CHROMEOS)
816 chromeos::BootTimesLoader::Get()->AddLoginTimeMarker( 819 chromeos::BootTimesLoader::Get()->AddLoginTimeMarker(
817 "SessionRestore-CreatingTabs-End", false); 820 "SessionRestore-CreatingTabs-End", false);
818 #endif 821 #endif
819 // If last_browser is NULL and urls_to_open_ is non-empty, 822 // If last_browser is NULL and urls_to_open_ is non-empty,
820 // FinishedTabCreation will create a new TabbedBrowser and add the urls to 823 // FinishedTabCreation will create a new TabbedBrowser and add the urls to
821 // it. 824 // it.
822 Browser* finished_browser = FinishedTabCreation(true, has_tabbed_browser); 825 Browser* finished_browser = FinishedTabCreation(true, has_tabbed_browser);
823 if (finished_browser) 826 if (finished_browser)
824 last_browser = finished_browser; 827 last_browser = finished_browser;
828
829 // sessionStorages needed for the session restore have now been recreated
830 // by RestoreTab. Now it's safe for the DOM storage system to start
831 // deleting leftover data.
832 content::BrowserContext::GetDefaultDOMStorageContext(profile_)->
833 StartScavengingUnusedSessionStorage();
825 return last_browser; 834 return last_browser;
826 } 835 }
827 836
828 // Record an app launch event (if appropriate) for a tab which is about to 837 // Record an app launch event (if appropriate) for a tab which is about to
829 // be restored. Callers should ensure that selected_index is within the 838 // be restored. Callers should ensure that selected_index is within the
830 // bounds of tab.navigations before calling. 839 // bounds of tab.navigations before calling.
831 void RecordAppLaunchForTab(Browser* browser, 840 void RecordAppLaunchForTab(Browser* browser,
832 const SessionTab& tab, 841 const SessionTab& tab,
833 int selected_index) { 842 int selected_index) {
834 DCHECK(selected_index >= 0 && 843 DCHECK(selected_index >= 0 &&
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 if (active_session_restorers == NULL) 1099 if (active_session_restorers == NULL)
1091 return false; 1100 return false;
1092 for (std::set<SessionRestoreImpl*>::const_iterator it = 1101 for (std::set<SessionRestoreImpl*>::const_iterator it =
1093 active_session_restorers->begin(); 1102 active_session_restorers->begin();
1094 it != active_session_restorers->end(); ++it) { 1103 it != active_session_restorers->end(); ++it) {
1095 if ((*it)->profile() == profile) 1104 if ((*it)->profile() == profile)
1096 return true; 1105 return true;
1097 } 1106 }
1098 return false; 1107 return false;
1099 } 1108 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_impl.cc ('k') | chrome/browser/ui/startup/session_crashed_prompt.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698