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

Issue 3325012: Fix SessionStorage (Closed)

Created:
10 years, 3 months ago by jorlow
Modified:
9 years, 6 months ago
CC:
chromium-reviews, ben+cc_chromium.org, Erik does not do reviews, Aaron Boodman, pam+watch_chromium.org, joth, brettw-cc_chromium.org, Paweł Hajdan Jr., darin-cc_chromium.org, nkostylev+cc_chromium.org, davemoore+watch_chromium.org, Lei Zhang
Visibility:
Public.

Description

Fix SessionStorage Apparently the session storage code was pretty horribly broken. It didn't correctly handle tabs being restored, didn't have the proper lifetime (this was the issue exposed in the bug), and had many leaks. To fix this, things had to be plumbed fairly differently. We need to pass session storage in on TabContents creation to ensure that the first RenderView will have the correct session storage id. When closing a tab, we need to save the session storage with the restoration service. When restoring a tab, we pass it back into the tab contents class. When duplicating a tab, we clone the storage. Lifetimes are now handled by standard reference counting code. A SessionStorageNamespace object wraps an ID. When it's instantiated, it allocates an ID. When it's destroyed, it deletes the ID. IDs make this process very lightweight (the heavyweight stuff is allocated on first use of SessionStorage) and it seperates the more complex lifetimes of SessionStorage namespaces (where less deterministic shutdown is more tollerable) from the LocalStorage namespace which needs to shutdown very precisely. BUG=52393 TEST=Set some variable on session storage; close the tab; re-open the tab; the variable should still be set. You can also run through the repro steps in the bug. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=59350

Patch Set 1 #

Patch Set 2 : fixed a few issues #

Patch Set 3 : completely compiles on mac #

Patch Set 4 : works on windows #

Patch Set 5 : fixes for linux/chromeos #

Total comments: 4

Patch Set 6 : minor fixes #

Total comments: 2

Patch Set 7 : rebase #

Patch Set 8 : back off another dcheck #

Patch Set 9 : remove dcheck #

Patch Set 10 : kill the last (new) dcheck #

