OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/services/gcm/gcm_profile_service.h" | 5 #include "chrome/browser/services/gcm/gcm_profile_service.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 void GCMProfileService::RegisterProfilePrefs( | 135 void GCMProfileService::RegisterProfilePrefs( |
136 user_prefs::PrefRegistrySyncable* registry) { | 136 user_prefs::PrefRegistrySyncable* registry) { |
137 registry->RegisterBooleanPref( | 137 registry->RegisterBooleanPref( |
138 prefs::kGCMChannelEnabled, | 138 prefs::kGCMChannelEnabled, |
139 true, | 139 true, |
140 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 140 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
141 PushMessagingServiceImpl::RegisterProfilePrefs(registry); | 141 PushMessagingServiceImpl::RegisterProfilePrefs(registry); |
142 } | 142 } |
143 | 143 |
144 #if defined(OS_ANDROID) | 144 #if defined(OS_ANDROID) |
145 static GCMProfileService* debug_instance = nullptr; // TODO(johnme): Remove. | |
146 | |
145 GCMProfileService::GCMProfileService(Profile* profile) | 147 GCMProfileService::GCMProfileService(Profile* profile) |
146 : profile_(profile), | 148 : profile_(profile), |
147 push_messaging_service_(this, profile) { | 149 push_messaging_service_(this, profile) { |
148 DCHECK(!profile->IsOffTheRecord()); | 150 CHECK(!profile->IsOffTheRecord()); |
151 | |
152 // TODO(johnme): Remove this debug code once the following crash has been | |
153 // understood: https://goto.google.com/gcmdriver-already-instantiated | |
Bernhard Bauer
2015/01/08 16:38:25
Just reference the bug here.
johnme
2015/01/08 16:49:01
Done.
| |
154 if (debug_instance != nullptr) { | |
155 LOG(FATAL) << "An instance of GCMProfileService already exists!" | |
156 << " Old profile: " << debug_instance->profile_ << " " | |
157 << debug_instance->profile_->GetDebugName() << " " | |
158 << debug_instance->profile_->GetProfileType() << " " | |
159 << debug_instance->profile_->IsSupervised() << " " | |
160 << debug_instance->profile_->IsNewProfile() << " " | |
161 << debug_instance->profile_->GetStartTime().ToInternalValue() | |
162 << ", new profile: " << profile << " " | |
163 << profile_->GetDebugName() << " " | |
164 << profile_->GetProfileType() << " " | |
165 << profile_->IsSupervised() << " " | |
166 << profile_->IsNewProfile() << " " | |
167 << profile_->GetStartTime().ToInternalValue(); | |
168 } | |
169 debug_instance = this; | |
149 | 170 |
150 driver_.reset(new GCMDriverAndroid); | 171 driver_.reset(new GCMDriverAndroid); |
151 } | 172 } |
152 #else | 173 #else |
153 GCMProfileService::GCMProfileService( | 174 GCMProfileService::GCMProfileService( |
154 Profile* profile, | 175 Profile* profile, |
155 scoped_ptr<GCMClientFactory> gcm_client_factory) | 176 scoped_ptr<GCMClientFactory> gcm_client_factory) |
156 : profile_(profile), | 177 : profile_(profile), |
157 push_messaging_service_(this, profile) { | 178 push_messaging_service_(this, profile) { |
158 DCHECK(!profile->IsOffTheRecord()); | 179 DCHECK(!profile->IsOffTheRecord()); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
196 | 217 |
197 void GCMProfileService::SetDriverForTesting(GCMDriver* driver) { | 218 void GCMProfileService::SetDriverForTesting(GCMDriver* driver) { |
198 driver_.reset(driver); | 219 driver_.reset(driver); |
199 #if !defined(OS_ANDROID) | 220 #if !defined(OS_ANDROID) |
200 if (identity_observer_) | 221 if (identity_observer_) |
201 identity_observer_.reset(new IdentityObserver(profile_, driver)); | 222 identity_observer_.reset(new IdentityObserver(profile_, driver)); |
202 #endif // !defined(OS_ANDROID) | 223 #endif // !defined(OS_ANDROID) |
203 } | 224 } |
204 | 225 |
205 } // namespace gcm | 226 } // namespace gcm |
OLD | NEW |