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

Issue 2200993004: Make TabRestoreService::Entry noncopyable and fix up surrounding code. (Closed)

Created:
4 years, 4 months ago by Sidney San Martín
Modified:
4 years, 4 months ago
Reviewers:
sky
CC:
chromium-reviews, chromium-apps-reviews_chromium.org, jam, darin-cc_chromium.org, extensions-reviews_chromium.org, Robert Sesek, blundell
Base URL:
https://chromium.googlesource.com/chromium/src.git@tab-test-cleanup
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Make TabRestoreService::Entry noncopyable and fix up surrounding code. Instances of TabRestoreService::Entry (Window and Tab) were managed by hand, and had special support for copying even though they never actually need to be copied. This refactor starts by making Entry noncopyable and branches out. Bigger changes: - Entry is noncopyable. PlatformSpecificTabData::Clone is gone. - Entry is usually wrapped in unique_ptr, including inside collections. - [Important] ValidateEntry/ValidateTab/ValidateWindow take const references and return a result. They don't try to fix damaged entries. Smaller changes: - Entry is taken by const reference whenever possible, not const pointer or non-const pointer/reference. - ifs that check if an entry is a Tab and assume it's a Window otherwise are now switch statements. - Loops that iterate over collections of Entry are range-based when appropriate. BUG=633689 Committed: https://crrev.com/7710d22ccb2ffb236be1bc99d91e5ed5f7483a13 Cr-Commit-Position: refs/heads/master@{#410655}

Patch Set 1 #

Patch Set 2 : Fix tests and crash #

Patch Set 3 : Delete a unit test that just tested things I removed #

Patch Set 4 : Add back NOTREACHED() and a return for gcc #

Total comments: 23

Patch Set 5 : clang-format, members back to int, style fixes, non-Mac build fixes #

Patch Set 6 : type back to member variable, use = for initialization, build fixes #

Patch Set 7 : Non-Mac build fixes, style tweaks #

Patch Set 8 : Eliminate a use-after-free, Windows build fix #

Total comments: 20

Patch Set 9 : Simplify my RemoveEntryByID refactor, will revisit in another CL #

Patch Set 10 : Get session ID from entries, take tabs' active status directly instead of an index #

Unified diffs Side-by-side diffs Delta from patch set Stats (+468 lines, -701 lines) Patch
M chrome/browser/android/recently_closed_tabs_bridge.cc View 1 2 3 4 5 6 7 8 2 chunks +8 lines, -11 lines 0 comments Download
M chrome/browser/extensions/api/sessions/sessions_api.h View 1 2 3 4 5 6 7 8 9 2 chunks +4 lines, -6 lines 0 comments Download
M chrome/browser/extensions/api/sessions/sessions_api.cc View 1 2 3 4 5 6 7 8 9 10 chunks +36 lines, -54 lines 0 comments Download
M chrome/browser/sessions/persistent_tab_restore_service_browsertest.cc View 1 2 3 4 5 6 1 chunk +2 lines, -3 lines 0 comments Download
M chrome/browser/sessions/persistent_tab_restore_service_unittest.cc View 1 2 3 4 5 6 16 chunks +57 lines, -53 lines 0 comments Download
M chrome/browser/sessions/session_restore_browsertest.cc View 1 2 3 4 5 6 3 chunks +7 lines, -8 lines 0 comments Download
M chrome/browser/sessions/tab_restore_browsertest.cc View 1 2 3 4 5 6 7 2 chunks +7 lines, -6 lines 0 comments Download
M chrome/browser/ui/cocoa/history_menu_bridge.mm View 1 2 3 4 5 6 3 chunks +11 lines, -14 lines 0 comments Download
M chrome/browser/ui/cocoa/history_menu_bridge_unittest.mm View 1 2 3 4 5 6 7 8 4 chunks +5 lines, -13 lines 0 comments Download
M chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc View 1 2 3 4 5 6 1 chunk +22 lines, -21 lines 0 comments Download
M chrome/browser/ui/views/frame/global_menu_bar_x11.cc View 1 2 3 4 5 6 2 chunks +4 lines, -6 lines 0 comments Download
M chrome/browser/win/jumplist.h View 1 2 3 4 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/win/jumplist.cc View 1 2 3 4 5 4 chunks +17 lines, -18 lines 0 comments Download
M components/sessions/BUILD.gn View 1 2 1 chunk +0 lines, -1 line 0 comments Download
M components/sessions/content/content_live_tab.cc View 1 chunk +2 lines, -2 lines 0 comments Download
M components/sessions/content/content_platform_specific_tab_data.h View 1 2 3 4 5 6 1 chunk +0 lines, -3 lines 0 comments Download
M components/sessions/content/content_platform_specific_tab_data.cc View 1 chunk +0 lines, -7 lines 0 comments Download
M components/sessions/core/in_memory_tab_restore_service.h View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M components/sessions/core/in_memory_tab_restore_service.cc View 1 2 3 4 1 chunk +2 lines, -2 lines 0 comments Download
M components/sessions/core/persistent_tab_restore_service.h View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M components/sessions/core/persistent_tab_restore_service.cc View 1 2 3 4 5 6 7 8 9 20 chunks +95 lines, -118 lines 0 comments Download
M components/sessions/core/tab_restore_service.h View 1 2 3 4 5 6 chunks +17 lines, -26 lines 0 comments Download
M components/sessions/core/tab_restore_service.cc View 1 2 3 4 5 6 7 8 1 chunk +6 lines, -63 lines 0 comments Download
M components/sessions/core/tab_restore_service_helper.h View 1 2 3 4 4 chunks +14 lines, -15 lines 0 comments Download
M components/sessions/core/tab_restore_service_helper.cc View 1 2 3 4 5 6 7 14 chunks +148 lines, -184 lines 0 comments Download
D components/sessions/core/tab_restore_service_unittest.cc View 1 2 1 chunk +0 lines, -63 lines 0 comments Download

