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

Issue 7966020: [Sync] Fix Session's handling of windows. (Closed)

Created:
9 years, 3 months ago by Nicolas Zea
Modified:
9 years, 2 months ago
CC:
chromium-reviews, ncarter (slow), idana, Raghu Simha, Paweł Hajdan Jr., estade+watch_chromium.org, tim (not reviewing)
Visibility:
Public.

Description

[Sync] Fix Session's handling of windows. We previously made some false assumptions about the order of window id's, and freed memory for windows inappropriately. This would lead to memory corruption, usually seen in the form of accesses to bad TabNavigation objects in the session model associator. This patch completely rewrites how we handle synced windows. Because there's no real order to windows, we now store them in a map. In addition, because tabs can be moved between windows and we aren't explicitly told which windows were closed or which tabs were closed, we now have explicit tracking of the usage of windows and tabs, coupled with a garbage collection phase that frees those tabs/windows that weren't used during the tracking (see SyncedSessionTracker::ResetSessionTracking and CleanupSession methods). Due to the change in how we store windows, the integration tests and the sessions ui had to be modified, but the real changes are within the session model associator and the synced session tracker. Also, undisabled a test that should be working. BUG=94124, 81104 TEST=unit_tests; Opening windows with valid tabs, waiting for sync, closing those windows. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=103878

Patch Set 1 #

Patch Set 2 : Rebase #

Patch Set 3 : Fix perf tests #

Total comments: 10

Patch Set 4 : Address comments #

Patch Set 5 : fix typo #

Total comments: 8

Patch Set 6 : Comments #

Total comments: 6

Patch Set 7 : Comment. #

Patch Set 8 : Address comments #

Total comments: 52

Patch Set 9 : Refactor for clarity + address comments #

Patch Set 10 : Fix test #

Total comments: 23

Patch Set 11 : Comments #

Total comments: 6

