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

Unified Diff: chrome/browser/sessions/session_service.h

Issue 8929007: Restore sessionStorage when chrome restarts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix: cloning storage areas. Created 8 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sessions/session_restore.cc ('k') | chrome/browser/sessions/session_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sessions/session_service.h
diff --git a/chrome/browser/sessions/session_service.h b/chrome/browser/sessions/session_service.h
index e6feffd1f400847d0218bdb2b953040c5842354c..4fad17ff19b7b319e682607a3c5b32275e5bfc2d 100644
--- a/chrome/browser/sessions/session_service.h
+++ b/chrome/browser/sessions/session_service.h
@@ -7,6 +7,7 @@
#pragma once
#include <map>
+#include <set>
#include <string>
#include "base/basictypes.h"
@@ -178,6 +179,8 @@ class SessionService : public BaseSessionService,
virtual void Save() OVERRIDE;
private:
+ class SessionStorageAssociationReader;
+
typedef std::map<SessionID::id_type, std::pair<int, int> > IdToRange;
typedef std::map<SessionID::id_type, SessionTab*> IdToSessionTab;
typedef std::map<SessionID::id_type, SessionWindow*> IdToSessionWindow;
@@ -237,6 +240,10 @@ class SessionService : public BaseSessionService,
SessionCommand* CreatePinnedStateCommand(const SessionID& tab_id,
bool is_pinned);
+ void CreateAndScheduleSessionStorageCreatedCommand(
+ int64 namespace_id,
+ const FilePath& directory);
+
// Callback from the backend for getting the commands from the save file.
// Converts the commands in SessionWindows and notifies the real callback.
void OnGotSessionCommands(
@@ -299,7 +306,8 @@ class SessionService : public BaseSessionService,
// done by AddTabsToWindows.
bool CreateTabsAndWindows(const std::vector<SessionCommand*>& data,
std::map<int, SessionTab*>* tabs,
- std::map<int, SessionWindow*>* windows);
+ std::map<int, SessionWindow*>* windows,
+ std::set<std::string>* needed_session_storages);
// Adds commands to commands that will recreate the state of the specified
// tab. This adds at most kMaxNavigationCountToPersist navigations (in each
@@ -392,6 +400,11 @@ class SessionService : public BaseSessionService,
void RecordUpdatedSessionNavigationOrTab(base::TimeDelta delta,
bool use_long_period);
+ // Callback for SessionStorageAssociationReader.
+ void AssociateSessionStorage(SessionStorageAssociationReader* reader,
+ int64 namespace_id,
+ const FilePath& directory);
+
// Convert back/forward between the Browser and SessionService DB window
// types.
static WindowType WindowTypeForBrowserType(Browser::Type type);
@@ -437,6 +450,13 @@ class SessionService : public BaseSessionService,
// current/last session.
bool move_on_new_browser_;
+ // Map from session storage namespace id (stored by |SessionStorageNamespace|)
+ // to a pair (window_id, tab_id).
+ typedef std::map<int64,
+ std::pair<SessionID, SessionID> > SessionStorageNamespaceMap;
+
+ SessionStorageNamespaceMap session_storage_namespace_map_;
+
// Used for reporting frequency of session altering operations.
base::TimeTicks last_updated_tab_closed_time_;
base::TimeTicks last_updated_nav_list_pruned_time_;
@@ -448,6 +468,16 @@ class SessionService : public BaseSessionService,
const base::TimeDelta save_delay_in_mins_;
const base::TimeDelta save_delay_in_hrs_;
+ // For keeping track of |SessionStorageAssociationReader|s which are active at
+ // the moment. When destructed, this map will drop the references to them. The
+ // destructor of |SessionService| uses this map for nullifying the pointers in
+ // the |SessionStorageAssociationReader|s so that they won't call
+ // |SessionService| back after finishing their operations.
+ typedef std::map<SessionStorageAssociationReader*,
+ scoped_refptr<SessionStorageAssociationReader> >
+ SessionStorageAssociationReaders;
+ SessionStorageAssociationReaders session_storage_association_readers_;
+
DISALLOW_COPY_AND_ASSIGN(SessionService);
};
« no previous file with comments | « chrome/browser/sessions/session_restore.cc ('k') | chrome/browser/sessions/session_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698