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

Issue 1708343002: Add ScopedKeepAlive to c/b/lifetime (Closed)

Created:
4 years, 10 months ago by dgn
Modified:
4 years, 10 months ago
Reviewers:
Bernhard Bauer, sky
CC:
chromium-reviews, tapted, jennb, sadrul, Matt Giuca, extensions-reviews_chromium.org, tfarina, Dmitry Titov, dcheng, jianli, kalyank, chromium-apps-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add ScopedKeepAlive to c/b/lifetime It moves from c/b/apps as it can be reused more generally across //chrome/browser. It works with the new KeepAliveRegistry which is the class keeping all the relevant information in an accessible place. This patch also reuses ScopedKeepAlive instead of c/b/ui/views/AutoKeepAlive BUG=587926 Committed: https://crrev.com/3d351ad181e54a67ef212132ffa1825ab19448e1 Cr-Commit-Position: refs/heads/master@{#377913}

Patch Set 1 #

Patch Set 2 : Fix compilation on chromeos, androis and some tests #

Patch Set 3 : Use singleton instead of browserprocess #

Total comments: 31

Patch Set 4 : #

Patch Set 5 : Address comments on patch 3 (pt 1) #

Patch Set 6 : Remove optimization related code. It will be handled in a separate CL #

Patch Set 7 : #

Total comments: 16

Patch Set 8 : Address PS7 comments, replace strings by a struct ptr, chromeappdelegate ctor takes a boolean #

Total comments: 10

Patch Set 9 : Address comments #

Total comments: 2

Patch Set 10 : remove mentions of keepalive count in bgmm #

Patch Set 11 : Use enums instead of strings #

Patch Set 12 : #

Total comments: 5

Patch Set 13 : address comments #

Total comments: 5

Patch Set 14 : Add unit tests #

Patch Set 15 : Use a map and counts #

Total comments: 8

Patch Set 16 : Address comments on PS15 #

Total comments: 16

Patch Set 17 : Address comments #

Patch Set 18 : Remove KeepAliveOrigin::TEST #

