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

Issue 23592017: Fix policy invalidator lifecycle bugs for Android. (Closed)

Created:
7 years, 3 months ago by Steve Condie
Modified:
7 years, 3 months ago
CC:
chromium-reviews, stevenjb+watch_chromium.org, davemoore+watch_chromium.org, oshima+watch_chromium.org, nkostylev+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Visibility:
Public.

Description

Fix policy invalidator lifecycle bugs for Android. On Android, the user may disconnect from their Google account and reconnect multiple times within the same session. This case wasn't considered properly when developing the CloudPolicyInvalidator. When the account is disconnected, the CloudPolicyCore is disconnected before the CloudPolicyStore is reset. When the store is reset, the invalidator unregisters for the policy object and makes a callback to indicate that invalidations are disabled. However, since the CloudPolicyCore is disconnected at this point, a crash is occurring because the code blindly attempts to use objects connected to the core. Also, when the account becomes reconnected, the refresh scheduler is restarted. This caused the invalidator to be initialized again, which is unexpected. The solution to these issues is to refactor the CloudPolicyInvalidator to support starting and stopping. The invalidator will listen to events published by the CloudPolicyCore to determine when to start and stop. The invalidator starts when the refresh scheduler starts and stops when it stops. Also, when CloudPolicyInvalidator::Shutdown is called, outstanding weak pointers held in callbacks should be invalidated. This may not cause any issues since it is likely no messages are pumped on the thread in between the calls to Shutdown and the destructor, but should be fixed. BUG=280345, 272574, 280536 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=221837

Patch Set 1 #

Patch Set 2 : #

Total comments: 8

Patch Set 3 : #

Patch Set 4 : #

Total comments: 24

Patch Set 5 : #

Patch Set 6 : #

Total comments: 8

Patch Set 7 : #

Total comments: 2

