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

Side by Side Diff: chrome/browser/sync/profile_sync_service.cc

Issue 11037007: [Sync] Require ProfileSyncService to have an uninitialized backend on shutdown (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/sync/profile_sync_service_autofill_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/sync/profile_sync_service.h" 5 #include "chrome/browser/sync/profile_sync_service.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); 159 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
160 if (channel == chrome::VersionInfo::CHANNEL_STABLE || 160 if (channel == chrome::VersionInfo::CHANNEL_STABLE ||
161 channel == chrome::VersionInfo::CHANNEL_BETA) { 161 channel == chrome::VersionInfo::CHANNEL_BETA) {
162 sync_service_url_ = GURL(kSyncServerUrl); 162 sync_service_url_ = GURL(kSyncServerUrl);
163 } 163 }
164 #endif 164 #endif
165 } 165 }
166 166
167 ProfileSyncService::~ProfileSyncService() { 167 ProfileSyncService::~ProfileSyncService() {
168 sync_prefs_.RemoveSyncPrefObserver(this); 168 sync_prefs_.RemoveSyncPrefObserver(this);
169 Shutdown(); 169 // Shutdown() should have been called before destruction.
170 CHECK(!backend_initialized_);
tim (not reviewing) 2012/10/01 21:18:57 Hmm. I think DCHECK is more appropriate here (usin
170 } 171 }
171 172
172 bool ProfileSyncService::IsSyncEnabledAndLoggedIn() { 173 bool ProfileSyncService::IsSyncEnabledAndLoggedIn() {
173 // Exit if sync is disabled. 174 // Exit if sync is disabled.
174 if (IsManaged() || sync_prefs_.IsStartSuppressed()) 175 if (IsManaged() || sync_prefs_.IsStartSuppressed())
175 return false; 176 return false;
176 177
177 // Sync is logged in if there is a non-empty authenticated username. 178 // Sync is logged in if there is a non-empty authenticated username.
178 return !signin_->GetAuthenticatedUsername().empty(); 179 return !signin_->GetAuthenticatedUsername().empty();
179 } 180 }
(...skipping 1641 matching lines...) Expand 10 before | Expand all | Expand 10 after
1821 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine d-behaviour-after-directly-calling-the-destru. 1822 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine d-behaviour-after-directly-calling-the-destru.
1822 ProfileSyncService* old_this = this; 1823 ProfileSyncService* old_this = this;
1823 this->~ProfileSyncService(); 1824 this->~ProfileSyncService();
1824 new(old_this) ProfileSyncService( 1825 new(old_this) ProfileSyncService(
1825 new ProfileSyncComponentsFactoryImpl(profile, 1826 new ProfileSyncComponentsFactoryImpl(profile,
1826 CommandLine::ForCurrentProcess()), 1827 CommandLine::ForCurrentProcess()),
1827 profile, 1828 profile,
1828 signin, 1829 signin,
1829 behavior); 1830 behavior);
1830 } 1831 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync/profile_sync_service_autofill_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698