Unified diffs Side-by-side diffs Delta from patch set Stats (+343 lines, -168 lines) Patch
M chrome/browser/apps/app_browsertest_util.cc View 1 2 3 4 5 6 7 2 chunks +2 lines, -5 lines 0 comments Download
D chrome/browser/apps/scoped_keep_alive.h View 1 chunk +0 lines, -20 lines 0 comments Download
D chrome/browser/apps/scoped_keep_alive.cc View 1 chunk +0 lines, -19 lines 0 comments Download
M chrome/browser/background/background_mode_manager.h View 1 2 3 4 5 6 7 8 9 4 chunks +11 lines, -5 lines 0 comments Download
M chrome/browser/background/background_mode_manager.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 8 chunks +20 lines, -19 lines 0 comments Download
M chrome/browser/extensions/api/tabs/tabs_api.cc View 1 2 3 4 5 6 7 2 chunks +1 line, -4 lines 0 comments Download
M chrome/browser/guest_view/app_view/chrome_app_view_guest_delegate.cc View 1 2 3 4 5 6 7 2 chunks +1 line, -2 lines 0 comments Download
M chrome/browser/lifetime/application_lifetime.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +3 lines, -0 lines 0 comments Download
M chrome/browser/lifetime/application_lifetime.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +4 lines, -0 lines 0 comments Download
A chrome/browser/lifetime/keep_alive_registry.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +43 lines, -0 lines 0 comments Download
A chrome/browser/lifetime/keep_alive_registry.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +51 lines, -0 lines 0 comments Download
A chrome/browser/lifetime/keep_alive_registry_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +59 lines, -0 lines 0 comments Download
A chrome/browser/lifetime/keep_alive_types.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +27 lines, -0 lines 0 comments Download
A chrome/browser/lifetime/keep_alive_types.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +30 lines, -0 lines 0 comments Download
A chrome/browser/lifetime/scoped_keep_alive.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +25 lines, -0 lines 0 comments Download
A chrome/browser/lifetime/scoped_keep_alive.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +16 lines, -0 lines 0 comments Download
M chrome/browser/power/process_power_collector_unittest.cc View 1 2 3 4 5 6 7 2 chunks +1 line, -3 lines 0 comments Download
M chrome/browser/ui/app_list/app_list_service_views.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +3 lines, -2 lines 0 comments Download
M chrome/browser/ui/app_list/app_list_shower_views.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +3 lines, -2 lines 0 comments Download
M chrome/browser/ui/app_list/app_list_shower_views_unittest.cc View 1 2 3 4 5 6 7 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/ui/app_list/app_list_view_delegate.cc View 1 2 3 4 5 6 7 2 chunks +2 lines, -3 lines 0 comments Download
M chrome/browser/ui/app_list/profile_loader.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +3 lines, -2 lines 0 comments Download
M chrome/browser/ui/apps/chrome_app_delegate.h View 1 2 3 4 5 6 7 1 chunk +3 lines, -3 lines 0 comments Download
M chrome/browser/ui/apps/chrome_app_delegate.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +8 lines, -4 lines 0 comments Download
M chrome/browser/ui/apps/chrome_app_window_client.cc View 1 2 3 4 5 6 7 2 chunks +2 lines, -5 lines 0 comments Download
M chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc View 1 2 3 4 5 6 7 2 chunks +3 lines, -5 lines 0 comments Download
M chrome/browser/ui/views/app_list/linux/app_list_service_linux.cc View 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/ui/views/auto_keep_alive.h View 1 2 3 4 5 6 7 1 chunk +0 lines, -23 lines 0 comments Download
M chrome/browser/ui/views/auto_keep_alive.cc View 1 2 3 4 5 6 7 1 chunk +0 lines, -27 lines 0 comments Download
M chrome/browser/ui/views/panels/panel_view.h View 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/ui/views/panels/panel_view.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 chunks +6 lines, -2 lines 0 comments Download
M chrome/browser/ui/views/profiles/user_manager_view.h View 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/ui/views/profiles/user_manager_view.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 3 chunks +5 lines, -3 lines 0 comments Download
M chrome/chrome_browser.gypi View 1 2 3 4 5 6 7 8 9 10 1 chunk +6 lines, -0 lines 0 comments Download
M chrome/chrome_browser_extensions.gypi View 1 2 3 4 5 6 7 1 chunk +0 lines, -2 lines 0 comments Download
M chrome/chrome_browser_ui.gypi View 1 2 3 4 5 6 7 1 chunk +0 lines, -2 lines 0 comments Download
M chrome/chrome_tests_unit.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +1 line, -0 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 34 (4 generated)
dgn
PTAL
4 years, 10 months ago (2016-02-19 17:16:18 UTC) #2
Bernhard Bauer
https://codereview.chromium.org/1708343002/diff/40001/chrome/browser/background/background_mode_manager.cc File chrome/browser/background/background_mode_manager.cc (right): https://codereview.chromium.org/1708343002/diff/40001/chrome/browser/background/background_mode_manager.cc#newcode766 chrome/browser/background/background_mode_manager.cc:766: keep_alive_.reset(new ScopedKeepAlive( Nit: braces https://codereview.chromium.org/1708343002/diff/40001/chrome/browser/background/background_mode_manager.cc#newcode774 chrome/browser/background/background_mode_manager.cc:774: keep_alive_.reset(); You can ...
4 years, 10 months ago (2016-02-19 17:39:28 UTC) #3
dgn
https://codereview.chromium.org/1708343002/diff/40001/chrome/browser/background/background_mode_manager.cc File chrome/browser/background/background_mode_manager.cc (right): https://codereview.chromium.org/1708343002/diff/40001/chrome/browser/background/background_mode_manager.cc#newcode766 chrome/browser/background/background_mode_manager.cc:766: keep_alive_.reset(new ScopedKeepAlive( On 2016/02/19 17:39:28, Bernhard Bauer wrote: > ...
4 years, 10 months ago (2016-02-19 18:04:28 UTC) #4
dgn
sky@chromium.org: PTAL. This is the first part of the KeepAlive unification changes. I plan to ...
4 years, 10 months ago (2016-02-19 19:14:23 UTC) #6
sky
I'm also not a fan of the random strings everywhere. WDYT of an enum? https://codereview.chromium.org/1708343002/diff/120001/chrome/browser/background/background_mode_manager.cc ...
4 years, 10 months ago (2016-02-19 21:02:49 UTC) #7
dgn
PTAL I replaced the strings by struct pointers. These structs have a label member that ...
4 years, 10 months ago (2016-02-22 18:01:20 UTC) #8
Bernhard Bauer
https://codereview.chromium.org/1708343002/diff/40001/chrome/browser/lifetime/keep_alive_registry.h File chrome/browser/lifetime/keep_alive_registry.h (right): https://codereview.chromium.org/1708343002/diff/40001/chrome/browser/lifetime/keep_alive_registry.h#newcode20 chrome/browser/lifetime/keep_alive_registry.h:20: class KeepAliveRegistry { On 2016/02/19 18:04:28, dgn wrote: > ...
4 years, 10 months ago (2016-02-22 18:19:38 UTC) #9
dgn
https://codereview.chromium.org/1708343002/diff/40001/chrome/browser/lifetime/keep_alive_registry.h File chrome/browser/lifetime/keep_alive_registry.h (right): https://codereview.chromium.org/1708343002/diff/40001/chrome/browser/lifetime/keep_alive_registry.h#newcode20 chrome/browser/lifetime/keep_alive_registry.h:20: class KeepAliveRegistry { On 2016/02/22 18:19:38, Bernhard Bauer wrote: ...
4 years, 10 months ago (2016-02-22 19:07:19 UTC) #10
sky
https://codereview.chromium.org/1708343002/diff/160001/chrome/browser/lifetime/keep_alive_options.h File chrome/browser/lifetime/keep_alive_options.h (right): https://codereview.chromium.org/1708343002/diff/160001/chrome/browser/lifetime/keep_alive_options.h#newcode11 chrome/browser/lifetime/keep_alive_options.h:11: const char* label; Can you explain why a string ...
4 years, 10 months ago (2016-02-22 21:26:05 UTC) #11
dgn
https://codereview.chromium.org/1708343002/diff/160001/chrome/browser/lifetime/keep_alive_options.h File chrome/browser/lifetime/keep_alive_options.h (right): https://codereview.chromium.org/1708343002/diff/160001/chrome/browser/lifetime/keep_alive_options.h#newcode11 chrome/browser/lifetime/keep_alive_options.h:11: const char* label; On 2016/02/22 21:26:05, sky wrote: > ...
4 years, 10 months ago (2016-02-23 12:58:06 UTC) #12
sky
Maintaining the centralized lists feels no different than centralizing the switches. I prefer the enum, ...
4 years, 10 months ago (2016-02-23 21:16:24 UTC) #13
dgn
On 2016/02/23 21:16:24, sky wrote: > Maintaining the centralized lists feels no different than centralizing ...
4 years, 10 months ago (2016-02-23 23:24:31 UTC) #14
sky
https://codereview.chromium.org/1708343002/diff/220001/chrome/browser/lifetime/keep_alive_types.h File chrome/browser/lifetime/keep_alive_types.h (right): https://codereview.chromium.org/1708343002/diff/220001/chrome/browser/lifetime/keep_alive_types.h#newcode14 chrome/browser/lifetime/keep_alive_types.h:14: kBackgroundModeManager, enums are ALL_CAPS. https://codereview.chromium.org/1708343002/diff/220001/chrome/browser/lifetime/keep_alive_types.h#newcode27 chrome/browser/lifetime/keep_alive_types.h:27: struct KeepAliveParams { ...
4 years, 10 months ago (2016-02-24 05:08:23 UTC) #15
dgn
PTAL https://codereview.chromium.org/1708343002/diff/220001/chrome/browser/lifetime/keep_alive_types.h File chrome/browser/lifetime/keep_alive_types.h (right): https://codereview.chromium.org/1708343002/diff/220001/chrome/browser/lifetime/keep_alive_types.h#newcode10 chrome/browser/lifetime/keep_alive_types.h:10: namespace keep_alive { I plan to add the ...
4 years, 10 months ago (2016-02-24 11:24:04 UTC) #16
sky
https://codereview.chromium.org/1708343002/diff/120001/chrome/browser/lifetime/keep_alive_registry.h File chrome/browser/lifetime/keep_alive_registry.h (right): https://codereview.chromium.org/1708343002/diff/120001/chrome/browser/lifetime/keep_alive_registry.h#newcode27 chrome/browser/lifetime/keep_alive_registry.h:27: std::multiset<std::string> registered_tokens_; On 2016/02/22 18:01:20, dgn wrote: > On ...
4 years, 10 months ago (2016-02-24 18:53:21 UTC) #17
dgn
https://codereview.chromium.org/1708343002/diff/120001/chrome/browser/lifetime/keep_alive_registry.h File chrome/browser/lifetime/keep_alive_registry.h (right): https://codereview.chromium.org/1708343002/diff/120001/chrome/browser/lifetime/keep_alive_registry.h#newcode27 chrome/browser/lifetime/keep_alive_registry.h:27: std::multiset<std::string> registered_tokens_; On 2016/02/24 18:53:21, sky wrote: > On ...
4 years, 10 months ago (2016-02-24 19:55:45 UTC) #18
sky
Why not a total count separate from the map then? -Scott On Wed, Feb 24, ...
4 years, 10 months ago (2016-02-24 20:01:26 UTC) #19
dgn
On 2016/02/24 20:01:26, sky wrote: > Why not a total count separate from the map ...
4 years, 10 months ago (2016-02-24 20:14:05 UTC) #20
dgn
PTAL https://codereview.chromium.org/1708343002/diff/120001/chrome/browser/lifetime/keep_alive_registry.h File chrome/browser/lifetime/keep_alive_registry.h (right): https://codereview.chromium.org/1708343002/diff/120001/chrome/browser/lifetime/keep_alive_registry.h#newcode27 chrome/browser/lifetime/keep_alive_registry.h:27: std::multiset<std::string> registered_tokens_; On 2016/02/24 19:55:45, dgn wrote: > ...
4 years, 10 months ago (2016-02-24 21:04:18 UTC) #21
sky
https://codereview.chromium.org/1708343002/diff/240001/chrome/browser/lifetime/keep_alive_types.h File chrome/browser/lifetime/keep_alive_types.h (right): https://codereview.chromium.org/1708343002/diff/240001/chrome/browser/lifetime/keep_alive_types.h#newcode27 chrome/browser/lifetime/keep_alive_types.h:27: #ifndef NDEBUG On 2016/02/24 21:04:18, dgn wrote: > On ...
4 years, 10 months ago (2016-02-25 00:25:18 UTC) #22
dgn
PTAL https://codereview.chromium.org/1708343002/diff/280001/chrome/browser/lifetime/keep_alive_registry.cc File chrome/browser/lifetime/keep_alive_registry.cc (right): https://codereview.chromium.org/1708343002/diff/280001/chrome/browser/lifetime/keep_alive_registry.cc#newcode55 chrome/browser/lifetime/keep_alive_registry.cc:55: --registered_keep_alives_[origin]; On 2016/02/25 00:25:18, sky wrote: > remove ...
4 years, 10 months ago (2016-02-25 17:19:46 UTC) #23
sky
https://codereview.chromium.org/1708343002/diff/300001/chrome/browser/lifetime/keep_alive_registry.cc File chrome/browser/lifetime/keep_alive_registry.cc (right): https://codereview.chromium.org/1708343002/diff/300001/chrome/browser/lifetime/keep_alive_registry.cc#newcode36 chrome/browser/lifetime/keep_alive_registry.cc:36: auto count_per_origin_it = registered_keep_alives_.find(origin); Is there a reason you ...
4 years, 10 months ago (2016-02-25 18:43:50 UTC) #24
dgn
https://codereview.chromium.org/1708343002/diff/300001/chrome/browser/lifetime/keep_alive_registry.cc File chrome/browser/lifetime/keep_alive_registry.cc (right): https://codereview.chromium.org/1708343002/diff/300001/chrome/browser/lifetime/keep_alive_registry.cc#newcode36 chrome/browser/lifetime/keep_alive_registry.cc:36: auto count_per_origin_it = registered_keep_alives_.find(origin); On 2016/02/25 18:43:50, sky wrote: ...
4 years, 10 months ago (2016-02-25 20:08:50 UTC) #25
sky
https://codereview.chromium.org/1708343002/diff/300001/chrome/browser/ui/views/panels/panel_view.cc File chrome/browser/ui/views/panels/panel_view.cc (right): https://codereview.chromium.org/1708343002/diff/300001/chrome/browser/ui/views/panels/panel_view.cc#newcode304 chrome/browser/ui/views/panels/panel_view.cc:304: #if !defined(OS_CHROMEOS) On 2016/02/25 20:08:50, dgn wrote: > On ...
4 years, 10 months ago (2016-02-25 23:27:49 UTC) #26
dgn
PTAL https://codereview.chromium.org/1708343002/diff/300001/chrome/browser/lifetime/keep_alive_registry.cc File chrome/browser/lifetime/keep_alive_registry.cc (right): https://codereview.chromium.org/1708343002/diff/300001/chrome/browser/lifetime/keep_alive_registry.cc#newcode36 chrome/browser/lifetime/keep_alive_registry.cc:36: auto count_per_origin_it = registered_keep_alives_.find(origin); On 2016/02/25 20:08:49, dgn ...
4 years, 10 months ago (2016-02-26 11:51:59 UTC) #27
sky
LGTM
4 years, 10 months ago (2016-02-26 15:59:39 UTC) #28
dgn
On 2016/02/26 15:59:39, sky wrote: > LGTM Woohoo! Thanks for the prompt reviews!
4 years, 10 months ago (2016-02-26 16:02:07 UTC) #29
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1708343002/340001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1708343002/340001
4 years, 10 months ago (2016-02-26 16:02:51 UTC) #31
commit-bot: I haz the power
Committed patchset #18 (id:340001)
4 years, 10 months ago (2016-02-26 17:36:53 UTC) #32
commit-bot: I haz the power
4 years, 10 months ago (2016-02-26 17:38:59 UTC) #34
Message was sent while issue was closed.
Patchset 18 (id:??) landed as
https://crrev.com/3d351ad181e54a67ef212132ffa1825ab19448e1
Cr-Commit-Position: refs/heads/master@{#377913}

Powered by Google App Engine
This is Rietveld 408576698