Messages

Total messages: 58 (41 generated)
Sidney San Martín
4 years, 4 months ago (2016-08-02 21:15:01 UTC) #5
sky
https://codereview.chromium.org/2200993004/diff/60001/chrome/browser/extensions/api/sessions/sessions_api.cc File chrome/browser/extensions/api/sessions/sessions_api.cc (right): https://codereview.chromium.org/2200993004/diff/60001/chrome/browser/extensions/api/sessions/sessions_api.cc#newcode230 chrome/browser/extensions/api/sessions/sessions_api.cc:230: for (const auto &entry : tab_restore_service->entries()) { 'auto &' ...
4 years, 4 months ago (2016-08-02 23:12:31 UTC) #12
Sidney San Martín
Changed most of these, waiting for clarification on a couple. https://codereview.chromium.org/2200993004/diff/60001/chrome/browser/extensions/api/sessions/sessions_api.cc File chrome/browser/extensions/api/sessions/sessions_api.cc (right): https://codereview.chromium.org/2200993004/diff/60001/chrome/browser/extensions/api/sessions/sessions_api.cc#newcode230 ...
4 years, 4 months ago (2016-08-03 14:35:32 UTC) #15
sky
https://codereview.chromium.org/2200993004/diff/60001/components/sessions/core/tab_restore_service.h File components/sessions/core/tab_restore_service.h (right): https://codereview.chromium.org/2200993004/diff/60001/components/sessions/core/tab_restore_service.h#newcode57 components/sessions/core/tab_restore_service.h:57: virtual Type type() const = 0; On 2016/08/03 14:35:32, ...
4 years, 4 months ago (2016-08-03 15:16:08 UTC) #18
Sidney San Martín
https://codereview.chromium.org/2200993004/diff/60001/components/sessions/core/tab_restore_service.h File components/sessions/core/tab_restore_service.h (right): https://codereview.chromium.org/2200993004/diff/60001/components/sessions/core/tab_restore_service.h#newcode57 components/sessions/core/tab_restore_service.h:57: virtual Type type() const = 0; On 2016/08/03 15:16:07, ...
4 years, 4 months ago (2016-08-03 15:50:23 UTC) #19
sky
On Wed, Aug 3, 2016 at 8:50 AM, <sdy@chromium.org> wrote: > > https://codereview.chromium.org/2200993004/diff/60001/components/sessions/core/tab_restore_service.h > File ...
4 years, 4 months ago (2016-08-03 19:36:15 UTC) #27
Sidney San Martín
This should address your comments so far, and I got rid of a few unnecessary ...
4 years, 4 months ago (2016-08-04 04:24:57 UTC) #38
sky
https://codereview.chromium.org/2200993004/diff/220001/chrome/browser/extensions/api/sessions/sessions_api.cc File chrome/browser/extensions/api/sessions/sessions_api.cc (right): https://codereview.chromium.org/2200993004/diff/220001/chrome/browser/extensions/api/sessions/sessions_api.cc#newcode153 chrome/browser/extensions/api/sessions/sessions_api.cc:153: int session_id, While you're cleaning up it seems like ...
4 years, 4 months ago (2016-08-04 16:34:39 UTC) #39
Sidney San Martín
https://codereview.chromium.org/2200993004/diff/220001/components/sessions/core/persistent_tab_restore_service.cc File components/sessions/core/persistent_tab_restore_service.cc (right): https://codereview.chromium.org/2200993004/diff/220001/components/sessions/core/persistent_tab_restore_service.cc#newcode568 components/sessions/core/persistent_tab_restore_service.cc:568: class RemoveByIDIndex { On 2016/08/04 16:34:39, sky wrote: > ...
4 years, 4 months ago (2016-08-04 17:04:50 UTC) #40
sky
https://codereview.chromium.org/2200993004/diff/220001/components/sessions/core/persistent_tab_restore_service.cc File components/sessions/core/persistent_tab_restore_service.cc (right): https://codereview.chromium.org/2200993004/diff/220001/components/sessions/core/persistent_tab_restore_service.cc#newcode568 components/sessions/core/persistent_tab_restore_service.cc:568: class RemoveByIDIndex { On 2016/08/04 17:04:50, Sidney San Martín ...
4 years, 4 months ago (2016-08-04 19:09:52 UTC) #41
Sidney San Martín
https://codereview.chromium.org/2200993004/diff/220001/components/sessions/core/persistent_tab_restore_service.cc File components/sessions/core/persistent_tab_restore_service.cc (right): https://codereview.chromium.org/2200993004/diff/220001/components/sessions/core/persistent_tab_restore_service.cc#newcode568 components/sessions/core/persistent_tab_restore_service.cc:568: class RemoveByIDIndex { On 2016/08/04 19:09:52, sky wrote: > ...
4 years, 4 months ago (2016-08-04 20:17:19 UTC) #42
sky
https://codereview.chromium.org/2200993004/diff/220001/components/sessions/core/persistent_tab_restore_service.cc File components/sessions/core/persistent_tab_restore_service.cc (right): https://codereview.chromium.org/2200993004/diff/220001/components/sessions/core/persistent_tab_restore_service.cc#newcode568 components/sessions/core/persistent_tab_restore_service.cc:568: class RemoveByIDIndex { On 2016/08/04 20:17:19, Sidney San Martín ...
4 years, 4 months ago (2016-08-04 22:57:12 UTC) #43
Sidney San Martín
Addressed this round of comments. Take a look when you have a chance! https://codereview.chromium.org/2200993004/diff/220001/chrome/browser/extensions/api/sessions/sessions_api.cc File ...
4 years, 4 months ago (2016-08-09 04:10:53 UTC) #48
sky
LGTM - nice cleanup!
4 years, 4 months ago (2016-08-09 13:29:30 UTC) #51
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2200993004/290001
4 years, 4 months ago (2016-08-09 14:00:46 UTC) #54
commit-bot: I haz the power
Committed patchset #10 (id:290001)
4 years, 4 months ago (2016-08-09 14:04:50 UTC) #56
commit-bot: I haz the power
4 years, 4 months ago (2016-08-09 14:06:59 UTC) #58
Message was sent while issue was closed.
Patchset 10 (id:??) landed as
https://crrev.com/7710d22ccb2ffb236be1bc99d91e5ed5f7483a13
Cr-Commit-Position: refs/heads/master@{#410655}

Powered by Google App Engine
This is Rietveld 408576698