Patch Set 8 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+489 lines, -467 lines) Patch
M chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.cc View 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/policy/cloud/DEPS View 2 chunks +1 line, -1 line 0 comments Download
M chrome/browser/policy/cloud/cloud_policy_core.h View 1 2 3 4 4 chunks +23 lines, -0 lines 0 comments Download
M chrome/browser/policy/cloud/cloud_policy_core.cc View 1 2 3 4 4 chunks +14 lines, -0 lines 0 comments Download
M chrome/browser/policy/cloud/cloud_policy_core_unittest.cc View 1 2 3 4 4 chunks +56 lines, -2 lines 0 comments Download
M chrome/browser/policy/cloud/cloud_policy_invalidator.h View 1 2 3 4 5 6 7 7 chunks +37 lines, -66 lines 0 comments Download
M chrome/browser/policy/cloud/cloud_policy_invalidator.cc View 1 2 3 4 5 6 7 9 chunks +63 lines, -63 lines 0 comments Download
M chrome/browser/policy/cloud/cloud_policy_invalidator_unittest.cc View 1 2 3 4 5 6 7 16 chunks +268 lines, -167 lines 0 comments Download
M chrome/browser/policy/cloud/cloud_policy_manager.h View 1 2 5 chunks +1 line, -27 lines 0 comments Download
M chrome/browser/policy/cloud/cloud_policy_manager.cc View 1 2 4 chunks +0 lines, -40 lines 0 comments Download
M chrome/browser/policy/cloud/cloud_policy_manager_unittest.cc View 1 2 3 5 chunks +0 lines, -82 lines 0 comments Download
M chrome/browser/policy/cloud/cloud_policy_refresh_scheduler.h View 1 2 3 4 1 chunk +6 lines, -0 lines 0 comments Download
M chrome/browser/policy/cloud/user_cloud_policy_invalidator.h View 1 2 1 chunk +0 lines, -3 lines 0 comments Download
M chrome/browser/policy/cloud/user_cloud_policy_invalidator.cc View 1 2 3 4 5 6 7 3 chunks +16 lines, -12 lines 0 comments Download
M chrome/browser/policy/cloud/user_cloud_policy_manager.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 14 (0 generated)
Steve Condie
7 years, 3 months ago (2013-08-29 01:34:51 UTC) #1
Mattias Nissler (ping if slow)
Some initial comments, let me know whether they make sense. https://chromiumcodereview-hr.appspot.com/23592017/diff/6001/chrome/browser/policy/cloud/cloud_policy_invalidator.h File chrome/browser/policy/cloud/cloud_policy_invalidator.h (right): https://chromiumcodereview-hr.appspot.com/23592017/diff/6001/chrome/browser/policy/cloud/cloud_policy_invalidator.h#newcode52 ...
7 years, 3 months ago (2013-08-29 16:02:30 UTC) #2
Steve Condie
https://codereview.chromium.org/23592017/diff/6001/chrome/browser/policy/cloud/cloud_policy_invalidator.h File chrome/browser/policy/cloud/cloud_policy_invalidator.h (right): https://codereview.chromium.org/23592017/diff/6001/chrome/browser/policy/cloud/cloud_policy_invalidator.h#newcode52 chrome/browser/policy/cloud/cloud_policy_invalidator.h:52: // ready or if it is not needed. On ...
7 years, 3 months ago (2013-08-30 00:16:34 UTC) #3
Mattias Nissler (ping if slow)
https://codereview.chromium.org/23592017/diff/6001/chrome/browser/policy/cloud/cloud_policy_invalidator.h File chrome/browser/policy/cloud/cloud_policy_invalidator.h (right): https://codereview.chromium.org/23592017/diff/6001/chrome/browser/policy/cloud/cloud_policy_invalidator.h#newcode52 chrome/browser/policy/cloud/cloud_policy_invalidator.h:52: // ready or if it is not needed. On ...
7 years, 3 months ago (2013-09-02 11:54:51 UTC) #4
Steve Condie
https://codereview.chromium.org/23592017/diff/18001/chrome/browser/policy/cloud/cloud_policy_core.cc File chrome/browser/policy/cloud/cloud_policy_core.cc (right): https://codereview.chromium.org/23592017/diff/18001/chrome/browser/policy/cloud/cloud_policy_core.cc#newcode37 chrome/browser/policy/cloud/cloud_policy_core.cc:37: FOR_EACH_OBSERVER(Observer, observers_, OnCoreDisconnected(this)); On 2013/09/02 11:54:52, Mattias Nissler wrote: ...
7 years, 3 months ago (2013-09-03 04:41:56 UTC) #5
Mattias Nissler (ping if slow)
Almost there. I'd like to resolve the question w.r.t. how InvalidationService initialization should be handled ...
7 years, 3 months ago (2013-09-03 14:46:36 UTC) #6
Steve Condie
https://codereview.chromium.org/23592017/diff/18001/chrome/browser/policy/cloud/cloud_policy_invalidator.cc File chrome/browser/policy/cloud/cloud_policy_invalidator.cc (right): https://codereview.chromium.org/23592017/diff/18001/chrome/browser/policy/cloud/cloud_policy_invalidator.cc#newcode335 chrome/browser/policy/cloud/cloud_policy_invalidator.cc:335: policy_refresh_count_++; On 2013/09/03 14:46:36, Mattias Nissler wrote: > On ...
7 years, 3 months ago (2013-09-04 18:00:38 UTC) #7
Mattias Nissler (ping if slow)
Thanks for bearing with me, almost there. https://codereview.chromium.org/23592017/diff/18001/chrome/browser/policy/cloud/cloud_policy_invalidator.cc File chrome/browser/policy/cloud/cloud_policy_invalidator.cc (right): https://codereview.chromium.org/23592017/diff/18001/chrome/browser/policy/cloud/cloud_policy_invalidator.cc#newcode335 chrome/browser/policy/cloud/cloud_policy_invalidator.cc:335: policy_refresh_count_++; On ...
7 years, 3 months ago (2013-09-05 14:54:04 UTC) #8
Steve Condie
https://codereview.chromium.org/23592017/diff/18001/chrome/browser/policy/cloud/cloud_policy_invalidator.cc File chrome/browser/policy/cloud/cloud_policy_invalidator.cc (right): https://codereview.chromium.org/23592017/diff/18001/chrome/browser/policy/cloud/cloud_policy_invalidator.cc#newcode335 chrome/browser/policy/cloud/cloud_policy_invalidator.cc:335: policy_refresh_count_++; On 2013/09/05 14:54:04, Mattias Nissler wrote: > On ...
7 years, 3 months ago (2013-09-06 06:23:05 UTC) #9
Mattias Nissler (ping if slow)
LGTM once you address the two remaining comments. https://codereview.chromium.org/23592017/diff/52001/chrome/browser/policy/cloud/user_cloud_policy_invalidator.cc File chrome/browser/policy/cloud/user_cloud_policy_invalidator.cc (right): https://codereview.chromium.org/23592017/diff/52001/chrome/browser/policy/cloud/user_cloud_policy_invalidator.cc#newcode48 chrome/browser/policy/cloud/user_cloud_policy_invalidator.cc:48: &invalidation::InvalidationServiceFactory::GetForProfile, ...
7 years, 3 months ago (2013-09-06 08:51:53 UTC) #10
Steve Condie
https://codereview.chromium.org/23592017/diff/52001/chrome/browser/policy/cloud/user_cloud_policy_invalidator.cc File chrome/browser/policy/cloud/user_cloud_policy_invalidator.cc (right): https://codereview.chromium.org/23592017/diff/52001/chrome/browser/policy/cloud/user_cloud_policy_invalidator.cc#newcode48 chrome/browser/policy/cloud/user_cloud_policy_invalidator.cc:48: &invalidation::InvalidationServiceFactory::GetForProfile, On 2013/09/06 08:51:54, Mattias Nissler wrote: > On ...
7 years, 3 months ago (2013-09-06 18:01:40 UTC) #11
rlarocque
DEPS change LGTM.
7 years, 3 months ago (2013-09-06 18:10:08 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/stepco@chromium.org/23592017/61001
7 years, 3 months ago (2013-09-06 18:26:48 UTC) #13
commit-bot: I haz the power
7 years, 3 months ago (2013-09-07 00:42:25 UTC) #14
Message was sent while issue was closed.
Change committed as 221837

Powered by Google App Engine
This is Rietveld 408576698