Patch Set 12 : Fix nits, rebase. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1167 lines, -436 lines) Patch
M chrome/browser/sessions/session_restore.h View 1 2 3 4 5 6 7 8 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/sessions/session_restore.cc View 1 2 3 4 5 6 7 8 2 chunks +6 lines, -6 lines 0 comments Download
M chrome/browser/sync/glue/session_model_associator.h View 1 2 3 4 5 6 7 8 2 chunks +2 lines, -11 lines 0 comments Download
M chrome/browser/sync/glue/session_model_associator.cc View 1 2 3 4 5 6 7 8 9 10 14 chunks +39 lines, -75 lines 0 comments Download
M chrome/browser/sync/glue/session_model_associator_unittest.cc View 1 2 3 4 5 6 7 8 5 chunks +16 lines, -79 lines 0 comments Download
M chrome/browser/sync/glue/synced_session.h View 1 2 3 4 5 6 7 8 3 chunks +24 lines, -2 lines 0 comments Download
M chrome/browser/sync/glue/synced_session.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +33 lines, -1 line 0 comments Download
M chrome/browser/sync/glue/synced_session_tracker.h View 1 2 3 4 5 6 7 8 9 10 2 chunks +98 lines, -25 lines 0 comments Download
M chrome/browser/sync/glue/synced_session_tracker.cc View 1 2 3 4 5 6 7 8 4 chunks +201 lines, -54 lines 0 comments Download
A chrome/browser/sync/glue/synced_session_tracker_unittest.cc View 1 2 3 4 5 6 7 8 9 1 chunk +246 lines, -0 lines 0 comments Download
M chrome/browser/sync/profile_sync_service_session_unittest.cc View 1 5 chunks +333 lines, -58 lines 0 comments Download
M chrome/browser/sync/test/integration/multiple_client_sessions_sync_test.cc View 1 2 3 4 5 6 7 8 9 10 11 6 chunks +13 lines, -10 lines 0 comments Download
M chrome/browser/sync/test/integration/performance/sessions_sync_perf_test.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +4 lines, -2 lines 0 comments Download
M chrome/browser/sync/test/integration/sessions_helper.h View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +23 lines, -16 lines 0 comments Download
M chrome/browser/sync/test/integration/sessions_helper.cc View 1 2 3 4 5 6 7 8 9 10 11 10 chunks +58 lines, -46 lines 0 comments Download
M chrome/browser/sync/test/integration/single_client_sessions_sync_test.cc View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +7 lines, -5 lines 0 comments Download
M chrome/browser/sync/test/integration/two_client_sessions_sync_test.cc View 1 2 3 4 5 6 7 8 9 10 11 17 chunks +41 lines, -29 lines 0 comments Download
M chrome/browser/ui/webui/ntp/foreign_session_handler.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +7 lines, -7 lines 0 comments Download
M chrome/browser/ui/webui/sessions_ui.cc View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +13 lines, -8 lines 0 comments Download
M chrome/chrome_tests.gypi View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 21 (0 generated)
Nicolas Zea
9 years, 3 months ago (2011-09-22 21:13:47 UTC) #1
Nicolas Zea
also Yaron as FYI
9 years, 3 months ago (2011-09-22 23:19:34 UTC) #2
akalin
http://codereview.chromium.org/7966020/diff/5001/chrome/browser/sync/glue/session_model_associator.cc File chrome/browser/sync/glue/session_model_associator.cc (right): http://codereview.chromium.org/7966020/diff/5001/chrome/browser/sync/glue/session_model_associator.cc#newcode645 chrome/browser/sync/glue/session_model_associator.cc:645: size_t i, num_windows; int num_windows = header.window_size(); ... for ...
9 years, 2 months ago (2011-09-26 18:34:43 UTC) #3
Nicolas Zea
Comments addressed, PTAL http://codereview.chromium.org/7966020/diff/5001/chrome/browser/sync/glue/session_model_associator.cc File chrome/browser/sync/glue/session_model_associator.cc (right): http://codereview.chromium.org/7966020/diff/5001/chrome/browser/sync/glue/session_model_associator.cc#newcode645 chrome/browser/sync/glue/session_model_associator.cc:645: size_t i, num_windows; On 2011/09/26 18:34:44, ...
9 years, 2 months ago (2011-09-26 19:47:36 UTC) #4
akalin
Few more comments, still looking over it http://codereview.chromium.org/7966020/diff/11001/chrome/browser/sync/glue/synced_session.h File chrome/browser/sync/glue/synced_session.h (right): http://codereview.chromium.org/7966020/diff/11001/chrome/browser/sync/glue/synced_session.h#newcode45 chrome/browser/sync/glue/synced_session.h:45: // Map ...
9 years, 2 months ago (2011-09-26 21:57:23 UTC) #5
Nicolas Zea
Comments addressed, PTAL http://codereview.chromium.org/7966020/diff/11001/chrome/browser/sync/glue/synced_session.h File chrome/browser/sync/glue/synced_session.h (right): http://codereview.chromium.org/7966020/diff/11001/chrome/browser/sync/glue/synced_session.h#newcode45 chrome/browser/sync/glue/synced_session.h:45: // Map of windows that make ...
9 years, 2 months ago (2011-09-26 22:55:26 UTC) #6
akalin
http://codereview.chromium.org/7966020/diff/9004/chrome/browser/sync/glue/synced_session_tracker.cc File chrome/browser/sync/glue/synced_session_tracker.cc (right): http://codereview.chromium.org/7966020/diff/9004/chrome/browser/sync/glue/synced_session_tracker.cc#newcode151 chrome/browser/sync/glue/synced_session_tracker.cc:151: delete window_wrapper.window_ptr; the more I look over this CL ...
9 years, 2 months ago (2011-09-27 19:44:23 UTC) #7
Nicolas Zea
http://codereview.chromium.org/7966020/diff/9004/chrome/browser/sync/glue/synced_session_tracker.cc File chrome/browser/sync/glue/synced_session_tracker.cc (right): http://codereview.chromium.org/7966020/diff/9004/chrome/browser/sync/glue/synced_session_tracker.cc#newcode151 chrome/browser/sync/glue/synced_session_tracker.cc:151: delete window_wrapper.window_ptr; Yes, we do we have to track ...
9 years, 2 months ago (2011-09-27 20:12:13 UTC) #8
akalin
> This just deletes the maps, not the windows themselves (synced_window_map_ has a > session ...
9 years, 2 months ago (2011-09-28 23:08:29 UTC) #9
Nicolas Zea
Fair enough, done. PTAL
9 years, 2 months ago (2011-09-29 00:51:29 UTC) #10
akalin
Okay, I think I finally grok this. I think my main problem was that the ...
9 years, 2 months ago (2011-09-29 21:59:54 UTC) #11
Nicolas Zea
All comments addressed, PTAL http://codereview.chromium.org/7966020/diff/23001/chrome/browser/sync/glue/synced_session_tracker.cc File chrome/browser/sync/glue/synced_session_tracker.cc (right): http://codereview.chromium.org/7966020/diff/23001/chrome/browser/sync/glue/synced_session_tracker.cc#newcode26 chrome/browser/sync/glue/synced_session_tracker.cc:26: // Fill vector of sessions ...
9 years, 2 months ago (2011-09-30 22:52:54 UTC) #12
akalin
More comments. How urgent is this CL? If this needs to go in soon, we ...
9 years, 2 months ago (2011-10-01 01:54:14 UTC) #13
akalin
http://codereview.chromium.org/7966020/diff/33021/chrome/browser/sync/glue/synced_session_tracker.h File chrome/browser/sync/glue/synced_session_tracker.h (right): http://codereview.chromium.org/7966020/diff/33021/chrome/browser/sync/glue/synced_session_tracker.h#newcode39 chrome/browser/sync/glue/synced_session_tracker.h:39: bool LookupAllForeignSessions(std::vector<const SyncedSession*>* sessions) On 2011/10/01 01:54:14, akalin wrote: ...
9 years, 2 months ago (2011-10-01 01:57:15 UTC) #14
Nicolas Zea
I see what you mean, but I think that's now getting into a larger refactor ...
9 years, 2 months ago (2011-10-03 18:36:50 UTC) #15
Nicolas Zea
Also filed crbug.com/98892 to cover the move to the new API and refactoring the population ...
9 years, 2 months ago (2011-10-03 18:39:43 UTC) #16
akalin
On 2011/10/03 18:36:50, nzea wrote: > I see what you mean, but I think that's ...
9 years, 2 months ago (2011-10-03 18:42:15 UTC) #17
akalin
LGTM after nits http://codereview.chromium.org/7966020/diff/37001/chrome/browser/sync/glue/synced_session.cc File chrome/browser/sync/glue/synced_session.cc (right): http://codereview.chromium.org/7966020/diff/37001/chrome/browser/sync/glue/synced_session.cc#newcode49 chrome/browser/sync/glue/synced_session.cc:49: if (num_populated == 0) return (num_populated ...
9 years, 2 months ago (2011-10-03 18:50:21 UTC) #18
Nicolas Zea
Done. Committing once bots go green. http://codereview.chromium.org/7966020/diff/37001/chrome/browser/sync/glue/synced_session.cc File chrome/browser/sync/glue/synced_session.cc (right): http://codereview.chromium.org/7966020/diff/37001/chrome/browser/sync/glue/synced_session.cc#newcode49 chrome/browser/sync/glue/synced_session.cc:49: if (num_populated == ...
9 years, 2 months ago (2011-10-03 19:36:15 UTC) #19
commit-bot: I haz the power
CQ is trying the patch. Follow status at https://chromium-status.appspot.com/cq/zea@chromium.org/7966020/41002
9 years, 2 months ago (2011-10-03 21:08:21 UTC) #20
commit-bot: I haz the power
9 years, 2 months ago (2011-10-04 13:43:14 UTC) #21
Change committed as 103878

Powered by Google App Engine
This is Rietveld 408576698