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

Issue 165993005: [GCM] Make sure GCM checkout logic is invoked when the profile is signed out (Closed)

Created:
6 years, 10 months ago by jianli
Modified:
6 years, 9 months ago
CC:
chromium-reviews, tim+watch_chromium.org, extensions-reviews_chromium.org, jar (doing other things), haitaol+watch_chromium.org, asvitkine+watch_chromium.org, chromium-apps-reviews_chromium.org, Ilya Sherman, maniscalco+watch_chromium.org
Visibility:
Public.

Description

[GCM] Make sure GCM checkout logic is invoked when the profile is signed out We now always create GCMProfileService that listens to profile notifications such that GCM checkout logic could be invoked when the profile is signed out. We now move the GCM check-in logic from GCMClient::Initialize to GCMClient::CheckIn. BUG=344031 TEST=new tests added and existing tests updated Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=253787

Patch Set 1 : Patch #

Patch Set 2 : Fix trybots #

Total comments: 14

Patch Set 3 : Fix trybots #

Patch Set 4 : Address feedback #

Total comments: 12

Patch Set 5 : Address more feedback #

Total comments: 14

Patch Set 6 : Address more feedback #

Total comments: 2

Patch Set 7 : Sync #

Patch Set 8 : Patch to land #

Patch Set 9 : Fix test failures on trybots #

Total comments: 2

Patch Set 10 : Sync #

Patch Set 11 : Fix resign-in issue #

Patch Set 12 : Fix linux_tsan #

Total comments: 4

Patch Set 13 : Address more feedback #

Patch Set 14 : Fix test #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+419 lines, -235 lines) Patch
M chrome/browser/extensions/api/gcm/gcm_api.cc View 1 2 3 4 5 1 chunk +8 lines, -2 lines 0 comments Download
M chrome/browser/extensions/api/gcm/gcm_apitest.cc View 1 2 3 4 5 3 chunks +14 lines, -1 line 0 comments Download
M chrome/browser/services/gcm/fake_gcm_profile_service.h View 1 2 3 4 5 1 chunk +0 lines, -2 lines 0 comments Download
M chrome/browser/services/gcm/fake_gcm_profile_service.cc View 1 2 3 4 5 1 chunk +0 lines, -5 lines 0 comments Download
M chrome/browser/services/gcm/gcm_client_mock.h View 1 2 3 4 5 6 7 8 9 10 11 7 chunks +22 lines, -9 lines 0 comments Download
M chrome/browser/services/gcm/gcm_client_mock.cc View 1 2 3 4 5 6 7 8 9 10 11 9 chunks +40 lines, -26 lines 0 comments Download
M chrome/browser/services/gcm/gcm_profile_service.h View 1 2 3 4 5 6 7 8 9 10 11 12 5 chunks +17 lines, -14 lines 0 comments Download
M chrome/browser/services/gcm/gcm_profile_service.cc View 1 2 3 4 5 6 7 8 9 10 11 12 16 chunks +106 lines, -79 lines 2 comments Download
M chrome/browser/services/gcm/gcm_profile_service_factory.cc View 1 2 3 4 5 2 chunks +2 lines, -3 lines 0 comments Download
M chrome/browser/services/gcm/gcm_profile_service_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 17 chunks +143 lines, -41 lines 0 comments Download
M chrome/browser/sync/profile_sync_service.cc View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/browser/sync/profile_sync_service_factory.cc View 1 chunk +4 lines, -10 lines 1 comment Download
M google_apis/gcm/engine/mcs_client.h View 1 2 1 chunk +0 lines, -7 lines 0 comments Download
M google_apis/gcm/engine/mcs_client.cc View 1 2 3 4 5 6 7 8 9 1 chunk +0 lines, -5 lines 0 comments Download
M google_apis/gcm/gcm_client.h View 1 2 3 4 5 6 7 8 9 3 chunks +6 lines, -4 lines 0 comments Download
M google_apis/gcm/gcm_client_impl.h View 1 2 3 4 5 6 7 8 9 3 chunks +6 lines, -1 line 0 comments Download
M google_apis/gcm/gcm_client_impl.cc View 1 2 3 4 5 6 7 8 9 10 6 chunks +36 lines, -26 lines 0 comments Download
M google_apis/gcm/gcm_client_impl_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +5 lines, -0 lines 0 comments Download
M tools/metrics/histograms/histograms.xml View 1 chunk +8 lines, -0 lines 0 comments Download

Messages

