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

Unified Diff: chrome/browser/sessions/session_restore.cc

Issue 8929007: Restore sessionStorage when chrome restarts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 | « no previous file | chrome/browser/sessions/session_service.h » ('j') | chrome/browser/sessions/session_service.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sessions/session_restore.cc
diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc
index 0931ae0c809fad9cf319fe1b23b284e4cb7ee90c..f4737a29a3eac5fef5224f15371b7291d4269a09 100644
--- a/chrome/browser/sessions/session_restore.cc
+++ b/chrome/browser/sessions/session_restore.cc
@@ -29,6 +29,9 @@
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/common/chrome_notification_types.h"
+#include "content/browser/in_process_webkit/dom_storage_namespace.h"
+#include "content/browser/in_process_webkit/session_storage_namespace.h"
+#include "content/browser/in_process_webkit/webkit_context.h"
#include "content/browser/renderer_host/render_widget_host.h"
#include "content/browser/renderer_host/render_widget_host_view.h"
#include "content/browser/tab_contents/navigation_controller.h"
@@ -729,10 +732,30 @@ class SessionRestoreImpl : public content::NotificationObserver {
tab.pinned,
true,
NULL);
+ int64 namespace_id =
+ tab_contents->controller().session_storage_namespace()->id();
+
+ DOMStorageContext* dom_storage_context =
+ tab_contents->browser_context()->GetWebKitContext()->
+ dom_storage_context();
+
+ content::BrowserThread::PostTask(
+ content::BrowserThread::WEBKIT, FROM_HERE,
+ base::Bind(&SessionRestoreImpl::RestoreSessionStorage,
+ base::Unretained(this), dom_storage_context, namespace_id,
michaeln 2011/12/13 20:40:03 what ensures 'this' is still valid when the task e
marja 2012/01/17 16:21:49 This is fixed now; WebKitContext is refcounted.
+ tab.session_storage_directory));
+
if (schedule_load)
tab_loader_->ScheduleLoad(&tab_contents->controller());
}
+ void RestoreSessionStorage(DOMStorageContext* dom_storage_context,
+ int64 namespace_id,
+ const FilePath& session_storage_directory) {
+ dom_storage_context->RecreateSessionStorageNamespace(
+ namespace_id, session_storage_directory);
+ }
+
Browser* CreateRestoredBrowser(Browser::Type type,
gfx::Rect bounds,
ui::WindowShowState show_state) {
« no previous file with comments | « no previous file | chrome/browser/sessions/session_service.h » ('j') | chrome/browser/sessions/session_service.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698