Unified diffs Side-by-side diffs Delta from patch set Stats (+208 lines, -93 lines) Patch
M chrome/browser/browser.h View 3 chunks +5 lines, -2 lines 0 comments Download
M chrome/browser/browser.cc View 1 2 3 4 5 6 3 chunks +10 lines, -6 lines 0 comments Download
M chrome/browser/browser_browsertest.cc View 3 3 chunks +3 lines, -3 lines 0 comments Download
M chrome/browser/chromeos/login/web_page_view.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/cocoa/html_dialog_window_controller.mm View 1 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/cocoa/tab_strip_controller_unittest.mm View 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/cocoa/tabpose_window_unittest.mm View 3 4 5 6 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/cocoa/translate/translate_infobar_unittest.mm View 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/debugger/devtools_window.cc View 1 2 chunks +2 lines, -1 line 0 comments Download
M chrome/browser/dom_ui/html_dialog_tab_contents_delegate_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/extensions/extension_host.cc View 1 2 3 4 5 6 2 chunks +1 line, -5 lines 0 comments Download
M chrome/browser/external_tab_container_win.cc View 4 5 6 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/gtk/html_dialog_gtk.cc View 1 chunk +1 line, -1 line 0 comments Download
A chrome/browser/in_process_webkit/session_storage_namespace.h View 1 2 3 4 5 6 7 1 chunk +46 lines, -0 lines 0 comments Download
A chrome/browser/in_process_webkit/session_storage_namespace.cc View 1 chunk +31 lines, -0 lines 0 comments Download
M chrome/browser/in_process_webkit/webkit_context.h View 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/in_process_webkit/webkit_context.cc View 1 2 3 4 5 6 7 8 9 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/browser/notifications/balloon_host.cc View 1 2 chunks +2 lines, -6 lines 0 comments Download
M chrome/browser/renderer_host/render_view_host.h View 1 2 3 4 5 6 3 chunks +8 lines, -4 lines 0 comments Download
M chrome/browser/renderer_host/render_view_host.cc View 1 2 3 4 5 6 4 chunks +9 lines, -3 lines 0 comments Download
M chrome/browser/renderer_host/render_view_host_factory.h View 3 chunks +3 lines, -2 lines 0 comments Download
M chrome/browser/renderer_host/render_view_host_factory.cc View 1 chunk +3 lines, -3 lines 0 comments Download
M chrome/browser/renderer_host/test/site_instance_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/renderer_host/test/test_render_view_host.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/renderer_host/test/test_render_view_host.cc View 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/sessions/session_restore.cc View 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/sessions/tab_restore_service.h View 3 chunks +5 lines, -1 line 0 comments Download
M chrome/browser/sessions/tab_restore_service.cc View 4 chunks +8 lines, -3 lines 0 comments Download
M chrome/browser/sidebar/sidebar_container.cc View 1 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/tab_contents/background_contents.cc View 1 2 3 4 5 6 2 chunks +1 line, -6 lines 0 comments Download
M chrome/browser/tab_contents/match_preview.cc View 1 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/tab_contents/navigation_controller.h View 1 2 3 4 5 6 7 4 chunks +12 lines, -5 lines 0 comments Download
M chrome/browser/tab_contents/navigation_controller.cc View 1 2 3 4 5 6 5 chunks +9 lines, -13 lines 0 comments Download
M chrome/browser/tab_contents/navigation_controller_unittest.cc View 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/tab_contents/render_view_host_delegate_helper.cc View 1 2 3 4 5 6 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/tab_contents/render_view_host_manager.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/tab_contents/tab_contents.h View 1 2 3 4 5 6 7 2 chunks +8 lines, -1 line 0 comments Download
M chrome/browser/tab_contents/tab_contents.cc View 1 2 3 4 5 6 4 chunks +8 lines, -4 lines 0 comments Download
M chrome/browser/tab_contents/test_tab_contents.cc View 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/tabs/tab_strip_model_unittest.cc View 3 4 5 6 2 chunks +3 lines, -3 lines 0 comments Download
M chrome/browser/views/dom_view.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/chrome_browser.gypi View 1 2 3 4 5 6 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 10 (0 generated)
jorlow
This compiles and works. I'm going to investigate ways to test it (suggestions very welcome!) ...
10 years, 3 months ago (2010-09-03 18:46:24 UTC) #1
jorlow
It'd be really cool if someone could at least do a first pass before you ...
10 years, 3 months ago (2010-09-03 23:21:25 UTC) #2
jorlow
Joth, maybe you can take a first pass at this?
10 years, 3 months ago (2010-09-06 12:51:53 UTC) #3
jorlow
10 years, 3 months ago (2010-09-07 10:09:56 UTC) #4
brettw
http://codereview.chromium.org/3325012/diff/12001/11023 File chrome/browser/renderer_host/render_view_host.h (right): http://codereview.chromium.org/3325012/diff/12001/11023#newcode102 chrome/browser/renderer_host/render_view_host.h:102: // which case RenderWidgetHost will create a new one. ...
10 years, 3 months ago (2010-09-07 17:23:36 UTC) #5
jorlow
Done and done. Plus I think I fixed the unit test failures. Will re-upload in ...
10 years, 3 months ago (2010-09-08 18:34:35 UTC) #6
jorlow
Reminder: this is apparently a top crasher...
10 years, 3 months ago (2010-09-09 15:07:45 UTC) #7
brettw
LGTM with a few minor comments. I was waiting for Darin to look at this ...
10 years, 3 months ago (2010-09-12 17:05:11 UTC) #8
jorlow
On 2010/09/12 17:05:11, brettw wrote: > LGTM with a few minor comments. > > I ...
10 years, 3 months ago (2010-09-13 11:30:10 UTC) #9
brettw
10 years, 3 months ago (2010-09-13 15:37:45 UTC) #10
On Mon, Sep 13, 2010 at 4:30 AM,  <jorlow@chromium.org> wrote:
> On 2010/09/12 17:05:11, brettw wrote:
>>
>> LGTM with a few minor comments.
>
>> I was waiting for Darin to look at this since he has more background on
>> this
>> than I do. But I guess he's super busy these days. Sorry for the delay.
>
>> One thing I'm concerned about: what about when tabs are restored after you
>
> exit
>>
>> and start back up? I assume they should have the same namespace? Does this
>
> work
>>
>> today? It seems like not from my understanding of this, but I could be
>> wrong.
>
> If
>>
>> that's broken, we can solve it in another patch.
>
> Last time Darin and I talked (half a year ago), the thinking was that we
> should
> not write this information to disk, and thus we shouldn't support the
> restore
> after exit use case.  I forget all the details of what went into that
> decision,
> but I know this is what Safari does and I believe it's what firefox does.
>  There
> definitely are sites out there that make this assumption.  And I'm guessing
> this
> is what we do with stuff like session cookies as well?

Yes, that's fine then.

Brett

Powered by Google App Engine
This is Rietveld 408576698