Total messages: 23 (0 generated)
jianli
zea and fgorski, please review all. asvitkine, please review the new histogram being added.
6 years, 10 months ago (2014-02-20 20:52:11 UTC) #1
fgorski
https://codereview.chromium.org/165993005/diff/90001/chrome/browser/services/gcm/gcm_client_mock.cc File chrome/browser/services/gcm/gcm_client_mock.cc (right): https://codereview.chromium.org/165993005/diff/90001/chrome/browser/services/gcm/gcm_client_mock.cc#newcode38 chrome/browser/services/gcm/gcm_client_mock.cc:38: DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); Do you want to add a DCHECK that ...
6 years, 10 months ago (2014-02-20 22:18:40 UTC) #2
jianli
https://codereview.chromium.org/165993005/diff/90001/chrome/browser/services/gcm/gcm_client_mock.cc File chrome/browser/services/gcm/gcm_client_mock.cc (right): https://codereview.chromium.org/165993005/diff/90001/chrome/browser/services/gcm/gcm_client_mock.cc#newcode38 chrome/browser/services/gcm/gcm_client_mock.cc:38: DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); On 2014/02/20 22:18:40, Filip Gorski wrote: > Do ...
6 years, 10 months ago (2014-02-21 18:25:10 UTC) #3
Nicolas Zea
https://codereview.chromium.org/165993005/diff/260001/chrome/browser/services/gcm/gcm_profile_service.cc File chrome/browser/services/gcm/gcm_profile_service.cc (right): https://codereview.chromium.org/165993005/diff/260001/chrome/browser/services/gcm/gcm_profile_service.cc#newcode529 chrome/browser/services/gcm/gcm_profile_service.cc:529: // Create and initialize the GCMClient. Note that this ...
6 years, 10 months ago (2014-02-21 18:43:32 UTC) #4
Alexei Svitkine (slow)
https://codereview.chromium.org/165993005/diff/260001/google_apis/gcm/gcm_client_impl.cc File google_apis/gcm/gcm_client_impl.cc (right): https://codereview.chromium.org/165993005/diff/260001/google_apis/gcm/gcm_client_impl.cc#newcode381 google_apis/gcm/gcm_client_impl.cc:381: LOG_IF(ERROR, !success) << "GCM store failed to be destroyed!"; ...
6 years, 10 months ago (2014-02-21 18:55:40 UTC) #5
Nicolas Zea
https://codereview.chromium.org/165993005/diff/260001/google_apis/gcm/gcm_client.h File google_apis/gcm/gcm_client.h (right): https://codereview.chromium.org/165993005/diff/260001/google_apis/gcm/gcm_client.h#newcode135 google_apis/gcm/gcm_client.h:135: // Begins initialization of the GCM Client. mention that ...
6 years, 10 months ago (2014-02-21 18:58:59 UTC) #6
jianli
https://codereview.chromium.org/165993005/diff/260001/chrome/browser/services/gcm/gcm_profile_service.cc File chrome/browser/services/gcm/gcm_profile_service.cc (right): https://codereview.chromium.org/165993005/diff/260001/chrome/browser/services/gcm/gcm_profile_service.cc#newcode529 chrome/browser/services/gcm/gcm_profile_service.cc:529: // Create and initialize the GCMClient. Note that this ...
6 years, 10 months ago (2014-02-21 20:24:06 UTC) #7
Alexei Svitkine (slow)
histograms lgtm
6 years, 10 months ago (2014-02-21 20:41:41 UTC) #8
Nicolas Zea
mainly nits https://codereview.chromium.org/165993005/diff/390001/chrome/browser/extensions/api/gcm/gcm_apitest.cc File chrome/browser/extensions/api/gcm/gcm_apitest.cc (right): https://codereview.chromium.org/165993005/diff/390001/chrome/browser/extensions/api/gcm/gcm_apitest.cc#newcode47 chrome/browser/extensions/api/gcm/gcm_apitest.cc:47: // GCMProfileService instance as in SetUpOnMainThread. To ...
6 years, 10 months ago (2014-02-21 20:58:58 UTC) #9
fgorski
lgtm mod comment https://codereview.chromium.org/165993005/diff/390001/google_apis/gcm/gcm_client_impl_unittest.cc File google_apis/gcm/gcm_client_impl_unittest.cc (right): https://codereview.chromium.org/165993005/diff/390001/google_apis/gcm/gcm_client_impl_unittest.cc#newcode287 google_apis/gcm/gcm_client_impl_unittest.cc:287: gcm_client_->CheckIn(); Load as well
6 years, 10 months ago (2014-02-21 22:05:06 UTC) #10
jianli
https://codereview.chromium.org/165993005/diff/390001/chrome/browser/extensions/api/gcm/gcm_apitest.cc File chrome/browser/extensions/api/gcm/gcm_apitest.cc (right): https://codereview.chromium.org/165993005/diff/390001/chrome/browser/extensions/api/gcm/gcm_apitest.cc#newcode47 chrome/browser/extensions/api/gcm/gcm_apitest.cc:47: // GCMProfileService instance as in SetUpOnMainThread. To work around ...
6 years, 10 months ago (2014-02-22 00:03:05 UTC) #11
Nicolas Zea
lgtm https://codereview.chromium.org/165993005/diff/410003/chrome/browser/services/gcm/gcm_profile_service.cc File chrome/browser/services/gcm/gcm_profile_service.cc (right): https://codereview.chromium.org/165993005/diff/410003/chrome/browser/services/gcm/gcm_profile_service.cc#newcode434 chrome/browser/services/gcm/gcm_profile_service.cc:434: // might have been signed in again. nit: ...
6 years, 10 months ago (2014-02-22 00:20:46 UTC) #12
Nicolas Zea
Mostly still LG https://codereview.chromium.org/165993005/diff/890001/chrome/browser/services/gcm/gcm_profile_service_unittest.cc File chrome/browser/services/gcm/gcm_profile_service_unittest.cc (right): https://codereview.chromium.org/165993005/diff/890001/chrome/browser/services/gcm/gcm_profile_service_unittest.cc#newcode101 chrome/browser/services/gcm/gcm_profile_service_unittest.cc:101: content::BrowserThread::PostTask( Doesn't RunUntilIdle accomplish the same ...
6 years, 10 months ago (2014-02-26 02:26:36 UTC) #13
fgorski
still lg. https://codereview.chromium.org/165993005/diff/970001/google_apis/gcm/gcm_client_impl_unittest.cc File google_apis/gcm/gcm_client_impl_unittest.cc (right): https://codereview.chromium.org/165993005/diff/970001/google_apis/gcm/gcm_client_impl_unittest.cc#newcode288 google_apis/gcm/gcm_client_impl_unittest.cc:288: gcm_client_->Load(); move after the encryptor update
6 years, 10 months ago (2014-02-26 18:36:30 UTC) #14
jianli
https://codereview.chromium.org/165993005/diff/890001/chrome/browser/services/gcm/gcm_profile_service_unittest.cc File chrome/browser/services/gcm/gcm_profile_service_unittest.cc (right): https://codereview.chromium.org/165993005/diff/890001/chrome/browser/services/gcm/gcm_profile_service_unittest.cc#newcode101 chrome/browser/services/gcm/gcm_profile_service_unittest.cc:101: content::BrowserThread::PostTask( On 2014/02/26 02:26:37, Nicolas Zea wrote: > Doesn't ...
6 years, 10 months ago (2014-02-26 19:04:24 UTC) #15
Nicolas Zea
lgtm
6 years, 10 months ago (2014-02-26 20:34:49 UTC) #16
jianli
The CQ bit was checked by jianli@chromium.org
6 years, 10 months ago (2014-02-27 02:09:13 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jianli@chromium.org/165993005/1000001
6 years, 10 months ago (2014-02-27 02:15:43 UTC) #18
commit-bot: I haz the power
Change committed as 253787
6 years, 9 months ago (2014-02-27 13:46:56 UTC) #19
SeRya
https://codereview.chromium.org/165993005/diff/1000001/chrome/browser/services/gcm/gcm_profile_service.cc File chrome/browser/services/gcm/gcm_profile_service.cc (right): https://codereview.chromium.org/165993005/diff/1000001/chrome/browser/services/gcm/gcm_profile_service.cc#newcode544 chrome/browser/services/gcm/gcm_profile_service.cc:544: scoped_refptr<net::URLRequestContextGetter> url_request_context_getter = I tried to use ProfileSyncService on ...
6 years, 9 months ago (2014-03-04 08:35:25 UTC) #20
jianli
https://codereview.chromium.org/165993005/diff/1000001/chrome/browser/services/gcm/gcm_profile_service.cc File chrome/browser/services/gcm/gcm_profile_service.cc (right): https://codereview.chromium.org/165993005/diff/1000001/chrome/browser/services/gcm/gcm_profile_service.cc#newcode544 chrome/browser/services/gcm/gcm_profile_service.cc:544: scoped_refptr<net::URLRequestContextGetter> url_request_context_getter = On 2014/03/04 08:35:26, SeRya wrote: > ...
6 years, 9 months ago (2014-03-05 01:37:33 UTC) #21
SeRya
On 2014/03/05 01:37:33, jianli wrote: > https://codereview.chromium.org/165993005/diff/1000001/chrome/browser/services/gcm/gcm_profile_service.cc > File chrome/browser/services/gcm/gcm_profile_service.cc (right): > > https://codereview.chromium.org/165993005/diff/1000001/chrome/browser/services/gcm/gcm_profile_service.cc#newcode544 > ...
6 years, 9 months ago (2014-03-05 05:45:52 UTC) #22
jianli
6 years, 9 months ago (2014-03-06 07:29:40 UTC) #23
On Tue, Mar 4, 2014 at 9:45 PM, <serya@chromium.org> wrote:

> On 2014/03/05 01:37:33, jianli wrote:
>
> https://codereview.chromium.org/165993005/diff/1000001/
> chrome/browser/services/gcm/gcm_profile_service.cc
>
>> File chrome/browser/services/gcm/gcm_profile_service.cc (right):
>>
>
>
> https://codereview.chromium.org/165993005/diff/1000001/
> chrome/browser/services/gcm/gcm_profile_service.cc#newcode544
>
>> chrome/browser/services/gcm/gcm_profile_service.cc:544:
>> scoped_refptr<net::URLRequestContextGetter> url_request_context_getter =
>> On 2014/03/04 08:35:26, SeRya wrote:
>> > I tried to use ProfileSyncService on startup and got the following
>> failure:
>> >
>> > [10007:10007:0304/122239:FATAL:profile_impl.cc(991)] Check failed:
>> > ssl_config_service_manager_. SSLConfigServiceManager is not initialized
>> yet
>> >  [0x7f0417dda49e] base::debug::StackTrace::StackTrace()
>> >  [0x7f0417e320a5] logging::LogMessage::~LogMessage()
>> >  [0x7f041bc2ae94] ProfileImpl::GetSSLConfigService()
>> >  [0x7f041b6c452e] ProfileIOData::InitializeOnUIThread()
>> >  [0x7f041bc300dc] ProfileImplIOData::Handle::LazyInitialize()
>> >  [0x7f041bc2fefd] ProfileImplIOData::Handle::GetResourceContext()
>> >  [0x7f041bc2acfc] ProfileImpl::GetResourceContext()
>> >  [0x7f041d1da911] content::StoragePartitionImplMap::Get()
>> >  [0x7f041cde3ccf] content::(anonymous
>> > namespace)::GetStoragePartitionFromConfig()
>> >  [0x7f041cde3c3a] content::BrowserContext::GetStoragePartition()
>> >  [0x7f041cde3e1f] content::BrowserContext::GetDefaultStoragePartition()
>> >  [0x7f041bc2a945] ProfileImpl::GetRequestContext()
>> >  [0x7f041c24c375] gcm::GCMProfileService::Initialize()
>> >  [0x7f041bc76236] gcm::GCMProfileServiceFactory:
>> :BuildServiceInstanceFor()
>> >  [0x7f041e33dd45]
>> > BrowserContextKeyedServiceFactory::GetServiceForBrowserContext()
>> >  [0x7f041bc760c7] gcm::GCMProfileServiceFactory::GetForProfile()
>> >  [0x7f041b7efd21] ProfileSyncServiceFactory::BuildServiceInstanceFor()
>> >  [0x7f041e33dd45]
>> > BrowserContextKeyedServiceFactory::GetServiceForBrowserContext()
>> >  [0x7f041b7efa8f] ProfileSyncServiceFactory::GetForProfile()
>> >
>> > There is a comment at the DCHEK:
>> >
>> >   // If ssl_config_service_manager_ is null, this typically means that
>> some
>> >   // BrowserContextKeyedService is trying to create a RequestContext at
>> startup,
>> >   // but SSLConfigServiceManager is not initialized until DoFinalInit()
>>
> which
>
>> is
>> >   // invoked after all BrowserContextKeyedServices have been initialized
>>
> (see
>
>> >   // http://crbug.com/171406).
>> >
>> >
>>
>
> https://code.google.com/p/chromium/codesearch#chromium/
> src/chrome/browser/profiles/profile_impl.cc&l=986
>
>> >
>> > Doesn't it make sense to avoid using profile_->GetRequestContext() in
>>
> service
>
>> > initialization?
>>
>
>  I can't repro this. Could you please share how you get this? OS? Version?
>>
>
> My reduced code is like this:
>
> class MyServiceFactory : public BrowserContextKeyedServiceFactory {
>  public:
>   static MyServiceFactory* GetInstance();
>
>   virtual bool ServiceIsCreatedWithBrowserContext() const { return true;
> /*
> Create on startup */ }
>
>   virtual BrowserContextKeyedService* BuildServiceInstanceFor(
>       content::BrowserContext* context) const {
>     Profile* const profile = static_cast<Profile*>(context);
>     ProfileSyncServiceFactory::GetForProfile(profile);
>     ...
>   }
> }
>
> chrome_browser_main_extra_parts_profiles.cc:
>
> MyServiceFactory::GetInstance();
>
> Linux64, Debug
>

My guess is that MyServiceFactory is created a bit too early. When I have
time tomorrow, I will try to follow your code to repro it. Thanks.


> https://codereview.chromium.org/165993005/
>

To unsubscribe from this group and stop receiving emails from it, send an email
to chromium-reviews+unsubscribe@chromium.org.

Powered by Google App Engine
This is Rietveld 408576698