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

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: session only rules Created 8 years, 6 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 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.
737 return FinishedTabCreation(false, false); 737 return FinishedTabCreation(false, false);
michaeln 2012/06/26 06:15:12 would it make sense to also kick of scavenging pri
marja 2012/06/26 14:18:05 Done.
738 } 738 }
739 739
740 #if defined(OS_CHROMEOS) 740 #if defined(OS_CHROMEOS)
741 chromeos::BootTimesLoader::Get()->AddLoginTimeMarker( 741 chromeos::BootTimesLoader::Get()->AddLoginTimeMarker(
742 "SessionRestore-CreatingTabs-Start", false); 742 "SessionRestore-CreatingTabs-Start", false);
743 #endif 743 #endif
744 StartTabCreation(); 744 StartTabCreation();
745 745
746 Browser* current_browser = 746 Browser* current_browser =
747 browser_ ? browser_ : browser::FindLastActiveWithProfile(profile_); 747 browser_ ? browser_ : browser::FindLastActiveWithProfile(profile_);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 #if defined(OS_CHROMEOS) 817 #if defined(OS_CHROMEOS)
818 chromeos::BootTimesLoader::Get()->AddLoginTimeMarker( 818 chromeos::BootTimesLoader::Get()->AddLoginTimeMarker(
819 "SessionRestore-CreatingTabs-End", false); 819 "SessionRestore-CreatingTabs-End", false);
820 #endif 820 #endif
821 // If last_browser is NULL and urls_to_open_ is non-empty, 821 // If last_browser is NULL and urls_to_open_ is non-empty,
822 // FinishedTabCreation will create a new TabbedBrowser and add the urls to 822 // FinishedTabCreation will create a new TabbedBrowser and add the urls to
823 // it. 823 // it.
824 Browser* finished_browser = FinishedTabCreation(true, has_tabbed_browser); 824 Browser* finished_browser = FinishedTabCreation(true, has_tabbed_browser);
825 if (finished_browser) 825 if (finished_browser)
826 last_browser = finished_browser; 826 last_browser = finished_browser;
827
828 // sessionStorages needed for the session restore have now been recreated
829 // by RestoreTab. Now it's safe for the DOM storage system to start
830 // deleting leftover data.
831 content::DOMStorageContext* dom_storage_context =
832 content::BrowserContext::GetDOMStorageContext(profile_);
833 dom_storage_context->StartScavengingUnusedSessionStorage();
827 return last_browser; 834 return last_browser;
828 } 835 }
829 836
830 // 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
831 // be restored. Callers should ensure that selected_index is within the 838 // be restored. Callers should ensure that selected_index is within the
832 // bounds of tab.navigations before calling. 839 // bounds of tab.navigations before calling.
833 void RecordAppLaunchForTab(Browser* browser, 840 void RecordAppLaunchForTab(Browser* browser,
834 const SessionTab& tab, 841 const SessionTab& tab,
835 int selected_index) { 842 int selected_index) {
836 DCHECK(selected_index >= 0 && 843 DCHECK(selected_index >= 0 &&
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 if (active_session_restorers == NULL) 1100 if (active_session_restorers == NULL)
1094 return false; 1101 return false;
1095 for (std::set<SessionRestoreImpl*>::const_iterator it = 1102 for (std::set<SessionRestoreImpl*>::const_iterator it =
1096 active_session_restorers->begin(); 1103 active_session_restorers->begin();
1097 it != active_session_restorers->end(); ++it) { 1104 it != active_session_restorers->end(); ++it) {
1098 if ((*it)->profile() == profile) 1105 if ((*it)->profile() == profile)
1099 return true; 1106 return true;
1100 } 1107 }
1101 return false; 1108 return false;
1102 } 1109 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/startup/session_crashed_prompt.cc » ('j') | content/public/browser/dom_storage_context.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698